- Fix the ability to specify a target_factory of Dir() to a Builder,
which the default create-a-directory Builder was interfering with.
+ - Mark a directory as built if it's created as part of the preparation
+ for another target, to avoid trying to build it again when it comes
+ up in the target list.
+
From Clive Levinson:
- Make ParseConfig() recognize and add -mno-cygwin to $LINKFLAGS and
return includes
- def _createDir(self):
+ def _createDir(self, update=None):
# ensure that the directories for this node are
# created.
# directory. The dirnode.build() method will suppress
# the build if it's the default builder.
SCons.Node.Node.build(dirnode)
+ if update:
+ # Mark this directory as built so we don't try to build
+ # it again if it has an explicit user-defined Builder.
+ dirnode.set_state(SCons.Node.executed)
+ dirnode.built()
# The build() action may or may not have actually
# created the directory, depending on whether the -n
# option was used or not. Delete the _exists and
pass
else:
try:
- self._createDir()
+ self._createDir(update=1)
except SCons.Errors.StopError, drive:
desc = "No drive `%s' for target `%s'." % (drive, self)
raise SCons.Errors.StopError, desc
"""Test the prepare() method"""
class MyFile(SCons.Node.FS.File):
- def _createDir(self):
+ def _createDir(self, update=None):
raise SCons.Errors.StopError
def exists(self):
return None
xyz.set_state(SCons.Node.up_to_date)
xyz.prepare()
assert dir_made == [], dir_made
+ state = new_dir.get_state()
+ assert state != SCons.Node.executed, state
+
xyz.set_state(0)
xyz.prepare()
assert dir_made[0].path == "new_dir", dir_made[0]
+ state = new_dir.get_state()
+ assert state == SCons.Node.executed, state
dir = fs.Dir("dir")
dir.prepare()
env.Command('f6.out', 'f6.in', [Cat,
Mkdir("Mkdir-$SOURCE"),
Mkdir("$TARGET-Mkdir")])
+# Make sure that a user-defined Mkdir builder on a directory
+# doesn't get executed twice if it has to get called to create
+# directory for another target.
+env.Command(Dir('hello'), None, [Mkdir('$TARGET')])
+env.Command('hello/world', None, [Touch('$TARGET')])
""")
test.write('f2.in', "f2.in\n")
cat(["f6.out"], ["f6.in"])
Mkdir("Mkdir-f6.in")
Mkdir("f6.out-Mkdir")
-""")
+Mkdir("hello")
+Touch("%s")
+""" % (os.path.join('hello', 'world')))
test.run(options = '-n', arguments = '.', stdout = expect)
test.must_not_exist('d1')
test.must_exist('f6.out')
test.must_exist('Mkdir-f6.in')
test.must_exist('f6.out-Mkdir')
+test.must_exist('hello')
+test.must_exist('hello/world')
test.write(['d1', 'file'], "d1/file\n")
test.write(['d3', 'file'], "d3/file\n")
test.write(['Mkdir-f6.in', 'file'], "Mkdir-f6.in/file\n")
test.write(['f6.out-Mkdir', 'file'], "f6.out-Mkdir/file\n")
+test.write(['hello', 'file'], "hello/file\n")
test.pass_test()