From e277a83e90407e179852bc84f9ca3a5dcfd00bab Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 27 Jan 2009 13:42:49 +0000 Subject: Handle executing tests in a directory whose path contains spaces, or with a Python in a path that contains spaces, by refactoring (again) how we execute the internal scripts. --- test/explain/basic.py | 104 +++++++++++++++++--------------- test/sconsign/script/SConsignFile.py | 98 +++++++++++++++--------------- test/sconsign/script/Signatures.py | 8 ++- test/sconsign/script/no-SConsignFile.py | 9 +-- 4 files changed, 113 insertions(+), 106 deletions(-) diff --git a/test/explain/basic.py b/test/explain/basic.py index 6e37dfa..1888b5d 100644 --- a/test/explain/basic.py +++ b/test/explain/basic.py @@ -31,10 +31,8 @@ Verify a lot of the basic operation of the --debug=explain option. import os import string import sys -import TestSCons -python = TestSCons.python -_python_ = TestSCons._python_ +import TestSCons test = TestSCons.TestSCons() @@ -53,7 +51,7 @@ inc_bbb_k = test.workpath('inc', 'bbb.k') -test.write(cat_py, r""" +test.write(cat_py, r"""#!/usr/bin/env python import sys def process(outfp, infp): @@ -78,6 +76,9 @@ for f in sys.argv[2:]: sys.exit(0) """) +test.chmod(cat_py, 0755) + + SConstruct_contents = """\ import re @@ -93,12 +94,13 @@ kscan = Scanner(name = 'kfile', argument = None, skeys = ['.k']) -cat = Builder(action = r'%(_python_)s %(cat_py)s $TARGET $SOURCES') -one_cat = Builder( action = r'%(_python_)s %(cat_py)s $TARGET ${SOURCES[0]}') +cat = Builder(action = [[r'%(cat_py)s', '$TARGET', '$SOURCES']]) +one_cat = Builder( action = [[r'%(cat_py)s', '$TARGET', '${SOURCES[0]}']]) env = Environment() env.Append(BUILDERS = {'Cat':cat, 'OneCat':one_cat}, SCANNERS = kscan) +env.PrependENVPath('PATHEXT', '.PY') Export("env") SConscript('SConscript') @@ -117,7 +119,7 @@ env.Cat('file1', 'file1.in') env.Cat('file2', 'file2.k') env.Cat('file3', ['xxx', 'yyy', 'zzz']) env.Command('file4', 'file4.in', - r'%(_python_)s %(cat_py)s $TARGET $FILE4FLAG $SOURCES', + r'%(cat_py)s $TARGET $FILE4FLAG $SOURCES', FILE4FLAG='-') env.Cat('file5', 'file5.k') file6 = env.Cat('file6', 'file6.in') @@ -175,13 +177,13 @@ args = '--debug=explain .' expect = test.wrap_stdout("""\ scons: building `file1' because it doesn't exist -%(_python_)s %(cat_py)s file1 file1.in +%(cat_py)s file1 file1.in scons: building `file2' because it doesn't exist -%(_python_)s %(cat_py)s file2 file2.k +%(cat_py)s file2 file2.k scons: building `file3' because it doesn't exist -%(_python_)s %(cat_py)s file3 xxx yyy zzz +%(cat_py)s file3 xxx yyy zzz scons: building `file4' because it doesn't exist -%(_python_)s %(cat_py)s file4 - file4.in +%(cat_py)s file4 - file4.in scons: building `%(inc_aaa)s' because it doesn't exist Install file: "aaa" as "%(inc_aaa)s" scons: building `%(inc_ddd)s' because it doesn't exist @@ -191,15 +193,15 @@ Install file: "eee.in" as "%(inc_eee)s" scons: building `%(inc_bbb_k)s' because it doesn't exist Install file: "bbb.k" as "%(inc_bbb_k)s" scons: building `file5' because it doesn't exist -%(_python_)s %(cat_py)s file5 file5.k +%(cat_py)s file5 file5.k scons: building `file6' because it doesn't exist -%(_python_)s %(cat_py)s file6 file6.in +%(cat_py)s file6 file6.in scons: building `%(subdir_file7)s' because it doesn't exist -%(_python_)s %(cat_py)s %(subdir_file7)s %(subdir_file7_in)s +%(cat_py)s %(subdir_file7)s %(subdir_file7_in)s scons: building `%(subdir_file8)s' because it doesn't exist -%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s +%(cat_py)s %(subdir_file8)s %(subdir_file7_in)s scons: building `%(subdir_file9)s' because it doesn't exist -%(_python_)s %(cat_py)s %(subdir_file9)s %(subdir_file7_in)s +%(cat_py)s %(subdir_file9)s %(subdir_file7_in)s """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -236,26 +238,26 @@ WriteInitialTest( locals() ) expect = test.wrap_stdout("""\ scons: rebuilding `file1' because `file1.in' changed -%(_python_)s %(cat_py)s file1 file1.in +%(cat_py)s file1 file1.in scons: rebuilding `file2' because `yyy' changed -%(_python_)s %(cat_py)s file2 file2.k +%(cat_py)s file2 file2.k scons: rebuilding `file3' because: `yyy' changed `zzz' changed -%(_python_)s %(cat_py)s file3 xxx yyy zzz +%(cat_py)s file3 xxx yyy zzz scons: rebuilding `%(inc_bbb_k)s' because: `%(inc_ddd)s' is no longer a dependency `%(inc_eee)s' is no longer a dependency `bbb.k' changed Install file: "bbb.k" as "%(inc_bbb_k)s" scons: rebuilding `file5' because `%(inc_bbb_k)s' changed -%(_python_)s %(cat_py)s file5 file5.k +%(cat_py)s file5 file5.k scons: rebuilding `file6' because AlwaysBuild() is specified -%(_python_)s %(cat_py)s file6 file6.in +%(cat_py)s file6 file6.in scons: rebuilding `%(subdir_file8)s' because: `first' is no longer a dependency `second' is a new dependency -%(_python_)s %(cat_py)s %(subdir_file8)s %(subdir_file7_in)s +%(cat_py)s %(subdir_file8)s %(subdir_file7_in)s """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -285,7 +287,7 @@ env.Cat('file3', ['xxx', 'yyy']) expect = test.wrap_stdout("""\ scons: rebuilding `file3' because `zzz' is no longer a dependency -%(_python_)s %(cat_py)s file3 xxx yyy +%(cat_py)s file3 xxx yyy """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -301,7 +303,7 @@ env.Cat('file3', ['xxx', 'yyy', 'zzz']) expect = test.wrap_stdout("""\ scons: rebuilding `file3' because `zzz' is a new dependency -%(_python_)s %(cat_py)s file3 xxx yyy zzz +%(cat_py)s file3 xxx yyy zzz """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -315,11 +317,13 @@ Import("env") env.Cat('file3', ['zzz', 'yyy', 'xxx']) """) +cat_py_sep = string.replace(cat_py, '\\', '\\\\') + expect = test.wrap_stdout("""\ scons: rebuilding `file3' because the dependency order changed: - old: ['xxx', 'yyy', 'zzz', '%(python)s'] - new: ['zzz', 'yyy', 'xxx', '%(python)s'] -%(_python_)s %(cat_py)s file3 zzz yyy xxx + old: ['xxx', 'yyy', 'zzz', '%(cat_py_sep)s'] + new: ['zzz', 'yyy', 'xxx', '%(cat_py_sep)s'] +%(cat_py)s file3 zzz yyy xxx """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -332,19 +336,19 @@ test.write(['src', 'SConscript'], """\ Import("env") f3 = File('file3') env.Cat(f3, ['zzz', 'yyy', 'xxx']) -env.AddPostAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy') -env.AddPreAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES') +env.AddPostAction(f3, r'%(cat_py)s ${TARGET}.yyy $SOURCES yyy') +env.AddPreAction(f3, r'%(cat_py)s ${TARGET}.alt $SOURCES') """ % locals()) expect = test.wrap_stdout("""\ scons: rebuilding `file3' because the build action changed: - old: %(_python_)s %(cat_py)s $TARGET $SOURCES - new: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES - %(_python_)s %(cat_py)s $TARGET $SOURCES - %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy -%(_python_)s %(cat_py)s file3.alt zzz yyy xxx -%(_python_)s %(cat_py)s file3 zzz yyy xxx -%(_python_)s %(cat_py)s file3.yyy zzz yyy xxx yyy + old: %(cat_py)s $TARGET $SOURCES + new: %(cat_py)s ${TARGET}.alt $SOURCES + %(cat_py)s $TARGET $SOURCES + %(cat_py)s ${TARGET}.yyy $SOURCES yyy +%(cat_py)s file3.alt zzz yyy xxx +%(cat_py)s file3 zzz yyy xxx +%(cat_py)s file3.yyy zzz yyy xxx yyy """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -359,21 +363,21 @@ test.write(['src', 'SConscript'], """\ Import("env") f3 = File('file3') env.Cat(f3, ['zzz', 'yyy', 'xxx']) -env.AddPostAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES xxx') -env.AddPreAction(f3, r'%(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES') +env.AddPostAction(f3, r'%(cat_py)s ${TARGET}.yyy $SOURCES xxx') +env.AddPreAction(f3, r'%(cat_py)s ${TARGET}.alt $SOURCES') """ % locals()) expect = test.wrap_stdout("""\ scons: rebuilding `file3' because the build action changed: - old: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES - %(_python_)s %(cat_py)s $TARGET $SOURCES - %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES yyy - new: %(_python_)s %(cat_py)s ${TARGET}.alt $SOURCES - %(_python_)s %(cat_py)s $TARGET $SOURCES - %(_python_)s %(cat_py)s ${TARGET}.yyy $SOURCES xxx -%(_python_)s %(cat_py)s file3.alt zzz yyy xxx -%(_python_)s %(cat_py)s file3 zzz yyy xxx -%(_python_)s %(cat_py)s file3.yyy zzz yyy xxx xxx + old: %(cat_py)s ${TARGET}.alt $SOURCES + %(cat_py)s $TARGET $SOURCES + %(cat_py)s ${TARGET}.yyy $SOURCES yyy + new: %(cat_py)s ${TARGET}.alt $SOURCES + %(cat_py)s $TARGET $SOURCES + %(cat_py)s ${TARGET}.yyy $SOURCES xxx +%(cat_py)s file3.alt zzz yyy xxx +%(cat_py)s file3 zzz yyy xxx +%(cat_py)s file3.yyy zzz yyy xxx xxx """ % locals()) test.run(chdir='src', arguments=args, stdout=expect) @@ -387,14 +391,14 @@ test.must_match(['src', 'file3.yyy'], "zzz 2\nyyy 2\nxxx 1\nxxx 1\n") test.write(['src', 'SConscript'], """\ Import("env") env.Command('file4', 'file4.in', - r'%(_python_)s %(cat_py)s $TARGET $FILE4FLAG $SOURCES', + r'%(cat_py)s $TARGET $FILE4FLAG $SOURCES', FILE4FLAG='') """ % locals()) expect = test.wrap_stdout("""\ scons: rebuilding `file4' because the contents of the build action changed - action: %(_python_)s %(cat_py)s $TARGET $FILE4FLAG $SOURCES -%(_python_)s %(cat_py)s file4 file4.in + action: %(cat_py)s $TARGET $FILE4FLAG $SOURCES +%(cat_py)s file4 file4.in """ % locals()) test.run(chdir='src',arguments=args, stdout=expect) diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py index 71c91cb..89d562a 100644 --- a/test/sconsign/script/SConsignFile.py +++ b/test/sconsign/script/SConsignFile.py @@ -35,19 +35,14 @@ import re import TestSCons import TestSConsign -python = TestSCons.python -python_dir, python_file = os.path.split(python) -_python_ = TestSCons._python_ - -python_re = re.escape(python) -python_dir_re = re.escape(python_dir) -python_file_re = re.escape(python_file) - test = TestSConsign.TestSConsign(match = TestSConsign.match_re) test.subdir('sub1', 'sub2') -test.write('fake_cc.py', r""" +fake_cc_py = test.workpath('fake_cc.py') +fake_link_py = test.workpath('fake_link.py') + +test.write(fake_cc_py, r"""#!/usr/bin/env python import os import re import string @@ -80,7 +75,7 @@ process(input, output) sys.exit(0) """) -test.write('fake_link.py', r""" +test.write(fake_link_py, r"""#!/usr/bin/env python import sys output = open(sys.argv[1], 'wb') @@ -93,6 +88,9 @@ output.write(input.read()) sys.exit(0) """) +test.chmod(fake_cc_py, 0755) +test.chmod(fake_link_py, 0755) + # Note: We don't use os.path.join() representations of the file names # in the expected output because paths in the .sconsign files are # canonicalized to use / as the separator. @@ -108,8 +106,8 @@ test.write(['SConstruct'], """\ SConsignFile() env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', - CCCOM = r'%(_python_)s fake_cc.py sub2 $TARGET $SOURCE', - LINKCOM = r'%(_python_)s fake_link.py $TARGET $SOURCE') + CCCOM = [[r'%(fake_cc_py)s', 'sub2', '$TARGET', '$SOURCE']], + LINKCOM = [[r'%(fake_link_py)s', '$TARGET', '$SOURCE']]) env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH = ['sub2']) @@ -147,29 +145,29 @@ sig_re = r'[0-9a-fA-F]{32}' test.run_sconsign(arguments = ".sconsign", stdout = r"""=== .: SConstruct: None \d+ \d+ -=== %(python_dir_re)s: -%(python_file_re)s: %(sig_re)s \d+ \d+ +fake_cc\.py: %(sig_re)s \d+ \d+ +fake_link\.py: %(sig_re)s \d+ \d+ === sub1: hello.c: %(sig_re)s \d+ \d+ hello.exe: %(sig_re)s \d+ \d+ %(sub1_hello_obj)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_link\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] hello.obj: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] === sub2: hello.c: %(sig_re)s \d+ \d+ hello.exe: %(sig_re)s \d+ \d+ %(sub2_hello_obj)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_link\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] hello.obj: %(sig_re)s \d+ \d+ %(sub2_hello_c)s: %(sig_re)s \d+ \d+ %(sub2_inc1_h)s: %(sig_re)s \d+ \d+ %(sub2_inc2_h)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] inc1.h: %(sig_re)s \d+ \d+ inc2.h: %(sig_re)s \d+ \d+ @@ -178,29 +176,29 @@ inc2.h: %(sig_re)s \d+ \d+ test.run_sconsign(arguments = "--raw .sconsign", stdout = r"""=== .: SConstruct: {'csig': None, 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} -=== %(python_dir_re)s: -%(python_file_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} +fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} +fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} === sub1: hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sub1_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} - %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} + fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sig_re)s \[.*\] hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sub1_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} - %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} + fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sig_re)s \[.*\] === sub2: hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} hello.exe: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sub2_hello_obj)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} - %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} + fake_link\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sig_re)s \[.*\] hello.obj: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sub2_hello_c)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sub2_inc1_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sub2_inc2_h)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} - %(python_re)s: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} + fake_cc\.py: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} %(sig_re)s \[.*\] inc1.h: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} inc2.h: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} @@ -211,8 +209,11 @@ SConstruct: csig: None timestamp: \d+ size: \d+ -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + csig: %(sig_re)s + timestamp: \d+ + size: \d+ +fake_link\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -230,7 +231,7 @@ hello.exe: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_link\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -244,7 +245,7 @@ hello.obj: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_cc\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -263,7 +264,7 @@ hello.exe: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_link\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -285,7 +286,7 @@ hello.obj: csig: %(sig_re)s timestamp: \d+ size: \d+ - %(python_re)s: + fake_cc\.py: csig: %(sig_re)s timestamp: \d+ size: \d+ @@ -306,8 +307,9 @@ test.run_sconsign(arguments = "-c -v .sconsign", stdout = r"""=== .: SConstruct: csig: None -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + csig: %(sig_re)s +fake_link\.py: csig: %(sig_re)s === sub1: hello.c: @@ -333,8 +335,9 @@ test.run_sconsign(arguments = "-s -v .sconsign", stdout = r"""=== .: SConstruct: size: \d+ -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + size: \d+ +fake_link\.py: size: \d+ === sub1: hello.c: @@ -360,8 +363,9 @@ test.run_sconsign(arguments = "-t -v .sconsign", stdout = r"""=== .: SConstruct: timestamp: \d+ -=== %(python_dir_re)s: -%(python_file_re)s: +fake_cc\.py: + timestamp: \d+ +fake_link\.py: timestamp: \d+ === sub1: hello.c: @@ -385,64 +389,58 @@ inc2.h: test.run_sconsign(arguments = "-e hello.obj .sconsign", stdout = r"""=== .: -=== %(python_dir_re)s: === sub1: hello.obj: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] === sub2: hello.obj: %(sig_re)s \d+ \d+ %(sub2_hello_c)s: %(sig_re)s \d+ \d+ %(sub2_inc1_h)s: %(sig_re)s \d+ \d+ %(sub2_inc2_h)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals(), stderr = r"""sconsign: no entry `hello\.obj' in `\.' -sconsign: no entry `hello\.obj' in `%(python_dir_re)s' """ % locals()) test.run_sconsign(arguments = "-e hello.obj -e hello.exe -e hello.obj .sconsign", stdout = r"""=== .: -=== %(python_dir_re)s: === sub1: hello.obj: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] hello.exe: %(sig_re)s \d+ \d+ %(sub1_hello_obj)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_link\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] hello.obj: %(sig_re)s \d+ \d+ %(sub1_hello_c)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] === sub2: hello.obj: %(sig_re)s \d+ \d+ %(sub2_hello_c)s: %(sig_re)s \d+ \d+ %(sub2_inc1_h)s: %(sig_re)s \d+ \d+ %(sub2_inc2_h)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] hello.exe: %(sig_re)s \d+ \d+ %(sub2_hello_obj)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_link\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] hello.obj: %(sig_re)s \d+ \d+ %(sub2_hello_c)s: %(sig_re)s \d+ \d+ %(sub2_inc1_h)s: %(sig_re)s \d+ \d+ %(sub2_inc2_h)s: %(sig_re)s \d+ \d+ - %(python_re)s: %(sig_re)s \d+ \d+ + fake_cc\.py: %(sig_re)s \d+ \d+ %(sig_re)s \[.*\] """ % locals(), stderr = r"""sconsign: no entry `hello\.obj' in `\.' sconsign: no entry `hello\.exe' in `\.' sconsign: no entry `hello\.obj' in `\.' -sconsign: no entry `hello\.obj' in `%(python_dir_re)s' -sconsign: no entry `hello\.exe' in `%(python_dir_re)s' -sconsign: no entry `hello\.obj' in `%(python_dir_re)s' """ % locals()) #test.run_sconsign(arguments = "-i -v .sconsign", diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py index 9fdf54e..0b58055 100644 --- a/test/sconsign/script/Signatures.py +++ b/test/sconsign/script/Signatures.py @@ -114,8 +114,12 @@ SConsignFile(None) Decider('timestamp-newer') env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', - CCCOM = r'%(fake_cc_py)s sub2 $TARGET $SOURCE', - LINKCOM = r'%(fake_link_py)s $TARGET $SOURCE') + # Specify the command lines with lists-of-lists so + # finding the implicit dependencies works even with + # spaces in the fake_*_py path names. + CCCOM = [[r'%(fake_cc_py)s', 'sub2', '$TARGET', '$SOURCE']], + LINKCOM = [[r'%(fake_link_py)s', '$TARGET', '$SOURCE']]) +env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH = ['sub2']) env2.Program('sub2/hello.c') diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py index dacc011..9b819b9 100644 --- a/test/sconsign/script/no-SConsignFile.py +++ b/test/sconsign/script/no-SConsignFile.py @@ -113,8 +113,11 @@ test.write(['SConstruct'], """ SConsignFile(None) env1 = Environment(PROGSUFFIX = '.exe', OBJSUFFIX = '.obj', - CCCOM = r'%(fake_cc_py)s sub2 $TARGET $SOURCE', - LINKCOM = r'%(fake_link_py)s $TARGET $SOURCE') + # Specify the command lines with lists-of-lists so + # finding the implicit dependencies works even with + # spaces in the fake_*_py path names. + CCCOM = [[r'%(fake_cc_py)s', 'sub2', '$TARGET', '$SOURCE']], + LINKCOM = [[r'%(fake_link_py)s', '$TARGET', '$SOURCE']]) env1.PrependENVPath('PATHEXT', '.PY') env1.Program('sub1/hello.c') env2 = env1.Clone(CPPPATH = ['sub2']) @@ -155,8 +158,6 @@ hello.obj: %(sig_re)s \d+ \d+ """ % locals() test.run_sconsign(arguments = "sub1/.sconsign", stdout=expect) -#test.run_sconsign(arguments = "sub1/.sconsign") -#print test.stdout() test.run_sconsign(arguments = "--raw sub1/.sconsign", stdout = r"""hello.c: {'csig': '%(sig_re)s', 'timestamp': \d+, 'size': \d+L?, '_version_id': 1} -- cgit v0.12