summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2018-11-02 02:50:18 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2018-11-02 02:50:18 (GMT)
commit1d667e1bb42f0e3656860eaa4b35a35f357a329a (patch)
tree99e3324816625c8d198a4e1d577596fe85e95c06 /test
parent50bdeb4f4c3bf148c242b93f1a517a11758a2d9c (diff)
parent03be89c25fd6e6b4e8f9cddd41e8b5fbc3ed7c1f (diff)
downloadSCons-1d667e1bb42f0e3656860eaa4b35a35f357a329a.zip
SCons-1d667e1bb42f0e3656860eaa4b35a35f357a329a.tar.gz
SCons-1d667e1bb42f0e3656860eaa4b35a35f357a329a.tar.bz2
Merge remote-tracking branch 'upstream/master' into fix_win_m4
Diffstat (limited to 'test')
-rw-r--r--test/Builder/multi/different-environments.py4
-rw-r--r--test/Builder/multi/same-overrides.py4
-rw-r--r--test/ENV.py3
-rw-r--r--test/Java/JAR.py4
-rw-r--r--test/Java/JARCHDIR.py3
-rw-r--r--test/Java/JARFLAGS.py4
-rw-r--r--test/Java/source-files.py4
-rw-r--r--test/SWIG/build-dir.py40
-rw-r--r--test/Scanner/generated.py6
-rw-r--r--test/TEMPFILEPREFIX.py1
-rwxr-xr-xtest/TEX/biber_biblatex.py2
-rw-r--r--test/TEX/biber_biblatex2.py2
-rwxr-xr-xtest/TEX/biblatex.py2
-rw-r--r--test/TEX/biblatex_plain.py2
-rw-r--r--test/explain/basic.py3
-rw-r--r--test/long-lines/signature.py23
-rw-r--r--test/scons-time/run/config/python.py8
-rw-r--r--test/scons-time/run/option/python.py8
-rw-r--r--test/sconsign/script/SConsignFile.py25
-rw-r--r--test/sconsign/script/Signatures.py24
-rw-r--r--test/sconsign/script/no-SConsignFile.py24
-rw-r--r--test/srcchange.py1
-rw-r--r--test/subdivide.py3
23 files changed, 107 insertions, 93 deletions
diff --git a/test/Builder/multi/different-environments.py b/test/Builder/multi/different-environments.py
index 686e15c..9ce09b9 100644
--- a/test/Builder/multi/different-environments.py
+++ b/test/Builder/multi/different-environments.py
@@ -36,11 +36,11 @@ test = TestSCons.TestSCons(match=TestSCons.match_re)
_python_ = TestSCons._python_
-test.write('build.py', r"""#!/usr/bin/env python
+test.write('build.py', r"""\
import sys
def build(num, target, source):
file = open(str(target), 'wb')
- file.write('%s\n'%num)
+ file.write('%s\n' % num)
for s in source:
file.write(open(str(s), 'rb').read())
build(sys.argv[1],sys.argv[2],sys.argv[3:])
diff --git a/test/Builder/multi/same-overrides.py b/test/Builder/multi/same-overrides.py
index e51b2ef..c4c1893 100644
--- a/test/Builder/multi/same-overrides.py
+++ b/test/Builder/multi/same-overrides.py
@@ -34,11 +34,11 @@ test = TestSCons.TestSCons(match=TestSCons.match_re)
_python_ = TestSCons._python_
-test.write('build.py', r"""#!/usr/bin/env python
+test.write('build.py', r"""\
import sys
def build(num, target, source):
file = open(str(target), 'wb')
- file.write(bytearray('%s\n'%num,'utf-8'))
+ file.write(bytearray('%s\n'% num,'utf-8'))
for s in source:
file.write(open(str(s), 'rb').read())
build(sys.argv[1],sys.argv[2],sys.argv[3:])
diff --git a/test/ENV.py b/test/ENV.py
index 59b1cdb..36ad844 100644
--- a/test/ENV.py
+++ b/test/ENV.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-
import TestSCons
_python_ = TestSCons._python_
@@ -47,7 +46,7 @@ env2.Bld(target = 'env2.out', source = 'input')
""" % locals())
test.write('build.py',
-r"""#!/usr/bin/env python
+r"""\
import os
import sys
contents = open(sys.argv[2], 'r').read()
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index 1eae9eb..d5425af 100644
--- a/test/Java/JAR.py
+++ b/test/Java/JAR.py
@@ -32,6 +32,10 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
+# Keep this logic because it skips the test if javac or jar not found.
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
+
test.write('myjar.py', r"""
import sys
args = sys.argv[1:]
diff --git a/test/Java/JARCHDIR.py b/test/Java/JARCHDIR.py
index e602fad..59bf082 100644
--- a/test/Java/JARCHDIR.py
+++ b/test/Java/JARCHDIR.py
@@ -38,6 +38,9 @@ import os
import TestSCons
test = TestSCons.TestSCons()
+# Keep this logic because it skips the test if javac or jar not found.
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
test.write('SConstruct', """
DefaultEnvironment(tools=[])
diff --git a/test/Java/JARFLAGS.py b/test/Java/JARFLAGS.py
index e89d02b..39a0a6c 100644
--- a/test/Java/JARFLAGS.py
+++ b/test/Java/JARFLAGS.py
@@ -30,6 +30,10 @@ import TestSCons
test = TestSCons.TestSCons()
+# Keep this logic because it skips the test if javac or jar not found.
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
+
test.subdir('src')
test.write('SConstruct', """
diff --git a/test/Java/source-files.py b/test/Java/source-files.py
index ab395a0..e5cb8b6 100644
--- a/test/Java/source-files.py
+++ b/test/Java/source-files.py
@@ -35,6 +35,10 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
+# Keep this logic because it skips the test if javac or jar not found.
+where_javac, java_version = test.java_where_javac()
+where_jar = test.java_where_jar()
+
test.write('SConstruct', """
env = Environment(tools = ['javac', 'javah'])
env.Java(target = 'class1', source = 'com/Example1.java')
diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py
index d268c87..bc105a5 100644
--- a/test/SWIG/build-dir.py
+++ b/test/SWIG/build-dir.py
@@ -139,25 +139,27 @@ public:
};
""")
-test.write(['source', 'test.py'], """\
-#!/usr/bin/env python
-from __future__ import print_function
-
-import linalg
-
-
-x = linalg.Vector(5)
-print(x)
-
-x[1] = 99.5
-x[3] = 8.3
-x[4] = 11.1
-
-
-for i, v in enumerate(x):
- print("\tx[%d] = %g" % (i, v))
-
-""")
+## _python_ = TestSCons._python_
+## XXX: @ptomulik: looks like it was unused?
+## test.write(['source', 'test.py'], """\
+## #!%(_python_)s
+## from __future__ import print_function
+##
+## import linalg
+##
+##
+## x = linalg.Vector(5)
+## print(x)
+##
+## x[1] = 99.5
+## x[3] = 8.3
+## x[4] = 11.1
+##
+##
+## for i, v in enumerate(x):
+## print("\tx[%%d] = %%g" %% (i, v))
+##
+## """ % locals())
test.run(arguments = '.')
diff --git a/test/Scanner/generated.py b/test/Scanner/generated.py
index 4a368b4..3e08549 100644
--- a/test/Scanner/generated.py
+++ b/test/Scanner/generated.py
@@ -36,6 +36,8 @@ complexity is valuable in its own right.
import TestSCons
+_python_ = TestSCons._python_
+
test = TestSCons.TestSCons()
test.subdir('reftree',
@@ -282,7 +284,7 @@ recurse_env.Command([lib_fullname] + lib_objs,
""")
test.write(['src', 'lib_geng', 'MAKE-HEADER.py'], """\
-#!/usr/bin/env python
+#!%(_python_)s
import os
import os.path
@@ -293,7 +295,7 @@ os.chdir(os.path.split(sys.argv[0])[0])
for h in ['libg_gx.h', 'libg_gy.h', 'libg_gz.h']:
open(h, 'w').write('')
-""")
+""" % locals())
test.write(['src', 'lib_geng', 'SConstruct'], """\
import os
diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py
index f0743e6..c47ebc4 100644
--- a/test/TEMPFILEPREFIX.py
+++ b/test/TEMPFILEPREFIX.py
@@ -37,7 +37,6 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
test.write('echo.py', """\
-#!/usr/bin/env python
from __future__ import print_function
import sys
print(sys.argv)
diff --git a/test/TEX/biber_biblatex.py b/test/TEX/biber_biblatex.py
index a63fb3f..b4a4969 100755
--- a/test/TEX/biber_biblatex.py
+++ b/test/TEX/biber_biblatex.py
@@ -49,8 +49,6 @@ if not gloss==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
-
import os
env = Environment(ENV=os.environ)
env['BIBTEX'] = 'biber'
diff --git a/test/TEX/biber_biblatex2.py b/test/TEX/biber_biblatex2.py
index 95b5617..e9893ee 100644
--- a/test/TEX/biber_biblatex2.py
+++ b/test/TEX/biber_biblatex2.py
@@ -55,8 +55,6 @@ if not biblatex==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
-
import os
env = Environment(ENV=os.environ)
main_output = env.PDF('bibertest.tex')
diff --git a/test/TEX/biblatex.py b/test/TEX/biblatex.py
index a6fbd48..21e1a93 100755
--- a/test/TEX/biblatex.py
+++ b/test/TEX/biblatex.py
@@ -45,8 +45,6 @@ if not biblatex==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
-
import os
env = Environment(ENV=os.environ)
main_output = env.PDF(target='biblatextest.pdf', source='biblatextest.tex')
diff --git a/test/TEX/biblatex_plain.py b/test/TEX/biblatex_plain.py
index 68f7cc3..06b3cc6 100644
--- a/test/TEX/biblatex_plain.py
+++ b/test/TEX/biblatex_plain.py
@@ -45,8 +45,6 @@ if not biblatex==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
-
import os
env = Environment(ENV=os.environ)
main_output = env.PDF(target='biblatextest.pdf', source='biblatextest.tex')
diff --git a/test/explain/basic.py b/test/explain/basic.py
index 19fc328..99942cd 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -29,7 +29,6 @@ Verify a lot of the basic operation of the --debug=explain option.
"""
import os
-
import TestSCons
test = TestSCons.TestSCons()
@@ -52,7 +51,7 @@ inc_bbb_k = test.workpath('inc', 'bbb.k')
-test.write(cat_py, r"""#!/usr/bin/env python
+test.write(cat_py, r"""\
from __future__ import print_function
import sys
diff --git a/test/long-lines/signature.py b/test/long-lines/signature.py
index af234a3..64214b4 100644
--- a/test/long-lines/signature.py
+++ b/test/long-lines/signature.py
@@ -30,26 +30,27 @@ surrounded by $( $) from the signature calculation.
"""
import os
-
import TestSCons
+_python_ = TestSCons._python_
+
test = TestSCons.TestSCons()
build_py = test.workpath('build.py')
test.write(build_py, """\
-#!/usr/bin/env python
+#!%(_python_)s
import sys
if sys.argv[1][0] == '@':
- args = open(sys.argv[1][1:], 'rb').read()
+ args = open(sys.argv[1][1:], 'r').read()
args = args.split()
else:
args = sys.argv[1:]
-fp = open(args[0], 'wb')
-fp.write(open(args[1], 'rb').read())
-fp.write('FILEFLAG=%s\\n' % args[2])
-fp.write('TIMESTAMP=%s\\n' % args[3])
-""")
+fp = open(args[0], 'w')
+fp.write(open(args[1], 'r').read())
+fp.write('FILEFLAG=%%s\\n' %% args[2])
+fp.write('TIMESTAMP=%%s\\n' %% args[3])
+""" % locals())
os.chmod(build_py, 0o755)
@@ -74,17 +75,17 @@ env.Command('file.out', 'file.in',
'${TEMPFILE(FILECOM)}')
""" % locals())
-test.write('file.in', "file.in\n")
+test.write('file.in', "file.in\n", mode='w')
test.run(arguments='FILEFLAG=first TIMESTAMP=20090207 .')
-test.must_match('file.out', "file.in\nFILEFLAG=first\nTIMESTAMP=20090207\n")
+test.must_match('file.out', "file.in\nFILEFLAG=first\nTIMESTAMP=20090207\n", mode='r')
test.up_to_date(options='FILEFLAG=first TIMESTAMP=20090208', arguments = '.')
test.run(arguments='FILEFLAG=second TIMESTAMP=20090208 .')
-test.must_match('file.out', "file.in\nFILEFLAG=second\nTIMESTAMP=20090208\n")
+test.must_match('file.out', "file.in\nFILEFLAG=second\nTIMESTAMP=20090208\n", mode='r')
test.up_to_date(options='FILEFLAG=second TIMESTAMP=20090209', arguments = '.')
diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py
index 0734730..c8842c1 100644
--- a/test/scons-time/run/config/python.py
+++ b/test/scons-time/run/config/python.py
@@ -32,6 +32,8 @@ import os
import TestSCons_time
+_python_ = TestSCons_time._python_
+
test = TestSCons_time.TestSCons_time()
test.write_sample_project('foo.tar.gz')
@@ -43,7 +45,7 @@ python = r'%(my_python_py)s'
""" % locals())
test.write(my_python_py, """\
-#!/usr/bin/env python
+#!%(_python_)s
from __future__ import print_function
import sys
profile = ''
@@ -51,8 +53,8 @@ for arg in sys.argv[1:]:
if arg.startswith('--profile='):
profile = arg[10:]
break
-print('my_python.py: %s' % profile)
-""")
+print('my_python.py: %%s' %% profile)
+""" % locals())
os.chmod(my_python_py, 0o755)
diff --git a/test/scons-time/run/option/python.py b/test/scons-time/run/option/python.py
index d0592b6..27ca072 100644
--- a/test/scons-time/run/option/python.py
+++ b/test/scons-time/run/option/python.py
@@ -32,6 +32,8 @@ import os
import TestSCons_time
+_python_ = TestSCons_time._python_
+
test = TestSCons_time.TestSCons_time()
test.write_sample_project('foo.tar.gz')
@@ -39,15 +41,15 @@ test.write_sample_project('foo.tar.gz')
my_python_py = test.workpath('my_python.py')
test.write(my_python_py, """\
-#!/usr/bin/env python
+#!%(_python_)s
import sys
profile = ''
for arg in sys.argv[1:]:
if arg.startswith('--profile='):
profile = arg[10:]
break
-sys.stdout.write('my_python.py: %s\\n' % profile)
-""")
+sys.stdout.write('my_python.py: %%s\\n' %% profile)
+""" % locals())
os.chmod(my_python_py, 0o755)
diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py
index dc45cc1..5e56624 100644
--- a/test/sconsign/script/SConsignFile.py
+++ b/test/sconsign/script/SConsignFile.py
@@ -30,10 +30,11 @@ using the signatures in an SConsignFile().
"""
import re
-
import TestSCons
import TestSConsign
+_python_ = TestSCons._python_
+
test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
test.subdir('sub1', 'sub2')
@@ -41,22 +42,22 @@ test.subdir('sub1', 'sub2')
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
+test.write(fake_cc_py, r"""#!%(_python_)s
import os
import re
import sys
path = sys.argv[1].split()
-output = open(sys.argv[2], 'wb')
-input = open(sys.argv[3], 'rb')
+output = open(sys.argv[2], 'w')
+input = open(sys.argv[3], 'r')
-output.write('fake_cc.py: %s\n' % sys.argv)
+output.write('fake_cc.py: %%s\n' %% sys.argv)
def find_file(f):
for dir in path:
p = dir + os.sep + f
if os.path.exists(p):
- return open(p, 'rb')
+ return open(p, 'r')
return None
def process(infp, outfp):
@@ -71,20 +72,20 @@ def process(infp, outfp):
process(input, output)
sys.exit(0)
-""")
+""" % locals())
-test.write(fake_link_py, r"""#!/usr/bin/env python
+test.write(fake_link_py, r"""#!%(_python_)s
import sys
-output = open(sys.argv[1], 'wb')
-input = open(sys.argv[2], 'rb')
+output = open(sys.argv[1], 'w')
+input = open(sys.argv[2], 'r')
-output.write('fake_link.py: %s\n' % sys.argv)
+output.write('fake_link.py: %%s\n' %% sys.argv)
output.write(input.read())
sys.exit(0)
-""")
+""" % locals())
test.chmod(fake_cc_py, 0o755)
test.chmod(fake_link_py, 0o755)
diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py
index 5babe67..7797bce 100644
--- a/test/sconsign/script/Signatures.py
+++ b/test/sconsign/script/Signatures.py
@@ -36,6 +36,8 @@ SourceSignatures('timestamp') with TargetSignatures('content').
import TestSCons
import TestSConsign
+_python_ = TestSCons._python_
+
test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
# Note: We don't use os.path.join() representations of the file names
@@ -60,22 +62,22 @@ test.subdir('sub1', 'sub2')
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
+test.write(fake_cc_py, r"""#!%(_python_)s
import os
import re
import sys
path = sys.argv[1].split()
-output = open(sys.argv[2], 'wb')
-input = open(sys.argv[3], 'rb')
+output = open(sys.argv[2], 'w')
+input = open(sys.argv[3], 'r')
-output.write('fake_cc.py: %s\n' % sys.argv)
+output.write('fake_cc.py: %%s\n' %% sys.argv)
def find_file(f):
for dir in path:
p = dir + os.sep + f
if os.path.exists(p):
- return open(p, 'rb')
+ return open(p, 'r')
return None
def process(infp, outfp):
@@ -90,20 +92,20 @@ def process(infp, outfp):
process(input, output)
sys.exit(0)
-""")
+""" % locals())
-test.write(fake_link_py, r"""#!/usr/bin/env python
+test.write(fake_link_py, r"""#!%(_python_)s
import sys
-output = open(sys.argv[1], 'wb')
-input = open(sys.argv[2], 'rb')
+output = open(sys.argv[1], 'w')
+input = open(sys.argv[2], 'r')
-output.write('fake_link.py: %s\n' % sys.argv)
+output.write('fake_link.py: %%s\n' %% sys.argv)
output.write(input.read())
sys.exit(0)
-""")
+""" % locals())
test.chmod(fake_cc_py, 0o755)
test.chmod(fake_link_py, 0o755)
diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py
index 4e9915b..d9ab51f 100644
--- a/test/sconsign/script/no-SConsignFile.py
+++ b/test/sconsign/script/no-SConsignFile.py
@@ -32,6 +32,8 @@ Verify that the sconsign script works when using an individual
import TestSCons
import TestSConsign
+_python_ = TestSCons._python_
+
test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
test.subdir('sub1', 'sub2')
@@ -49,22 +51,22 @@ test.subdir('sub1', 'sub2')
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
+test.write(fake_cc_py, r"""#!%(_python_)s
import os
import re
import sys
path = sys.argv[1].split()
-output = open(sys.argv[2], 'wb')
-input = open(sys.argv[3], 'rb')
+output = open(sys.argv[2], 'w')
+input = open(sys.argv[3], 'r')
-output.write('fake_cc.py: %s\n' % sys.argv)
+output.write('fake_cc.py: %%s\n' %% sys.argv)
def find_file(f):
for dir in path:
p = dir + os.sep + f
if os.path.exists(p):
- return open(p, 'rb')
+ return open(p, 'r')
return None
def process(infp, outfp):
@@ -79,20 +81,20 @@ def process(infp, outfp):
process(input, output)
sys.exit(0)
-""")
+""" % locals())
-test.write(fake_link_py, r"""#!/usr/bin/env python
+test.write(fake_link_py, r"""#!%(_python_)s
import sys
-output = open(sys.argv[1], 'wb')
-input = open(sys.argv[2], 'rb')
+output = open(sys.argv[1], 'w')
+input = open(sys.argv[2], 'r')
-output.write('fake_link.py: %s\n' % sys.argv)
+output.write('fake_link.py: %%s\n' %% sys.argv)
output.write(input.read())
sys.exit(0)
-""")
+""" % locals())
test.chmod(fake_cc_py, 0o755)
test.chmod(fake_link_py, 0o755)
diff --git a/test/srcchange.py b/test/srcchange.py
index a156d9b..6916d50 100644
--- a/test/srcchange.py
+++ b/test/srcchange.py
@@ -43,7 +43,6 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
test.write('getrevision', """
-#!/usr/bin/env python
from __future__ import print_function
print(open('revnum.in','r').read().strip(), end='')
""")
diff --git a/test/subdivide.py b/test/subdivide.py
index 8c8eff0..7ddc2e9 100644
--- a/test/subdivide.py
+++ b/test/subdivide.py
@@ -36,7 +36,6 @@ being the equivalent of Decider('content').
"""
import os
-
import TestSCons
test = TestSCons.TestSCons()
@@ -59,7 +58,6 @@ fake_cc_py = test.workpath('fake_cc.py')
fake_link_py = test.workpath('fake_link.py')
test.write(fake_cc_py, """\
-#!/usr/bin/env python
import sys
ofp = open(sys.argv[1], 'w')
ofp.write('fake_cc.py: %s\\n' % sys.argv)
@@ -68,7 +66,6 @@ for s in sys.argv[2:]:
""")
test.write(fake_link_py, """\
-#!/usr/bin/env python
import sys
ofp = open(sys.argv[1], 'w')
ofp.write('fake_link.py: %s\\n' % sys.argv)