diff options
author | William Blevins <wblevins001@gmail.com> | 2016-10-03 06:08:04 (GMT) |
---|---|---|
committer | William Blevins <wblevins001@gmail.com> | 2016-10-03 06:08:04 (GMT) |
commit | 5587089a661a520a32c353ea886939cd63a0636a (patch) | |
tree | 22bf17e710505ff6f6bcf5cc4aa7badfc958d5f2 /test/RANLIB | |
parent | 6dd3fd8b838d18d65edd6e7adabf3a363437f8a9 (diff) | |
download | SCons-5587089a661a520a32c353ea886939cd63a0636a.zip SCons-5587089a661a520a32c353ea886939cd63a0636a.tar.gz SCons-5587089a661a520a32c353ea886939cd63a0636a.tar.bz2 |
Moved common my<xxx>.py functions to global fixture and resolve byte/str.
Diffstat (limited to 'test/RANLIB')
-rw-r--r-- | test/RANLIB/RANLIBCOM.py | 28 | ||||
-rw-r--r-- | test/RANLIB/RANLIBCOMSTR.py | 28 |
2 files changed, 9 insertions, 47 deletions
diff --git a/test/RANLIB/RANLIBCOM.py b/test/RANLIB/RANLIBCOM.py index 486a91f..6a3ea0f 100644 --- a/test/RANLIB/RANLIBCOM.py +++ b/test/RANLIB/RANLIBCOM.py @@ -39,31 +39,13 @@ ranlib = test.detect('RANLIB', 'ranlib') if not ranlib: test.skip_test("Could not find 'ranlib', skipping test.\n") - - -test.write('myar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -import sys -lines = open(sys.argv[1], 'rb').readlines() -outfile = open(sys.argv[1], 'wb') -for l in [l for l in lines if l != '/*ranlib*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) @@ -76,8 +58,6 @@ test.run(arguments = '.') test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/RANLIB/RANLIBCOMSTR.py b/test/RANLIB/RANLIBCOMSTR.py index 6e76cbf..2b8fc83 100644 --- a/test/RANLIB/RANLIBCOMSTR.py +++ b/test/RANLIB/RANLIBCOMSTR.py @@ -42,29 +42,13 @@ if not ranlib: -test.write('myar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -import sys -lines = open(sys.argv[1], 'rb').readlines() -outfile = open(sys.argv[1], 'wb') -for l in [l for l in lines if l != '/*ranlib*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', RANLIBCOMSTR = 'Indexing $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') @@ -75,7 +59,7 @@ test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") expect = test.wrap_stdout("""\ -%(_python_)s myar.py output.lib file.1 file.2 +%(_python_)s mycompile.py ar output.lib file.1 file.2 Indexing output.lib """ % locals()) @@ -83,8 +67,6 @@ test.run(stdout = expect) test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: |