summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-09-15 01:19:55 (GMT)
committerSteven Knight <knight@baldmt.com>2004-09-15 01:19:55 (GMT)
commit7fef06f597626b9ee3faa0aa716819258e583812 (patch)
treec43c6b210684e12eb7c33ddc82ef5325be21feb4
parentdecb5aded9c3103e52a31cd75fed2391e7bf29c5 (diff)
downloadSCons-7fef06f597626b9ee3faa0aa716819258e583812.zip
SCons-7fef06f597626b9ee3faa0aa716819258e583812.tar.gz
SCons-7fef06f597626b9ee3faa0aa716819258e583812.tar.bz2
Handle exceptions in FunctionActions. (Steve Christensen)
-rw-r--r--etc/TestCmd.py16
-rw-r--r--etc/TestCommon.py4
-rw-r--r--src/engine/SCons/Action.py7
-rw-r--r--src/engine/SCons/Node/FS.py12
-rw-r--r--src/engine/SCons/Node/FSTests.py2
-rw-r--r--src/engine/SCons/Script/__init__.py5
-rw-r--r--test/build-errors.py33
-rw-r--r--www/index.html15
-rw-r--r--www/project_highlights.html4
9 files changed, 73 insertions, 25 deletions
diff --git a/etc/TestCmd.py b/etc/TestCmd.py
index 9533398..cc73dd1 100644
--- a/etc/TestCmd.py
+++ b/etc/TestCmd.py
@@ -175,8 +175,8 @@ version.
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCmd.py 0.8.D001 2004/07/15 06:24:14 knight"
-__version__ = "0.8"
+__revision__ = "TestCmd.py 0.11.D001 2004/09/13 13:22:19 knight"
+__version__ = "0.11"
import os
import os.path
@@ -860,10 +860,14 @@ class TestCmd:
f = _mode_writable
else:
f = _mode_non_writable
- try:
- os.path.walk(top, _walk_chmod, f)
- except:
- pass # ignore any problems changing modes
+ if os.path.isfile(top):
+ st = os.stat(top)
+ os.chmod(top, f(st[stat.ST_MODE]))
+ else:
+ try:
+ os.path.walk(top, _walk_chmod, f)
+ except:
+ pass # ignore any problems changing modes
def write(self, file, content, mode = 'wb'):
"""Writes the specified content text (second argument) to the
diff --git a/etc/TestCommon.py b/etc/TestCommon.py
index 43cfddd..924f8f8 100644
--- a/etc/TestCommon.py
+++ b/etc/TestCommon.py
@@ -76,8 +76,8 @@ The TestCommon module also provides the following variables
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
__author__ = "Steven Knight <knight at baldmt dot com>"
-__revision__ = "TestCommon.py 0.10.D001 2004/08/17 17:39:41 knight"
-__version__ = "0.10"
+__revision__ = "TestCommon.py 0.11.D001 2004/09/13 13:22:19 knight"
+__version__ = "0.11"
import os
import os.path
diff --git a/src/engine/SCons/Action.py b/src/engine/SCons/Action.py
index 63d8c98..e110d60 100644
--- a/src/engine/SCons/Action.py
+++ b/src/engine/SCons/Action.py
@@ -497,7 +497,12 @@ class FunctionAction(ActionBase):
def execute(self, target, source, env):
rsources = map(rfile, source)
- return self.execfunction(target=target, source=rsources, env=env)
+ try:
+ result = self.execfunction(target=target, source=rsources, env=env)
+ except EnvironmentError, e:
+ # If an IOError/OSError happens, raise a BuildError.
+ raise SCons.Errors.BuildError(node=target, errstr=e.strerror)
+ return result
def get_contents(self, target, source, env, dict=None):
"""Return the signature contents of this callable action.
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 7f0ca62..6d2dd8b 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -1639,11 +1639,7 @@ class File(Base):
if self.get_state() != SCons.Node.up_to_date:
if self.exists():
if self.is_derived() and not self.precious:
- try:
- Unlink(self, [], None)
- except OSError, e:
- raise SCons.Errors.BuildError(node = self,
- errstr = e.strerror)
+ Unlink(self, [], None)
try:
delattr(self, '_exists')
except AttributeError:
@@ -1670,12 +1666,12 @@ class File(Base):
self._createDir()
try:
Unlink(self, None, None)
- except OSError:
+ except SCons.Errors.BuildError:
pass
try:
Link(self, src, None)
- except IOError, e:
- desc = "Cannot duplicate `%s' in `%s': %s." % (src, self.dir, e.strerror)
+ except SCons.Errors.BuildError, e:
+ desc = "Cannot duplicate `%s' in `%s': %s." % (src, self.dir, e.errstr)
raise SCons.Errors.StopError, desc
self.linked = 1
# The Link() action may or may not have actually
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index c213d26..3e80309 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -344,7 +344,7 @@ class BuildDirTestCase(unittest.TestCase):
save_Link = SCons.Node.FS.Link
def Link_IOError(target, source, env):
raise IOError, "Link_IOError"
- SCons.Node.FS.Link = Link_IOError
+ SCons.Node.FS.Link = SCons.Action.Action(Link_IOError, None)
test.write(['work', 'src', 'IOError'], "work/src/IOError\n")
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 0ad9102..6ae76bf 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -161,7 +161,10 @@ class BuildTask(SCons.Taskmaster.Task):
t, e = sys.exc_info()[:2]
if t == SCons.Errors.BuildError:
- sys.stderr.write("scons: *** [%s] %s\n" % (e.node, e.errstr))
+ fname = e.node
+ if SCons.Util.is_List(e.node):
+ fname = string.join(map(str, e.node), ', ')
+ sys.stderr.write("scons: *** [%s] %s\n" % (fname, e.errstr))
if e.errstr == 'Exception':
traceback.print_exception(e.args[0], e.args[1], e.args[2])
elif t == SCons.Errors.ExplicitExit:
diff --git a/test/build-errors.py b/test/build-errors.py
index 1ea2d7a..f64786f 100644
--- a/test/build-errors.py
+++ b/test/build-errors.py
@@ -187,4 +187,37 @@ else:
break
test.fail_test(error_message_not_found)
+test.write('SConstruct4', r"""
+env = Environment()
+env.Command('test.out', 'test.in', 'cp $SOURCE $TARGET')
+env.InstallAs('test2.out', 'test.out')
+# Mark test2.out as precious so we'll handle the exception in
+# FunctionAction() rather than when the target is cleaned before building.
+env.Precious('test2.out')
+env.Default('test2.out')
+""")
+
+test.write('test.in', "test.in 1\n")
+
+test.run(arguments = '-f SConstruct4 .')
+
+test.write('test.in', "test.in 2\n")
+
+test.writable('test2.out', 0)
+f = open(test.workpath('test2.out'))
+
+test.run(arguments = '-f SConstruct4 .',
+ stderr = None,
+ status = 2)
+
+f.close()
+test.writable('test2.out', 1)
+
+test.description_set("Incorrect STDERR:\n%s" % test.stderr())
+errs = [
+ "scons: *** [test2.out] Permission denied\n",
+ "scons: *** [test2.out] permission denied\n",
+]
+test.fail_test(test.stderr() not in errs)
+
test.pass_test()
diff --git a/www/index.html b/www/index.html
index 52ee1f5..eb34978 100644
--- a/www/index.html
+++ b/www/index.html
@@ -4,7 +4,7 @@
<body>
<p>SCons is a next-generation,
-cross-platform build tool.
+cross-platform, build tool.
Think of SCons as an improved
substitute for the classic
<tt>Make</tt> utility
@@ -19,9 +19,10 @@ or wedge a scripting language onto some other
configuration file syntax,
SCons configuration files
are actually Python scripts.
-This gives you a tremendous amount of flexibility
+The ability to script your build
+gives you a tremendous amount of flexibility
to solve complicated build problems
-in surprisingly small amounts of code.
+in surprisingly small amounts of maintainable code.
</p>
<p>
@@ -56,7 +57,13 @@ project.</li>
<h3>Mission</h3>
-<p>What is the goal of this project?
+<p>The goal of The SCons Project
+is to become the premiere build tool for
+cross-platform, multi-language software projects
+by offering unparalleled
+reliability,
+flexibility
+and ease of use.
</p>
<p>What is the scope of this project?
diff --git a/www/project_highlights.html b/www/project_highlights.html
index 93078bc..0a15387 100644
--- a/www/project_highlights.html
+++ b/www/project_highlights.html
@@ -4,13 +4,13 @@
<body>
<p>
-<b>23 August 2004:</b>
+<strong>23 August 2004:</strong>
Bugfix release 0.96.1 fixes
a handful of critical problems in 0.96.
<p>
<p>
-<b>18 August 2004:</b>
+<strong>18 August 2004:</strong>
Beta release 0.96 adds Fortran 90/95 support,
better Qt support,
platform-independent file manipulation actions,