# 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
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
# 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
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.
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:
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
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")
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:
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()
<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
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>
<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?
<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,