- Fixed use of sys.path so Python modules can be imported from
the SConscript directory.
+ - Fix for using Aliases with the -u, -U and -D options.
+
From Moshe Zadka:
- Changes for official Debian packaging.
def sconsign(self):
"""An Alias is not recorded in .sconsign files"""
pass
+
+ def is_under(self, dir):
+ # Make Alias nodes get built regardless of
+ # what directory scons was run from. Alias nodes
+ # are outside the filesystem:
+ return 1
default_ans = AliasNameSpace()
import sys
import TestSCons
+import os
python = sys.executable
""")
test.write('SConstruct', """
+import SCons.Defaults
B = Builder(name='B', action='%s build.py $TARGET $SOURCES')
-env = Environment(BUILDERS = [B])
+env = Environment(BUILDERS = [B, SCons.Defaults.Alias])
env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')
Export('env')
SConscript('sub1/SConscript')
test.write(['sub2', 'SConscript'], """
Import('env')
-env.B(target = 'bar.out', source = 'bar.in')
+env.Alias('bar', env.B(target = 'bar.out', source = 'bar.in'))
Default('.')
+
""")
test.write(['sub2', 'bar.in'], "sub2/bar.in")
test.fail_test(test.read(['sub1', 'foo.out']) != "sub1/foo.in")
test.fail_test(test.read(['sub2', 'bar.out']) != "sub2/bar.in")
+test.unlink(['sub1', 'foo.out'])
+test.unlink(['sub2', 'bar.out'])
+
+test.run(arguments = '-D bar', chdir = 'sub1')
+
+test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
+test.fail_test(not os.path.exists(test.workpath('sub2', 'bar.out')))
+
+
+
test.pass_test()
""")
test.write('SConstruct', """
+import SCons.Defaults
B = Builder(name='B', action='%s build.py $TARGET $SOURCES')
-env = Environment(BUILDERS = [B])
+env = Environment(BUILDERS = [B, SCons.Defaults.Alias])
Default(env.B(target = 'sub1/foo.out', source = 'sub1/foo.in'))
Export('env')
SConscript('sub2/SConscript')
test.write(['sub2', 'SConscript'], """
Import('env')
-Default(env.B(target = 'bar.out', source = 'bar.in'))
+bar = env.B(target = 'bar.out', source = 'bar.in')
+Default(bar)
+env.Alias('bar', bar)
Default(env.B(target = '../bar.out', source = 'bar.in'))
""")
test.fail_test(os.path.exists(test.workpath('bar.out')))
test.fail_test(not os.path.exists(test.workpath('sub2/xxx.out')))
+test.unlink(['sub1', 'foo.out'])
+test.unlink(['sub3', 'baz.out'])
+test.unlink(['sub2', 'xxx.out'])
+
+test.run(chdir = 'sub3', arguments='-U bar')
+test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
+test.fail_test(not os.path.exists(test.workpath('sub2', 'bar.out')))
+test.fail_test(not os.path.exists(test.workpath('sub2b', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub3', 'baz.out')))
+test.fail_test(os.path.exists(test.workpath('bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
+
test.pass_test()
""")
test.write('SConstruct', """
+import SCons.Defaults
B = Builder(name='B', action='%s build.py $TARGET $SOURCES')
-env = Environment(BUILDERS = [B])
+env = Environment(BUILDERS = [B, SCons.Defaults.Alias])
env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')
Default('.')
Export('env')
SConscript('sub2/SConscript')
-env.B(target = 'sub3/baz.out', source = 'sub3/baz.in')
+env.Alias('baz', env.B(target = 'sub3/baz.out', source = 'sub3/baz.in'))
""" % python)
test.write(['sub2', 'SConscript'], """
test.fail_test(test.read(['sub2', 'bar.out']) != "sub2/bar.in")
test.fail_test(os.path.exists(test.workpath('sub3', 'baz.out')))
+test.run(chdir = 'sub2', arguments = '-u baz')
+test.fail_test(test.read(['sub3', 'baz.out']) != "sub3/baz.in")
+
test.pass_test()