summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaweł Tomulik <ptomulik@meil.pw.edu.pl>2018-10-13 00:22:40 (GMT)
committerPaweł Tomulik <ptomulik@meil.pw.edu.pl>2018-10-22 10:18:28 (GMT)
commit19b57d5bc728c391adceee5a57d4ae7fb6120d7f (patch)
treeb23039c0dc15764892aee20ec8039f039ba8fa8d
parente27d985c627a897e1d234f8a59e1eb91cae1ca2a (diff)
downloadSCons-19b57d5bc728c391adceee5a57d4ae7fb6120d7f.zip
SCons-19b57d5bc728c391adceee5a57d4ae7fb6120d7f.tar.gz
SCons-19b57d5bc728c391adceee5a57d4ae7fb6120d7f.tar.bz2
Correct sheabangs in code snippets under test/
-rw-r--r--test/Builder/multi/different-environments.py6
-rw-r--r--test/Builder/multi/same-overrides.py7
-rw-r--r--test/ENV.py8
-rw-r--r--test/SWIG/build-dir.py6
-rw-r--r--test/Scanner/generated.py5
-rw-r--r--test/TEMPFILEPREFIX.py5
-rwxr-xr-xtest/TEX/biber_biblatex.py5
-rw-r--r--test/TEX/biber_biblatex2.py5
-rwxr-xr-xtest/TEX/biblatex.py5
-rw-r--r--test/TEX/biblatex_plain.py5
-rw-r--r--test/explain/basic.py6
-rw-r--r--test/long-lines/signature.py10
-rw-r--r--test/scons-time/run/config/python.py7
-rw-r--r--test/scons-time/run/option/python.py7
-rw-r--r--test/sconsign/script/SConsignFile.py14
-rw-r--r--test/sconsign/script/Signatures.py13
-rw-r--r--test/sconsign/script/no-SConsignFile.py13
-rw-r--r--test/srcchange.py5
-rw-r--r--test/subdivide.py14
19 files changed, 79 insertions, 67 deletions
diff --git a/test/Builder/multi/different-environments.py b/test/Builder/multi/different-environments.py
index 686e15c..2de2313 100644
--- a/test/Builder/multi/different-environments.py
+++ b/test/Builder/multi/different-environments.py
@@ -36,15 +36,15 @@ test = TestSCons.TestSCons(match=TestSCons.match_re)
_python_ = TestSCons._python_
-test.write('build.py', r"""#!/usr/bin/env python
+test.write('build.py', r"""#!/usr/bin/env python%s
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:])
-""")
+""" % sys.version_info[0])
test.write('SConstruct', """\
DefaultEnvironment(tools=[])
diff --git a/test/Builder/multi/same-overrides.py b/test/Builder/multi/same-overrides.py
index e51b2ef..0635bed 100644
--- a/test/Builder/multi/same-overrides.py
+++ b/test/Builder/multi/same-overrides.py
@@ -29,20 +29,21 @@ Verify that everything works if two multi calls have the same overrides.
"""
import TestSCons
+import sys
test = TestSCons.TestSCons(match=TestSCons.match_re)
_python_ = TestSCons._python_
-test.write('build.py', r"""#!/usr/bin/env python
+test.write('build.py', r"""#!/usr/bin/env python%s
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:])
-""")
+""" % sys.version_info[0])
test.write('SConstruct', """\
DefaultEnvironment(tools=[])
diff --git a/test/ENV.py b/test/ENV.py
index 59b1cdb..4729789 100644
--- a/test/ENV.py
+++ b/test/ENV.py
@@ -25,7 +25,7 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-
+import sys
import TestSCons
_python_ = TestSCons._python_
@@ -47,12 +47,12 @@ env2.Bld(target = 'env2.out', source = 'input')
""" % locals())
test.write('build.py',
-r"""#!/usr/bin/env python
+r"""#!/usr/bin/env python%s
import os
import sys
contents = open(sys.argv[2], 'r').read()
-open(sys.argv[1], 'w').write("build.py %s\n%s" % (os.environ['X'], contents))
-""")
+open(sys.argv[1], 'w').write("build.py %%s\n%%s" %% (os.environ['X'], contents))
+""" % sys.version_info[0])
test.write('input', "input file\n")
diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py
index d268c87..307d6eb 100644
--- a/test/SWIG/build-dir.py
+++ b/test/SWIG/build-dir.py
@@ -140,7 +140,7 @@ public:
""")
test.write(['source', 'test.py'], """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
from __future__ import print_function
import linalg
@@ -155,9 +155,9 @@ x[4] = 11.1
for i, v in enumerate(x):
- print("\tx[%d] = %g" % (i, v))
+ print("\tx[%%d] = %%g" %% (i, v))
-""")
+""" % sys.version_info[0])
test.run(arguments = '.')
diff --git a/test/Scanner/generated.py b/test/Scanner/generated.py
index 4a368b4..8c995be 100644
--- a/test/Scanner/generated.py
+++ b/test/Scanner/generated.py
@@ -34,6 +34,7 @@ factors triggered the bug Scott saw, and partly because the real-world
complexity is valuable in its own right.
"""
+import sys
import TestSCons
test = TestSCons.TestSCons()
@@ -282,7 +283,7 @@ recurse_env.Command([lib_fullname] + lib_objs,
""")
test.write(['src', 'lib_geng', 'MAKE-HEADER.py'], """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import os
import os.path
@@ -293,7 +294,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('')
-""")
+""" % sys.version_info[0])
test.write(['src', 'lib_geng', 'SConstruct'], """\
import os
diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py
index f0743e6..a4b25d1 100644
--- a/test/TEMPFILEPREFIX.py
+++ b/test/TEMPFILEPREFIX.py
@@ -30,6 +30,7 @@ beginning of the TEMPFILE invocation of a long command line.
"""
import os
+import sys
import stat
import TestSCons
@@ -37,11 +38,11 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re)
test.write('echo.py', """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
from __future__ import print_function
import sys
print(sys.argv)
-""")
+""" % sys.version_info[0])
echo_py = test.workpath('echo.py')
diff --git a/test/TEX/biber_biblatex.py b/test/TEX/biber_biblatex.py
index a63fb3f..42a2add 100755
--- a/test/TEX/biber_biblatex.py
+++ b/test/TEX/biber_biblatex.py
@@ -32,6 +32,7 @@ Test courtesy Rob Managan.
import TestSCons
import os
+import sys
test = TestSCons.TestSCons()
@@ -49,13 +50,13 @@ if not gloss==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import os
env = Environment(ENV=os.environ)
env['BIBTEX'] = 'biber'
main_output = env.PDF('bibertest.tex')
-""")
+""" % sys.version_info[0])
sources_bib_content = r"""
diff --git a/test/TEX/biber_biblatex2.py b/test/TEX/biber_biblatex2.py
index 95b5617..85a833c 100644
--- a/test/TEX/biber_biblatex2.py
+++ b/test/TEX/biber_biblatex2.py
@@ -34,6 +34,7 @@ Test courtesy Rob Managan.
import TestSCons
import os
+import sys
test = TestSCons.TestSCons()
@@ -55,12 +56,12 @@ if not biblatex==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import os
env = Environment(ENV=os.environ)
main_output = env.PDF('bibertest.tex')
-""")
+""" % sys.version_info[0])
sources_bib_content = r"""
diff --git a/test/TEX/biblatex.py b/test/TEX/biblatex.py
index a6fbd48..7b0176e 100755
--- a/test/TEX/biblatex.py
+++ b/test/TEX/biblatex.py
@@ -31,6 +31,7 @@ Test courtesy Rob Managan.
"""
import TestSCons
+import sys
import os
test = TestSCons.TestSCons()
@@ -45,12 +46,12 @@ if not biblatex==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import os
env = Environment(ENV=os.environ)
main_output = env.PDF(target='biblatextest.pdf', source='biblatextest.tex')
-""")
+""" % sys.version_info[0])
sources_bib_content = r"""
diff --git a/test/TEX/biblatex_plain.py b/test/TEX/biblatex_plain.py
index 68f7cc3..6a20761 100644
--- a/test/TEX/biblatex_plain.py
+++ b/test/TEX/biblatex_plain.py
@@ -32,6 +32,7 @@ Test courtesy Rob Managan.
import TestSCons
import os
+import sys
test = TestSCons.TestSCons()
@@ -45,12 +46,12 @@ if not biblatex==0:
test.write(['SConstruct'], """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import os
env = Environment(ENV=os.environ)
main_output = env.PDF(target='biblatextest.pdf', source='biblatextest.tex')
-""")
+""" % sys.version_info[0])
test.write(['biblatextest.tex'],r"""
\documentclass{article}
diff --git a/test/explain/basic.py b/test/explain/basic.py
index 19fc328..ce7c817 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -29,7 +29,7 @@ Verify a lot of the basic operation of the --debug=explain option.
"""
import os
-
+import sys
import TestSCons
test = TestSCons.TestSCons()
@@ -52,7 +52,7 @@ inc_bbb_k = test.workpath('inc', 'bbb.k')
-test.write(cat_py, r"""#!/usr/bin/env python
+test.write(cat_py, r"""#!/usr/bin/env python%s
from __future__ import print_function
import sys
@@ -77,7 +77,7 @@ for f in sys.argv[2:]:
process(outfp, open(f, 'r'))
sys.exit(0)
-""")
+""" % sys.version_info[0])
SConstruct_contents = """\
diff --git a/test/long-lines/signature.py b/test/long-lines/signature.py
index af234a3..480a27c 100644
--- a/test/long-lines/signature.py
+++ b/test/long-lines/signature.py
@@ -30,7 +30,7 @@ surrounded by $( $) from the signature calculation.
"""
import os
-
+import sys
import TestSCons
test = TestSCons.TestSCons()
@@ -38,7 +38,7 @@ test = TestSCons.TestSCons()
build_py = test.workpath('build.py')
test.write(build_py, """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import sys
if sys.argv[1][0] == '@':
args = open(sys.argv[1][1:], 'rb').read()
@@ -47,9 +47,9 @@ 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.write('FILEFLAG=%%s\\n' %% args[2])
+fp.write('TIMESTAMP=%%s\\n' %% args[3])
+""" % sys.version_info[0])
os.chmod(build_py, 0o755)
diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py
index 0734730..92d1600 100644
--- a/test/scons-time/run/config/python.py
+++ b/test/scons-time/run/config/python.py
@@ -29,6 +29,7 @@ Verify specifying an alternate Python executable in a config file.
"""
import os
+import sys
import TestSCons_time
@@ -43,7 +44,7 @@ python = r'%(my_python_py)s'
""" % locals())
test.write(my_python_py, """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
from __future__ import print_function
import sys
profile = ''
@@ -51,8 +52,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)
+""" % sys.version_info[0])
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..e508e11 100644
--- a/test/scons-time/run/option/python.py
+++ b/test/scons-time/run/option/python.py
@@ -29,6 +29,7 @@ Verify the run --python option to specify an alternatie Python executable.
"""
import os
+import sys
import TestSCons_time
@@ -39,15 +40,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
+#!/usr/bin/env 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)
+""" % sys.version_info[0])
os.chmod(my_python_py, 0o755)
diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py
index dc45cc1..4adf43d 100644
--- a/test/sconsign/script/SConsignFile.py
+++ b/test/sconsign/script/SConsignFile.py
@@ -30,7 +30,7 @@ using the signatures in an SConsignFile().
"""
import re
-
+import sys
import TestSCons
import TestSConsign
@@ -41,7 +41,7 @@ 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"""#!/usr/bin/env python%s
import os
import re
import sys
@@ -50,7 +50,7 @@ path = sys.argv[1].split()
output = open(sys.argv[2], 'wb')
input = open(sys.argv[3], 'rb')
-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:
@@ -71,20 +71,20 @@ def process(infp, outfp):
process(input, output)
sys.exit(0)
-""")
+""" % sys.version_info[0])
-test.write(fake_link_py, r"""#!/usr/bin/env python
+test.write(fake_link_py, r"""#!/usr/bin/env python%s
import sys
output = open(sys.argv[1], 'wb')
input = open(sys.argv[2], 'rb')
-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)
-""")
+""" % sys.version_info[0])
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..9504ce4 100644
--- a/test/sconsign/script/Signatures.py
+++ b/test/sconsign/script/Signatures.py
@@ -35,6 +35,7 @@ SourceSignatures('timestamp') with TargetSignatures('content').
import TestSCons
import TestSConsign
+import sys
test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
@@ -60,7 +61,7 @@ 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"""#!/usr/bin/env python%s
import os
import re
import sys
@@ -69,7 +70,7 @@ path = sys.argv[1].split()
output = open(sys.argv[2], 'wb')
input = open(sys.argv[3], 'rb')
-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:
@@ -90,20 +91,20 @@ def process(infp, outfp):
process(input, output)
sys.exit(0)
-""")
+""" % sys.version_info[0])
-test.write(fake_link_py, r"""#!/usr/bin/env python
+test.write(fake_link_py, r"""#!/usr/bin/env python%s
import sys
output = open(sys.argv[1], 'wb')
input = open(sys.argv[2], 'rb')
-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)
-""")
+""" % sys.version_info[0])
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..3973fc3 100644
--- a/test/sconsign/script/no-SConsignFile.py
+++ b/test/sconsign/script/no-SConsignFile.py
@@ -31,6 +31,7 @@ Verify that the sconsign script works when using an individual
import TestSCons
import TestSConsign
+import sys
test = TestSConsign.TestSConsign(match = TestSConsign.match_re)
@@ -49,7 +50,7 @@ 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"""#!/usr/bin/env python%s
import os
import re
import sys
@@ -58,7 +59,7 @@ path = sys.argv[1].split()
output = open(sys.argv[2], 'wb')
input = open(sys.argv[3], 'rb')
-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:
@@ -79,20 +80,20 @@ def process(infp, outfp):
process(input, output)
sys.exit(0)
-""")
+""" % sys.version_info[0])
-test.write(fake_link_py, r"""#!/usr/bin/env python
+test.write(fake_link_py, r"""#!/usr/bin/env python%s
import sys
output = open(sys.argv[1], 'wb')
input = open(sys.argv[2], 'rb')
-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)
-""")
+""" % sys.version_info[0])
test.chmod(fake_cc_py, 0o755)
test.chmod(fake_link_py, 0o755)
diff --git a/test/srcchange.py b/test/srcchange.py
index a156d9b..af153db 100644
--- a/test/srcchange.py
+++ b/test/srcchange.py
@@ -34,6 +34,7 @@ TargetSignatures('content') but we now rely on the default behavior
being the equivalent of Decider('content').
"""
+import sys
import os.path
import TestSCons
@@ -43,10 +44,10 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
test.write('getrevision', """
-#!/usr/bin/env python
+#!/usr/bin/env python%s
from __future__ import print_function
print(open('revnum.in','r').read().strip(), end='')
-""")
+""" % sys.version_info[0])
test.write('SConstruct', """
import re
diff --git a/test/subdivide.py b/test/subdivide.py
index 8c8eff0..49e5e5d 100644
--- a/test/subdivide.py
+++ b/test/subdivide.py
@@ -36,7 +36,7 @@ being the equivalent of Decider('content').
"""
import os
-
+import sys
import TestSCons
test = TestSCons.TestSCons()
@@ -59,22 +59,22 @@ 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
+#!/usr/bin/env python%s
import sys
ofp = open(sys.argv[1], 'w')
-ofp.write('fake_cc.py: %s\\n' % sys.argv)
+ofp.write('fake_cc.py: %%s\\n' %% sys.argv)
for s in sys.argv[2:]:
ofp.write(open(s, 'r').read())
-""")
+""" % sys.version_info[0])
test.write(fake_link_py, """\
-#!/usr/bin/env python
+#!/usr/bin/env python%s
import sys
ofp = open(sys.argv[1], 'w')
-ofp.write('fake_link.py: %s\\n' % sys.argv)
+ofp.write('fake_link.py: %%s\\n' %% sys.argv)
for s in sys.argv[2:]:
ofp.write(open(s, 'r').read())
-""")
+""" % sys.version_info[0])
test.chmod(fake_cc_py, 0o755)
test.chmod(fake_link_py, 0o755)