#
import getopt
+import glob
import os
import os.path
import re
# not an executable, so it's all right.
lib_dir = os.path.join(sys.exec_prefix, "lib", "python" + sys.version[0:3])
-opts, tests = getopt.getopt(sys.argv[1:], "adqp:Xx:",
+opts, args = getopt.getopt(sys.argv[1:], "adqp:Xx:",
['all', 'debug', 'exec=', 'quiet', 'package='])
for o, a in opts:
cwd = os.getcwd()
-if tests:
- map(os.path.abspath, tests)
+if args:
+ for a in args:
+ tests.extend(glob.glob(os.path.abspath(a)))
elif all:
def find_Test_py(arg, dirname, names):
global tests
"""Test Detect()ing tools"""
test = TestCmd.TestCmd(workdir = '')
test.subdir('sub1', 'sub2')
- test.write(['sub1', 'xxx.exe'], "sub1/xxx.exe\n")
- test.write(['sub2', 'xxx.exe'], "sub2/xxx.exe\n")
-
sub1 = test.workpath('sub1')
sub2 = test.workpath('sub2')
- env = Environment(ENV = { 'PATH' : [sub1, sub2] })
- x = env.Detect('xxx.exe')
- assert x is None, x
- sub2_xxx_exe = test.workpath('sub2', 'xxx.exe')
- os.chmod(sub2_xxx_exe, 0755)
+ if sys.platform == 'win32':
+ test.write(['sub1', 'xxx'], "sub1/xxx\n")
+ test.write(['sub2', 'xxx'], "sub2/xxx\n")
- env = Environment(ENV = { 'PATH' : [sub1, sub2] })
- x = env.Detect('xxx.exe')
- assert x == 'xxx.exe'
+ env = Environment(ENV = { 'PATH' : [sub1, sub2] })
- sub1_xxx_exe = test.workpath('sub1', 'xxx.exe')
- os.chmod(sub1_xxx_exe, 0755)
+ x = env.Detect('xxx.exe')
+ assert x is None, x
- x = env.Detect('xxx.exe')
- assert x == 'xxx.exe'
+ test.write(['sub2', 'xxx.exe'], "sub2/xxx.exe\n")
+
+ env = Environment(ENV = { 'PATH' : [sub1, sub2] })
+
+ x = env.Detect('xxx.exe')
+ assert x == 'xxx.exe', x
+
+ test.write(['sub1', 'xxx.exe'], "sub1/xxx.exe\n")
+
+ x = env.Detect('xxx.exe')
+ assert x == 'xxx.exe', x
+
+ else:
+ test.write(['sub1', 'xxx.exe'], "sub1/xxx.exe\n")
+ test.write(['sub2', 'xxx.exe'], "sub2/xxx.exe\n")
+
+ env = Environment(ENV = { 'PATH' : [sub1, sub2] })
+
+ x = env.Detect('xxx.exe')
+ assert x is None, x
+
+ sub2_xxx_exe = test.workpath('sub2', 'xxx.exe')
+ os.chmod(sub2_xxx_exe, 0755)
+
+ env = Environment(ENV = { 'PATH' : [sub1, sub2] })
+
+ x = env.Detect('xxx.exe')
+ assert x == 'xxx.exe', x
+
+ sub1_xxx_exe = test.workpath('sub1', 'xxx.exe')
+ os.chmod(sub1_xxx_exe, 0755)
+
+ x = env.Detect('xxx.exe')
+ assert x == 'xxx.exe', x
env = Environment(ENV = { 'PATH' : [] })
x = env.Detect('xxx.exe')
sys.stderr.write(string + " Stop.\n")
sys.exit(2)
sys.stderr.write(string + "\n")
+ global exit_status
+ exit_status = 2
node = None
if top and not node.is_under(top):
if isinstance(node, SCons.Node.FS.Dir) and top.is_under(node):
"prefer Microsoft tools on Windows"
linkers = ['mslink', 'gnulink', 'ilink']
c_compilers = ['msvc', 'gcc', 'icc']
- assemblers = ['nasm', 'masm', 'gas']
+ assemblers = ['masm', 'nasm', 'gas']
fortran_compilers = ['g77', 'ifl']
ars = ['lib', 'ar']
elif str(platform) == 'os2':
x = os.stat(x)
y = os.stat(y)
return (stat.S_IMODE(x[stat.ST_MODE]) == stat.S_IMODE(y[stat.ST_MODE]) and
- x[stat.ST_ATIME] == y[stat.ST_ATIME] and
x[stat.ST_MTIME] == y[stat.ST_MTIME])
# Make sure we did duplicate the source files in build/var2, and that their stats are the same:
""")
test.write('SConstruct', """
-env = Environment(TAR = r'%s mytar.py')
+env = Environment(tools = ['tar'], TAR = r'%s mytar.py')
env.Tar(target = 'aaa.tar', source = ['file1', 'file2'])
env.Tar(target = 'aaa.tar', source = 'file3')
env.Tar(target = 'bbb', source = 'sub1')
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment()
+foo = Environment(tools = ['tar'])
tar = foo.Dictionary('TAR')
-bar = Environment(TAR = r'%s wrapper.py ' + tar)
+bar = Environment(tools = ['tar'], TAR = r'%s wrapper.py ' + tar)
foo.Tar(target = 'foo.tar', source = ['file10', 'file11'])
foo.Tar(target = 'foo.tar', source = 'file12')
bar.Tar(target = 'bar.tar', source = ['file13', 'file14'])
""")
test.write('SConstruct', """
-env = Environment(TAR = r'%s mytar.py', TARFLAGS = '-x')
+env = Environment(tools = ['tar'], TAR = r'%s mytar.py', TARFLAGS = '-x')
env.Tar(target = 'aaa.tar', source = ['file1', 'file2'])
env.Tar(target = 'aaa.tar', source = 'file3')
env.Tar(target = 'bbb', source = 'sub1')
""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
test.write('SConstruct', """
-foo = Environment()
+foo = Environment(tools = ['tar'])
tar = foo['TAR']
-bar = Environment(TAR = '', TARFLAGS = '%s wrapper.py ' + tar + ' -c -b 1')
+bar = Environment(tools = ['tar'],
+ TAR = '',
+ TARFLAGS = '%s wrapper.py ' + tar + ' -c -b 1')
foo.Tar(target = 'foo.tar', source = ['file10', 'file11'])
foo.Tar(target = 'foo.tar', source = 'file12')
bar.Tar(target = 'bar.tar', source = ['file13', 'file14'])