summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-13 14:56:49 +0000
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-13 14:56:49 +0000
commit63f4c3b24e101450ae1dcb39aa7e1c68ffc997d3 (patch)
tree460a8f64c3d54e14d24abf193255a731a28ceb80
parentc48ebf8c67a83768ab094e9572f0fc69214450ba (diff)
parent5834e0c1d4616616e578e27226472e9ba87f6e2b (diff)
downloadscons-63f4c3b24e101450ae1dcb39aa7e1c68ffc997d3.tar.gz
Merged in rodrigc/scons (pull request #410)
When iterating over dict.items(), we do not need a new list.
-rw-r--r--QMTest/TestCmd.py6
-rw-r--r--QMTest/TestCommonTests.py13
-rw-r--r--bench/env.__setitem__.py2
-rw-r--r--src/CHANGES.txt5
-rw-r--r--src/engine/SCons/Tool/__init__.py19
-rw-r--r--src/engine/SCons/Util.py7
-rw-r--r--src/script/scons-configure-cache.py6
-rw-r--r--test/CPPSUFFIXES.py9
-rw-r--r--test/CXX/CXX.py10
-rw-r--r--test/CXX/SHCXX.py3
-rw-r--r--test/CacheDir/CacheDir.py10
-rw-r--r--test/CacheDir/SideEffect.py6
-rw-r--r--test/CacheDir/VariantDir.py10
-rw-r--r--test/CacheDir/environment.py14
-rw-r--r--test/CacheDir/option--cd.py14
-rw-r--r--test/CacheDir/option--cf.py7
-rw-r--r--test/CacheDir/option--cr.py14
-rw-r--r--test/CacheDir/option--cs.py6
-rw-r--r--test/CacheDir/symlink.py10
-rw-r--r--test/Command.py32
-rw-r--r--test/CommandGenerator.py10
-rw-r--r--test/Configure/custom-tests.py4
-rw-r--r--test/DVIPDF/DVIPDFFLAGS.py12
-rw-r--r--test/DVIPS/DVIPSFLAGS.py14
-rw-r--r--test/Deprecated/Options/Options.py15
-rw-r--r--test/Dir/source.py14
-rw-r--r--test/ENV.py13
-rw-r--r--test/Ghostscript/GSFLAGS.py6
-rw-r--r--test/HeaderGen.py6
-rw-r--r--test/IDL/MIDLCOM.py14
-rw-r--r--test/Install/Install.py8
-rw-r--r--test/Interactive/shell.py4
-rw-r--r--test/Java/JAR.py26
-rw-r--r--test/Java/JAVAC.py12
-rw-r--r--test/Java/JAVAH.py19
-rw-r--r--test/Java/RMIC.py16
-rw-r--r--test/MSVC/batch.py28
-rw-r--r--test/MSVC/embed-manifest.py6
-rw-r--r--test/MSVC/generate-rc.py10
-rw-r--r--test/MSVC/msvc.py3
-rw-r--r--test/Parallel/ref_count.py8
-rw-r--r--test/RANLIB/RANLIBFLAGS.py2
-rw-r--r--test/Repository/Default.py14
-rw-r--r--test/Repository/Install-Local.py12
-rw-r--r--test/Repository/Install.py2
-rw-r--r--test/Repository/InstallAs.py6
-rw-r--r--test/Repository/LIBPATH.py14
-rw-r--r--test/Repository/Local.py16
-rw-r--r--test/Repository/SConscript.py12
-rw-r--r--test/Repository/VariantDir.py28
-rw-r--r--test/Repository/option-c.py66
-rw-r--r--test/Repository/option-f.py10
-rw-r--r--test/Repository/option-n.py6
-rw-r--r--test/Repository/targets.py14
-rw-r--r--test/Requires/eval-order.py6
-rw-r--r--test/Rpcgen/RPCGEN.py14
-rw-r--r--test/Rpcgen/RPCGENCLIENTFLAGS.py8
-rw-r--r--test/Rpcgen/RPCGENFLAGS.py8
-rw-r--r--test/Rpcgen/RPCGENHEADERFLAGS.py8
-rw-r--r--test/Rpcgen/RPCGENSERVICEFLAGS.py8
-rw-r--r--test/Rpcgen/RPCGENXDRFLAGS.py8
-rw-r--r--test/SConscript/Return.py32
-rw-r--r--test/SConscript/SConscript.py4
-rw-r--r--test/SWIG/live.py8
-rw-r--r--test/Scanner/FindPathDirs.py6
-rw-r--r--test/Scanner/Scanner.py8
-rw-r--r--test/Scanner/generated.py2
-rw-r--r--test/Scanner/no-Dir-node.py10
-rw-r--r--test/TAR/TAR.py14
-rw-r--r--test/TAR/TARFLAGS.py14
-rw-r--r--test/TEMPFILEPREFIX.py3
-rw-r--r--test/TEX/LATEXFLAGS.py10
-rw-r--r--test/Variables/Variables.py5
-rw-r--r--test/VariantDir/Clean.py4
-rw-r--r--test/VariantDir/File-create.py4
-rw-r--r--test/VariantDir/errors.py6
-rw-r--r--test/builderrors.py13
-rw-r--r--test/fixture/wrapper.py2
-rw-r--r--test/fixture/wrapper_with_args.py7
-rw-r--r--test/option--.py2
-rw-r--r--test/option--Q.py2
-rw-r--r--test/option-i.py15
-rw-r--r--test/option-j.py2
-rw-r--r--test/option-k.py13
-rw-r--r--test/option-n.py2
-rw-r--r--test/option-s.py2
-rw-r--r--test/scons-time/run/config/python.py6
-rw-r--r--test/scons-time/run/config/scons.py6
-rw-r--r--test/scons-time/run/option/python.py6
-rw-r--r--test/scons-time/run/option/scons.py6
-rw-r--r--test/subdivide.py4
91 files changed, 490 insertions, 441 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index 96e07a98..e76b2e31 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -499,7 +499,7 @@ def match_re(lines = None, res = None):
msg = "Regular expression error in %s: %s"
raise re.error(msg % (repr(s), e.args[0]))
if not expr.search(lines[i]):
- print("match_re: mismatch at line %d:\n search re='%s'\n line='%s'"%(i,s,lines[i]))
+ print("match_re: mismatch at line %d:\n search re='%s'\n line='%s'"%(i, s, lines[i]))
return
return 1
@@ -672,7 +672,7 @@ except AttributeError:
PIPE = subprocess.PIPE
-if sys.platform == 'win32' and subprocess.mswindows:
+if sys.platform == 'win32':# and subprocess.mswindows:
try:
from win32file import ReadFile, WriteFile
from win32pipe import PeekNamedPipe
@@ -734,7 +734,7 @@ class Popen(subprocess.Popen):
getattr(self, which).close()
setattr(self, which, None)
- if sys.platform == 'win32' and subprocess.mswindows:
+ if sys.platform == 'win32':# and subprocess.mswindows:
def send(self, input):
if not self.stdin:
return None
diff --git a/QMTest/TestCommonTests.py b/QMTest/TestCommonTests.py
index 30b7d6a3..7949cb84 100644
--- a/QMTest/TestCommonTests.py
+++ b/QMTest/TestCommonTests.py
@@ -168,10 +168,11 @@ class __init__TestCase(TestCommonTestCase):
os.chdir(run_env.workdir)
script = lstrip("""\
+ from __future__ import print_function
from TestCommon import TestCommon
tc = TestCommon(workdir='')
import os
- print os.getcwd()
+ print(os.getcwd())
""")
run_env.run(program=sys.executable, stdin=script)
stdout = run_env.stdout()[:-1]
@@ -2285,14 +2286,16 @@ class variables_TestCase(TestCommonTestCase):
'dll_suffix',
]
- script = "import TestCommon\n" + \
- '\n'.join([ "print TestCommon.%s\n" % v for v in variables ])
+ script = "from __future__ import print_function" + \
+ "import TestCommon\n" + \
+ '\n'.join([ "print(TestCommon.%s)\n" % v for v in variables ])
run_env.run(program=sys.executable, stdin=script)
stderr = run_env.stderr()
assert stderr == "", stderr
- script = "from TestCommon import *\n" + \
- '\n'.join([ "print %s" % v for v in variables ])
+ script = "from __future__ import print_function" + \
+ "from TestCommon import *\n" + \
+ '\n'.join([ "print(%s)" % v for v in variables ])
run_env.run(program=sys.executable, stdin=script)
stderr = run_env.stderr()
assert stderr == "", stderr
diff --git a/bench/env.__setitem__.py b/bench/env.__setitem__.py
index 9c27b6d5..510dcc7d 100644
--- a/bench/env.__setitem__.py
+++ b/bench/env.__setitem__.py
@@ -4,6 +4,8 @@
# env.__setitem__() method(s) in the src/engine/SCons/Environment.py
# module.
+from __future__ import print_function
+
import os.path
import re
import sys
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 4a7576e0..d6eed684 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -13,6 +13,9 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
RELEASE VERSION/DATE TO BE FILLED IN LATER
+ From Russel Winder:
+ - Reordered the default D tools from "dmd, gdc, ldc" to "dmd, ldc, gdc".
+
From William Blevins:
- Updated D language scanner support to latest: 2.071.1. (PR #1924)
https://dlang.org/spec/module.html accessed 11 August 2016
@@ -146,7 +149,7 @@ RELEASE 2.4.1 - Mon, 07 Nov 2015 10:37:21 -0700
and continuing.
From Hiroaki Itoh :
- - Add support `Microsoft Visual C++ Compiler for Python 2.7'
+ - Add support `Microsoft Visual C++ Compiler for Python 2.7'
Compiler can be obtained at: https://www.microsoft.com/en-us/download/details.aspx?id=44266
From Florian Miedniak:
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 0e5f3644..dbc6d0ce 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -291,7 +291,7 @@ def _call_linker_cb(env, callback, args, result = None):
if Verbose:
print('_call_linker_cb: args=%r' % args)
print('_call_linker_cb: callback=%r' % callback)
-
+
try:
cbfun = env['LINKCALLBACKS'][callback]
except (KeyError, TypeError):
@@ -423,7 +423,7 @@ class _LibInfoGeneratorBase(object):
def generate_versioned_lib_info(self, env, args, result = None, **kw):
callback = self.get_versioned_lib_info_generator(**kw)
- return _call_linker_cb(env, callback, args, result)
+ return _call_linker_cb(env, callback, args, result)
class _LibPrefixGenerator(_LibInfoGeneratorBase):
"""Library prefix generator, used as target_prefix in SharedLibrary and
@@ -534,7 +534,7 @@ ImpLibSymlinkGenerator = _LibSymlinkGenerator('ImpLib')
class _LibNameGenerator(_LibInfoGeneratorBase):
"""Generates "unmangled" library name from a library file node.
-
+
Generally, it's thought to revert modifications done by prefix/suffix
generators (_LibPrefixGenerator/_LibSuffixGenerator) used by a library
builder. For example, on gnulink the suffix generator used by SharedLibrary
@@ -544,7 +544,7 @@ class _LibNameGenerator(_LibInfoGeneratorBase):
"$SHLIBSUFFIX" in the node's basename. So that, if $SHLIBSUFFIX is ".so",
$SHLIBVERSION is "0.1.2" and the node path is "/foo/bar/libfoo.so.0.1.2",
the _LibNameGenerator shall return "libfoo.so". Other link tools may
- implement it's own way of library name unmangling.
+ implement it's own way of library name unmangling.
"""
def __init__(self, libtype):
super(_LibNameGenerator, self).__init__(libtype, 'Name')
@@ -585,7 +585,7 @@ LdModNameGenerator = _LibNameGenerator('LdMod')
ImpLibNameGenerator = _LibNameGenerator('ImpLib')
class _LibSonameGenerator(_LibInfoGeneratorBase):
- """Library soname generator. Returns library soname (e.g. libfoo.so.0) for
+ """Library soname generator. Returns library soname (e.g. libfoo.so.0) for
a given node (e.g. /foo/bar/libfoo.so.0.1.2)"""
def __init__(self, libtype):
super(_LibSonameGenerator, self).__init__(libtype, 'Soname')
@@ -648,7 +648,7 @@ def EmitLibSymlinks(env, symlinks, libnode, **kw):
clean_targets = kw.get('clean_targets', [])
if not SCons.Util.is_List(clean_targets):
clean_targets = [ clean_targets ]
-
+
for link, linktgt in symlinks:
env.SideEffect(link, linktgt)
if(Verbose):
@@ -663,7 +663,7 @@ def CreateLibSymlinks(env, symlinks):
form [ (link, linktarget), ... ], where link and linktarget are SCons
nodes.
"""
-
+
Verbose = False
for link, linktgt in symlinks:
linktgt = link.get_dir().rel_path(linktgt)
@@ -705,7 +705,7 @@ def LibSymlinksStrFun(target, source, env, *args):
else:
cmd += ": %s" % linkstr
return cmd
-
+
LibSymlinksAction = SCons.Action.Action(LibSymlinksActionFunction, LibSymlinksStrFun)
@@ -1137,7 +1137,7 @@ def tool_list(platform, env):
fortran_compiler = FindTool(fortran_compilers, env) or fortran_compilers[0]
ar = FindTool(ars, env) or ars[0]
- d_compilers = ['dmd', 'gdc', 'ldc']
+ d_compilers = ['dmd', 'ldc', 'gdc']
d_compiler = FindTool(d_compilers, env) or d_compilers[0]
other_tools = FindAllTools(other_plat_tools + [
@@ -1172,4 +1172,3 @@ def tool_list(platform, env):
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
-
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py
index 83202a5f..52d7a50b 100644
--- a/src/engine/SCons/Util.py
+++ b/src/engine/SCons/Util.py
@@ -271,6 +271,7 @@ def render_tree(root, child_func, prune=0, margin=[0], visited=None):
IDX = lambda N: N and 1 or 0
+
def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None):
"""
Print a tree of nodes. This is like render_tree, except it prints
@@ -307,7 +308,7 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None):
' N = no clean\n' +
' H = no cache\n' +
'\n')
- sys.stdout.write(unicode(legend))
+ sys.stdout.write(u(legend))
tags = ['[']
tags.append(' E'[IDX(root.exists())])
@@ -1453,9 +1454,9 @@ def AddMethod(obj, function, name=None):
self.z = x + y
AddMethod(f, A, "add")
a.add(2, 4)
- print a.z
+ print(a.z)
AddMethod(lambda self, i: self.l[i], a, "listIndex")
- print a.listIndex(5)
+ print(a.listIndex(5))
"""
if name is None:
name = function.__name__
diff --git a/src/script/scons-configure-cache.py b/src/script/scons-configure-cache.py
index 73ccf184..0fc7b48a 100644
--- a/src/script/scons-configure-cache.py
+++ b/src/script/scons-configure-cache.py
@@ -23,6 +23,8 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+from __future__ import print_function
+
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
__version__ = "__VERSION__"
@@ -41,14 +43,14 @@ import json
import os
def rearrange_cache_entries(current_prefix_len, new_prefix_len):
- print 'Changing prefix length from', current_prefix_len, 'to', new_prefix_len
+ print('Changing prefix length from', current_prefix_len, 'to', new_prefix_len)
dirs = set()
old_dirs = set()
for file in glob.iglob(os.path.join('*', '*')):
name = os.path.basename(file)
dir = name[:current_prefix_len].upper()
if dir not in old_dirs:
- print 'Migrating', dir
+ print('Migrating', dir)
old_dirs.add(dir)
dir = name[:new_prefix_len].upper()
if dir not in dirs:
diff --git a/test/CPPSUFFIXES.py b/test/CPPSUFFIXES.py
index 6aa55960..141df290 100644
--- a/test/CPPSUFFIXES.py
+++ b/test/CPPSUFFIXES.py
@@ -49,6 +49,7 @@ sys.exit(0)
""")
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
env = Environment(CPPPATH = ['.'],
CC = r'%(_python_)s mycc.py',
CCFLAGS = [],
@@ -94,7 +95,7 @@ test1.h 1
foo.h 1
test1.x 1
foo.h 1
-""")
+""", mode='r')
test.up_to_date(arguments='.')
@@ -112,7 +113,7 @@ test1.h 1
foo.h 2
test1.x 1
foo.h 2
-""")
+""", mode='r')
test.up_to_date(arguments='.')
@@ -134,7 +135,7 @@ test1.h 1
foo.h 2
test1.x 2
foo.h 2
-""")
+""", mode='r')
test.up_to_date(arguments='.')
@@ -156,7 +157,7 @@ test1.h 2
foo.h 2
test1.x 2
foo.h 2
-""")
+""", mode='r')
test.up_to_date(arguments='.')
diff --git a/test/CXX/CXX.py b/test/CXX/CXX.py
index 1a07b093..83c4285a 100644
--- a/test/CXX/CXX.py
+++ b/test/CXX/CXX.py
@@ -151,15 +151,15 @@ test.write('test5.C++', r"""This is a .C++ file.
test.run(arguments = '.', stderr = None)
-test.must_match('test1' + _exe, "This is a .cc file.\n")
+test.must_match('test1' + _exe, "This is a .cc file.\n", mode='r')
-test.must_match('test2' + _exe, "This is a .cpp file.\n")
+test.must_match('test2' + _exe, "This is a .cpp file.\n", mode='r')
-test.must_match('test3' + _exe, "This is a .cxx file.\n")
+test.must_match('test3' + _exe, "This is a .cxx file.\n", mode='r')
-test.must_match('test4' + _exe, "This is a .c++ file.\n")
+test.must_match('test4' + _exe, "This is a .c++ file.\n", mode='r')
-test.must_match('test5' + _exe, "This is a .C++ file.\n")
+test.must_match('test5' + _exe, "This is a .C++ file.\n", mode='r')
if TestSCons.case_sensitive_suffixes('.c', '.C'):
diff --git a/test/CXX/SHCXX.py b/test/CXX/SHCXX.py
index d6a314ec..0d1ad366 100644
--- a/test/CXX/SHCXX.py
+++ b/test/CXX/SHCXX.py
@@ -73,7 +73,8 @@ test.fail_test(os.path.exists(test.workpath('wrapper.out')))
test.run(arguments = 'bar')
-test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+test.must_match('wrapper.out', "wrapper.py\n", mode='r')
+# test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
test.pass_test()
diff --git a/test/CacheDir/CacheDir.py b/test/CacheDir/CacheDir.py
index fe73cad7..45c5db5e 100644
--- a/test/CacheDir/CacheDir.py
+++ b/test/CacheDir/CacheDir.py
@@ -89,8 +89,8 @@ test.fail_test(os.listdir(cache) != ['config'])
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -130,7 +130,7 @@ test.must_not_exist(src_all)
# even though it doesn't report anything.
test.run(chdir = 'src', arguments = '-s .', stdout = "")
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(src_cat_out)
test.up_to_date(chdir = 'src', arguments = '.')
@@ -148,8 +148,8 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n")
-test.must_match(['src', 'cat.out'], "bbb.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/SideEffect.py b/test/CacheDir/SideEffect.py
index 386b16a8..2ddba31e 100644
--- a/test/CacheDir/SideEffect.py
+++ b/test/CacheDir/SideEffect.py
@@ -69,7 +69,7 @@ f1.in -> f1.out
f2.in -> f2.out
"""
-test.must_match(['work', 'log.txt'], expect)
+test.must_match(['work', 'log.txt'], expect, mode='r')
@@ -84,7 +84,7 @@ f2.in -> f2.out
f3.in -> f3.out
"""
-test.must_match(['work', 'log.txt'], expect)
+test.must_match(['work', 'log.txt'], expect, mode='r')
@@ -100,7 +100,7 @@ f3.in -> f3.out
f1.in -> f1.out
"""
-test.must_match(['work', 'log.txt'], expect)
+test.must_match(['work', 'log.txt'], expect, mode='r')
diff --git a/test/CacheDir/VariantDir.py b/test/CacheDir/VariantDir.py
index 30325d21..d31b9ed0 100644
--- a/test/CacheDir/VariantDir.py
+++ b/test/CacheDir/VariantDir.py
@@ -75,8 +75,8 @@ SConscript('build/SConscript')
# This should populate the cache with our derived files.
test.run()
-test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match('cat.out', "%s\n%s\n%s\n%s\n" % (build_aaa_out, build_bbb_out, build_ccc_out, build_all))
+test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match('cat.out', "%s\n%s\n%s\n%s\n" % (build_aaa_out, build_bbb_out, build_ccc_out, build_all), mode='r')
test.up_to_date(arguments = '.')
@@ -116,7 +116,7 @@ test.must_not_exist(test.workpath('build', 'all'))
# even though it doesn't report anything.
test.run(arguments = '-s .', stdout = "")
-test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['build', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(cat_out)
test.up_to_date(arguments = '.')
@@ -137,8 +137,8 @@ cat(["%s"], ["%s", "%s", "%s"])
build_ccc_out,
build_all, build_aaa_out, build_bbb_out, build_ccc_out)))
-test.must_match(['build', 'all'], "aaa.in\nbbb.in 2\nccc.in\n")
-test.must_match('cat.out', "%s\n%s\n" % (build_bbb_out, build_all))
+test.must_match(['build', 'all'], "aaa.in\nbbb.in 2\nccc.in\n", mode='r')
+test.must_match('cat.out', "%s\n%s\n" % (build_bbb_out, build_all), mode='r')
test.up_to_date(arguments = '.')
diff --git a/test/CacheDir/environment.py b/test/CacheDir/environment.py
index eb28c19d..e37b9993 100644
--- a/test/CacheDir/environment.py
+++ b/test/CacheDir/environment.py
@@ -92,8 +92,8 @@ test.fail_test(os.listdir(cache) != ['config'])
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(src_cat_out, "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(src_cat_out, "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -109,7 +109,7 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(src_cat_out, "bbb.out\nall\n")
+test.must_match(src_cat_out, "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -134,9 +134,9 @@ test.must_not_exist(src_all)
# even though it doesn't report anything.
test.run(chdir = 'src', arguments = '-s .', stdout = "")
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
-test.must_match(src_cat_out, "bbb.out\nall\n")
+test.must_match(src_cat_out, "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -154,8 +154,8 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n")
-test.must_match(src_cat_out, "bbb.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in 2\nccc.in\n", mode='r')
+test.must_match(src_cat_out, "bbb.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cd.py b/test/CacheDir/option--cd.py
index efcf8434..fad5add7 100644
--- a/test/CacheDir/option--cd.py
+++ b/test/CacheDir/option--cd.py
@@ -62,8 +62,8 @@ test.write(['src', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -79,7 +79,7 @@ Retrieved `ccc.out' from cache
Retrieved `all' from cache
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(test.workpath('src', 'cat.out'))
test.up_to_date(chdir = 'src', arguments = '.')
@@ -97,8 +97,8 @@ cat(["ccc.out"], ["ccc.in"])
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -116,8 +116,8 @@ cat(["ccc.out"], ["ccc.in"])
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cf.py b/test/CacheDir/option--cf.py
index ace0df6b..bb9d1cc7 100644
--- a/test/CacheDir/option--cf.py
+++ b/test/CacheDir/option--cf.py
@@ -38,6 +38,7 @@ test = TestSCons.TestSCons()
test.subdir('cache', 'src')
test.write(['src', 'SConstruct'], """
+DefaultEnvironment(tools=[])
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'a').write(target + "\\n")
@@ -61,8 +62,10 @@ test.write(['src', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n")
-test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src','all'],"aaa.in\nbbb.in\nccc.in\n", mode='r')
+# test.fail_test(test.read(['src', 'all']) != "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src','cat.out'],"aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
+# test.fail_test(test.read(['src', 'cat.out']) != "aaa.out\nbbb.out\nccc.out\nall\n")
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cr.py b/test/CacheDir/option--cr.py
index 165e0496..792dede9 100644
--- a/test/CacheDir/option--cr.py
+++ b/test/CacheDir/option--cr.py
@@ -62,8 +62,8 @@ test.write(['src', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src', arguments = '.')
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -80,7 +80,7 @@ Retrieved `ccc.out' from cache
Retrieved `all' from cache
"""))
-test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(test.workpath('src', 'cat.out'))
test.up_to_date(chdir = 'src', arguments = '.')
@@ -100,9 +100,9 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n")
+test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n", mode='r')
# cat.out contains only the things we built (not got from cache)
-test.must_match(['src', 'cat.out'], "aaa.out\nall\n")
+test.must_match(['src', 'cat.out'], "aaa.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
@@ -120,8 +120,8 @@ Retrieved `ccc.out' from cache
cat(["all"], ["aaa.out", "bbb.out", "ccc.out"])
"""))
-test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n")
-test.must_match(['src', 'cat.out'], "aaa.out\nall\n")
+test.must_match(['src', 'all'], "aaa.rebuild\nbbb.in\nccc.in\n", mode='r')
+test.must_match(['src', 'cat.out'], "aaa.out\nall\n", mode='r')
test.up_to_date(chdir = 'src', arguments = '.')
diff --git a/test/CacheDir/option--cs.py b/test/CacheDir/option--cs.py
index bff585d6..2e37e5af 100644
--- a/test/CacheDir/option--cs.py
+++ b/test/CacheDir/option--cs.py
@@ -79,9 +79,9 @@ test.write(['src1', 'ccc.in'], "ccc.in\n")
# This should populate the cache with our derived files.
test.run(chdir = 'src1', arguments = '.')
-test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
-test.must_match(['src1', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n")
+test.must_match(['src1', 'cat.out'], "aaa.out\nbbb.out\nccc.out\nall\n", mode='r')
test.up_to_date(chdir = 'src1', arguments = '.')
@@ -145,7 +145,7 @@ test.run(chdir = 'src1',
arguments = '--cache-show -s .',
stdout = "")
-test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n")
+test.must_match(['src1', 'all'], "aaa.in\nbbb.in\nccc.in\n", mode='r')
test.must_not_exist(test.workpath('src1', 'cat.out'))
#
diff --git a/test/CacheDir/symlink.py b/test/CacheDir/symlink.py
index ca3bbe24..e23c25eb 100644
--- a/test/CacheDir/symlink.py
+++ b/test/CacheDir/symlink.py
@@ -21,6 +21,10 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
+import os
+import sys
+
+import TestSCons
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -29,13 +33,13 @@ Verify that we push and retrieve a built symlink to/from a CacheDir()
as an actualy symlink, not by copying the file contents.
"""
-import os
-import TestSCons
+
test = TestSCons.TestSCons()
-if not hasattr(os, 'symlink'):
+if not hasattr(os, 'symlink') or sys.platform == 'win32':
+ # Skip test on windows as well, because this requires permissions which aren't default
import sys
test.skip_test('%s has no os.symlink() method; skipping test\n' % sys.executable)
diff --git a/test/Command.py b/test/Command.py
index 5f72c94b..38aceb58 100644
--- a/test/Command.py
+++ b/test/Command.py
@@ -35,8 +35,8 @@ test.subdir('sub')
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'rb').read()
-file = open(sys.argv[1], 'wb')
+contents = open(sys.argv[2], 'r').read()
+file = open(sys.argv[1], 'w')
file.write(contents)
file.close()
""")
@@ -45,8 +45,8 @@ test.write('SConstruct', """
import os
def buildIt(env, target, source):
- contents = open(str(source[0]), 'rb').read()
- file = open(str(target[0]), 'wb')
+ contents = open(str(source[0]), 'r').read()
+ file = open(str(target[0]), 'w')
xyzzy = env.get('XYZZY', '')
if xyzzy:
file.write(xyzzy + '\\n')
@@ -57,9 +57,9 @@ def buildIt(env, target, source):
def sub(env, target, source):
target = str(target[0])
source = str(source[0])
- t = open(target, 'wb')
+ t = open(target, 'w')
for f in sorted(os.listdir(source)):
- t.write(open(os.path.join(source, f), 'rb').read())
+ t.write(open(os.path.join(source, f), 'r').read())
t.close()
return 0
@@ -103,16 +103,16 @@ test.write('f10.in', "f10.in\n")
test.run(arguments = '.')
-test.must_match('f1.out', "f1.in\n")
-test.must_match('f2.out', "f2.in\n")
-test.must_match('f3.out', "f3.in\n")
-test.must_match('f4.out', "sub/f4a\nsub/f4b\nsub/f4c\n")
-test.must_match('f5.out', "XYZZY is set\nf5.in\n")
-test.must_match('f6.out', "f6.in\n")
-test.must_match('f7.out', "f7.in\n")
-test.must_match('f8.out', "f8.in\n")
-test.must_match('f9.out', "f9.in\n")
-test.must_match('f10.out', "f10.in\n")
+test.must_match('f1.out', "f1.in\n", mode='r')
+test.must_match('f2.out', "f2.in\n", mode='r')
+test.must_match('f3.out', "f3.in\n", mode='r')
+test.must_match('f4.out', "sub/f4a\nsub/f4b\nsub/f4c\n", mode='r')
+test.must_match('f5.out', "XYZZY is set\nf5.in\n", mode='r')
+test.must_match('f6.out', "f6.in\n", mode='r')
+test.must_match('f7.out', "f7.in\n", mode='r')
+test.must_match('f8.out', "f8.in\n", mode='r')
+test.must_match('f9.out', "f9.in\n", mode='r')
+test.must_match('f10.out', "f10.in\n", mode='r')
test.pass_test()
diff --git a/test/CommandGenerator.py b/test/CommandGenerator.py
index 063999df..a3a995b5 100644
--- a/test/CommandGenerator.py
+++ b/test/CommandGenerator.py
@@ -34,8 +34,8 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-contents = open(sys.argv[2], 'rb').read()
-file = open(sys.argv[1], 'wb')
+contents = open(sys.argv[2], 'r').read()
+file = open(sys.argv[1], 'w')
file.write(contents)
file.close()
sys.exit(0)
@@ -64,9 +64,9 @@ test.write('foo3.in', "foo3.in\n")
test.run(arguments = 'foo1.out foo2.out foo3.out')
-test.fail_test(test.read(test.workpath('foo1.out')) != "foo1.in\n")
-test.fail_test(test.read(test.workpath('foo2.out')) != "foo2.in\n")
-test.fail_test(test.read(test.workpath('foo3.out')) != "foo3.in\n")
+test.must_match('foo1.out','foo1.in\n', mode='r')
+test.must_match('foo2.out','foo2.in\n', mode='r')
+test.must_match('foo3.out','foo3.in\n', mode='r')
test.pass_test()
diff --git a/test/Configure/custom-tests.py b/test/Configure/custom-tests.py
index 503eb4e4..7bb23662 100644
--- a/test/Configure/custom-tests.py
+++ b/test/Configure/custom-tests.py
@@ -49,8 +49,10 @@ runOK = compileOK
runFAIL = "int main() { return 1; }"
test.write('pyAct.py', """\
+from __future__ import print_function
+
import sys
-print sys.argv[1]
+print(sys.argv[1])
sys.exit(int(sys.argv[1]))
""")
diff --git a/test/DVIPDF/DVIPDFFLAGS.py b/test/DVIPDF/DVIPDFFLAGS.py
index 51a4c42a..b8c53c96 100644
--- a/test/DVIPDF/DVIPDFFLAGS.py
+++ b/test/DVIPDF/DVIPDFFLAGS.py
@@ -100,9 +100,9 @@ test.write('test2.tex', r"""This is a .tex test.
test.run(arguments = '.', stderr = None)
-test.must_match('test1.pdf', " -x\nThis is a .dvi test.\n")
+test.must_match('test1.pdf', " -x\nThis is a .dvi test.\n", mode='r')
-test.must_match('test2.pdf', " -x\nThis is a .tex test.\n")
+test.must_match('test2.pdf', " -x\nThis is a .tex test.\n", mode='r')
@@ -149,21 +149,21 @@ This is the %s LaTeX file.
test.write('bar.tex', tex % 'bar.tex')
- test.run(arguments = 'foo.pdf', stderr = None)
+ test.run(arguments='foo.pdf', stderr=None)
test.must_not_exist(test.workpath('wrapper.out'))
test.must_exist(test.workpath('foo.pdf'))
- test.run(arguments = 'xxx.pdf', stderr = None)
+ test.run(arguments='xxx.pdf', stderr=None)
test.must_not_exist(test.workpath('wrapper.out'))
test.must_not_exist(test.workpath('xxx.dvi'))
- test.run(arguments = 'bar.pdf', stderr = None)
+ test.run(arguments='bar.pdf', stderr=None)
- test.must_match('wrapper.out', "dvipdf bar.dvi bar.pdf\n")
+ test.must_match('wrapper.out', "dvipdf bar.dvi bar.pdf\n", mode='r')
test.must_exist(test.workpath('bar.pdf'))
diff --git a/test/DVIPS/DVIPSFLAGS.py b/test/DVIPS/DVIPSFLAGS.py
index 7aedf240..814c8aaa 100644
--- a/test/DVIPS/DVIPSFLAGS.py
+++ b/test/DVIPS/DVIPSFLAGS.py
@@ -112,13 +112,13 @@ test.write('test4.latex', r"""This is a .latex test.
test.run(arguments = '.', stderr = None)
-test.must_match('test1.ps', " -x\nThis is a .dvi test.\n")
+test.must_match('test1.ps', " -x\nThis is a .dvi test.\n", mode='r')
-test.must_match('test2.ps', " -x\nThis is a .tex test.\n")
+test.must_match('test2.ps', " -x\nThis is a .tex test.\n", mode='r')
-test.must_match('test3.ps', " -x\nThis is a .ltx test.\n")
+test.must_match('test3.ps', " -x\nThis is a .ltx test.\n", mode='r')
-test.must_match('test4.ps', " -x\nThis is a .latex test.\n")
+test.must_match('test4.ps', " -x\nThis is a .latex test.\n", mode='r')
dvips = test.where_is('dvips')
@@ -161,20 +161,20 @@ This is the %s LaTeX file.
test.write('bar2.ltx', latex % 'bar2.ltx')
test.write('bar3.latex', latex % 'bar3.latex')
- test.run(arguments = 'foo.dvi', stderr = None)
+ test.run(arguments='foo.dvi', stderr=None)
test.must_not_exist(test.workpath('wrapper.out'))
test.must_exist(test.workpath('foo.dvi'))
- test.run(arguments = 'bar1.ps bar2.ps bar3.ps', stderr = None)
+ test.run(arguments='bar1.ps bar2.ps bar3.ps', stderr=None)
expect = """dvips -o bar1.ps bar1.dvi
dvips -o bar2.ps bar2.dvi
dvips -o bar3.ps bar3.dvi
"""
- test.must_match('wrapper.out', expect)
+ test.must_match('wrapper.out', expect, mode='r')
test.must_exist(test.workpath('bar1.ps'))
test.must_exist(test.workpath('bar2.ps'))
diff --git a/test/Deprecated/Options/Options.py b/test/Deprecated/Options/Options.py
index e435b9ef..2a2d26c6 100644
--- a/test/Deprecated/Options/Options.py
+++ b/test/Deprecated/Options/Options.py
@@ -29,6 +29,7 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
env = Environment()
print(env['CC'])
print(" ".join(env['CCFLAGS']))
@@ -38,6 +39,7 @@ test.run()
cc, ccflags = test.stdout().split('\n')[1:3]
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
# test validator. Change a key and add a new one to the environment
def validator(key, value, environ):
environ[key] = "v"
@@ -208,6 +210,8 @@ Use scons -H for help about command-line options.
# Test saving of options and multi loading
#
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
+
opts = Options(['custom.py', 'options.saved'])
opts.Add('RELEASE_BUILD',
'Set to 1 to build a release build',
@@ -259,6 +263,8 @@ checkSave('options.saved', {'DEBUG_BUILD':3, 'RELEASE_BUILD':1})
# Load no options from file(s)
# Used to test for correct output in save option file
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
+
opts = Options()
opts.Add('RELEASE_BUILD',
'Set to 1 to build a release build',
@@ -305,6 +311,8 @@ check(['0','0'])
checkSave('options.saved',{'DEBUG_BUILD':0, 'LISTOPTION_TEST':'a,b'})
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
+
opts = Options('custom.py')
opts.Add('RELEASE_BUILD',
'Set to 1 to build a release build',
@@ -326,7 +334,10 @@ opts.Add('UNSPECIFIED',
env = Environment(options=opts)
-Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env,sort=cmp))
+def compare(a,b):
+ return a < b
+
+Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env,sort=compare))
""")
@@ -357,6 +368,8 @@ Use scons -H for help about command-line options.
stderr=warnings)
test.write('SConstruct', """
+DefaultEnvironment(tools=[])
+
import SCons.Options
env1 = Environment(options = Options())
env2 = Environment(options = SCons.Options.Options())
diff --git a/test/Dir/source.py b/test/Dir/source.py
index 8dbee1af..c272c8f4 100644
--- a/test/Dir/source.py
+++ b/test/Dir/source.py
@@ -43,7 +43,7 @@ test.subdir('tstamp', [ 'tstamp', 'subdir' ],
test.write('SConstruct', """\
def writeTarget(target, source, env):
- f=open(str(target[0]), 'wb')
+ f=open(str(target[0]), 'w')
f.write("stuff\\n")
f.close()
return 0
@@ -92,12 +92,12 @@ test.write([ 'cmd-content', 'subdir', '#hash.txt' ], 'hash.txt 1\n')
test.write('junk.txt', 'junk.txt\n')
test.run(arguments=".", stderr=None)
-test.must_match('tstamp.out', 'stuff\n')
-test.must_match('content.out', 'stuff\n')
-test.must_match('cmd-tstamp.out', 'stuff\n')
-test.must_match('cmd-content.out', 'stuff\n')
-test.must_match('cmd-tstamp-noscan.out', 'stuff\n')
-test.must_match('cmd-content-noscan.out', 'stuff\n')
+test.must_match('tstamp.out', 'stuff\n', mode='r')
+test.must_match('content.out', 'stuff\n', mode='r')
+test.must_match('cmd-tstamp.out', 'stuff\n', mode='r')
+test.must_match('cmd-content.out', 'stuff\n', mode='r')
+test.must_match('cmd-tstamp-noscan.out', 'stuff\n', mode='r')
+test.must_match('cmd-content-noscan.out', 'stuff\n', mode='r')
test.up_to_date(arguments='tstamp.out')
test.up_to_date(arguments='content.out')
diff --git a/test/ENV.py b/test/ENV.py
index dc97ec82..59b1cdb2 100644
--- a/test/ENV.py
+++ b/test/ENV.py
@@ -50,16 +50,16 @@ test.write('build.py',
r"""#!/usr/bin/env python
import os
import sys
-contents = open(sys.argv[2], 'rb').read()
-open(sys.argv[1], 'wb').write("build.py %s\n%s" % (os.environ['X'], contents))
+contents = open(sys.argv[2], 'r').read()
+open(sys.argv[1], 'w').write("build.py %s\n%s" % (os.environ['X'], contents))
""")
test.write('input', "input file\n")
test.run(arguments = '.')
-test.fail_test(test.read('env1.out') != "build.py env1\ninput file\n")
-test.fail_test(test.read('env2.out') != "build.py env2\ninput file\n")
+test.must_match('env1.out', "build.py env1\ninput file\n", mode='r')
+test.must_match('env2.out', "build.py env2\ninput file\n", mode='r')
test.write('SConstruct', """
@@ -71,9 +71,10 @@ env['ENV']['FOO'] = foo
test.write('build.py',
r"""
+from __future__ import print_function
import os
-print 'LIST:', os.environ['LIST']
-print 'FOO:', os.environ['FOO']
+print('LIST:', os.environ['LIST'])
+print('FOO:', os.environ['FOO'])
""")
test.run()
diff --git a/test/Ghostscript/GSFLAGS.py b/test/Ghostscript/GSFLAGS.py
index c8e0668c..e1471fa0 100644
--- a/test/Ghostscript/GSFLAGS.py
+++ b/test/Ghostscript/GSFLAGS.py
@@ -44,10 +44,10 @@ opt_string = ''
for opt, arg in cmd_opts:
if opt == '-s':
if arg[:11] == 'OutputFile=':
- out_file = open(arg[11:], 'wb')
+ out_file = open(arg[11:], 'w')
else:
opt_string = opt_string + ' ' + opt
-infile = open(args[0], 'rb')
+infile = open(args[0], 'r')
out_file.write(opt_string + "\n")
for l in infile.readlines():
if l[:3] != '#ps':
@@ -68,7 +68,7 @@ This is a .ps test.
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read('test1.pdf') != " -x\nThis is a .ps test.\n")
+test.must_match('test1.pdf', " -x\nThis is a .ps test.\n", mode='r')
diff --git a/test/HeaderGen.py b/test/HeaderGen.py
index 5a7fdbe0..2763b342 100644
--- a/test/HeaderGen.py
+++ b/test/HeaderGen.py
@@ -35,7 +35,7 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """\
def writeFile(target, contents):
- file = open(str(target[0]), 'wb')
+ file = open(str(target[0]), 'w')
file.write(contents)
file.close()
return 0
@@ -60,8 +60,8 @@ test.write('SConstruct', """\
env = Environment()
def gen_a_h(target, source, env):
- t = open(str(target[0]), 'wb')
- s = open(str(source[0]), 'rb')
+ t = open(str(target[0]), 'w')
+ s = open(str(source[0]), 'r')
s.readline()
t.write(s.readline()[:-1] + ';\\n')
diff --git a/test/IDL/MIDLCOM.py b/test/IDL/MIDLCOM.py
index 05255923..a478da00 100644
--- a/test/IDL/MIDLCOM.py
+++ b/test/IDL/MIDLCOM.py
@@ -39,12 +39,12 @@ test = TestSCons.TestSCons()
test.write('mymidl.py', """
import os.path
import sys
-out_tlb = open(sys.argv[1], 'wb')
+out_tlb = open(sys.argv[1], 'w')
base = os.path.splitext(sys.argv[1])[0]
-out_h = open(base + '.h', 'wb')
-out_c = open(base + '_i.c', 'wb')
+out_h = open(base + '.h', 'w')
+out_c = open(base + '_i.c', 'w')
for f in sys.argv[2:]:
- infile = open(f, 'rb')
+ infile = open(f, 'r')
for l in [l for l in infile.readlines() if l != '/*midl*/\\n']:
out_tlb.write(l)
out_h.write(l)
@@ -62,9 +62,9 @@ test.write('aaa.idl', "aaa.idl\n/*midl*/\n")
test.run(arguments = '.')
-test.must_match('aaa.tlb', "aaa.idl\n")
-test.must_match('aaa.h', "aaa.idl\n")
-test.must_match('aaa_i.c', "aaa.idl\n")
+test.must_match('aaa.tlb', "aaa.idl\n", mode='r')
+test.must_match('aaa.h', "aaa.idl\n", mode='r')
+test.must_match('aaa_i.c', "aaa.idl\n", mode='r')
test.up_to_date(options = '--debug=explain', arguments = 'aaa.tlb')
diff --git a/test/Install/Install.py b/test/Install/Install.py
index d66660ba..d039d78c 100644
--- a/test/Install/Install.py
+++ b/test/Install/Install.py
@@ -50,15 +50,15 @@ _SUBDIR_f4_out = os.path.join('$SUBDIR', 'f4.out')
test.write(['work', 'SConstruct'], """\
def cat(env, source, target):
target = str(target[0])
- f = open(target, "wb")
+ f = open(target, "w")
for src in source:
- f.write(open(str(src), "rb").read())
+ f.write(open(str(src), "r").read())
f.close()
def my_install(dest, source, env):
import shutil
shutil.copy2(source, dest)
- open('my_install.out', 'ab').write(dest)
+ open('my_install.out', 'a').write(dest)
env1 = Environment()
env1.Append(BUILDERS={'Cat':Builder(action=cat)})
@@ -122,7 +122,7 @@ test.fail_test(oldtime1 == os.path.getmtime(f1_out))
test.fail_test(oldtime2 != os.path.getmtime(f2_out))
# Verify that we didn't link to the Installed file.
-open(f2_out, 'wb').write("xyzzy\n")
+open(f2_out, 'w').write("xyzzy\n")
test.must_match(['work', 'f2.out'], "f2.in\n")
# Verify that scons prints an error message
diff --git a/test/Interactive/shell.py b/test/Interactive/shell.py
index 842a12e5..40df86fa 100644
--- a/test/Interactive/shell.py
+++ b/test/Interactive/shell.py
@@ -40,7 +40,9 @@ shell_command_py = test.workpath('shell_command.py')
_shell_command_py_ = '"%s"' % shell_command_py.replace('\\', '\\\\')
test.write(shell_command_py, """\
-print 'hello from shell_command.py'
+from __future__ import print_function
+
+print('hello from shell_command.py')
""")
test.write('SConstruct', """\
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index 98dfa38a..476bfcda 100644
--- a/test/Java/JAR.py
+++ b/test/Java/JAR.py
@@ -43,9 +43,9 @@ while args:
else:
break
args = args[1:]
-outfile = open(out, 'wb')
+outfile = open(out, 'w')
for file in args:
- infile = open(file, 'rb')
+ infile = open(file, 'r')
for l in infile.readlines():
if l[:7] != '/*jar*/':
outfile.write(l)
@@ -64,9 +64,9 @@ test1.class
line 3
""")
-test.run(arguments = '.', stderr = None)
+test.run(arguments='.', stderr=None)
-test.must_match('test1.jar', "test1.class\nline 3\n")
+test.must_match('test1.jar', "test1.class\nline 3\n", mode='r')
if os.path.normcase('.class') == os.path.normcase('.CLASS'):
@@ -82,13 +82,13 @@ test2.CLASS
line 3
""")
- test.run(arguments = '.', stderr = None)
+ test.run(arguments='.', stderr=None)
- test.must_match('test2.jar', "test2.CLASS\nline 3\n")
+ test.must_match('test2.jar', "test2.CLASS\nline 3\n", mode='r')
test.write('myjar2.py', r"""
import sys
-f=open(sys.argv[2], 'wb')
+f=open(sys.argv[2], 'w')
f.write(" ".join(sys.argv[1:]))
f.write("\n")
f.close()
@@ -106,7 +106,7 @@ env.Jar(target = 'classes.jar', source = [ 'testdir/bar.class',
""" % locals())
test.subdir('testdir')
-test.write([ 'testdir', 'bar.class' ], 'foo')
+test.write(['testdir', 'bar.class'], 'foo')
test.write('foo.mf',
"""Manifest-Version : 1.0
blah
@@ -115,7 +115,7 @@ test.write('foo.mf',
""")
test.run(arguments='classes.jar')
test.must_match('classes.jar',
- 'cvfm classes.jar foo.mf -C testdir bar.class\n')
+ 'cvfm classes.jar foo.mf -C testdir bar.class\n', mode='r')
@@ -124,14 +124,14 @@ where_jar = test.java_where_jar()
-test.file_fixture('wrapper.py')
+test.file_fixture('wrapper_with_args.py')
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'jar'],
JAVAC = r'%(where_javac)s',
JAR = r'%(where_jar)s')
jar = foo.Dictionary('JAR')
-bar = foo.Clone(JAR = r'%(_python_)s wrapper.py ' + jar)
+bar = foo.Clone(JAR = r'%(_python_)s wrapper_with_args.py ' + jar)
foo.Java(target = 'classes', source = 'com/sub/foo')
bar.Java(target = 'classes', source = 'com/sub/bar')
foo.Jar(target = 'foo', source = 'classes/com/sub/foo')
@@ -229,10 +229,10 @@ public class Example6
test.run(arguments = '.')
-expected_wrapper_out = "wrapper.py %(where_jar)s cf bar.jar classes/com/sub/bar\n"
+expected_wrapper_out = "wrapper_with_args.py %(where_jar)s cf bar.jar classes/com/sub/bar\n"
expected_wrapper_out = expected_wrapper_out.replace('/', os.sep)
test.must_match('wrapper.out',
- expected_wrapper_out % locals())
+ expected_wrapper_out % locals(), mode='r')
test.must_exist('foo.jar')
test.must_exist('bar.jar')
diff --git a/test/Java/JAVAC.py b/test/Java/JAVAC.py
index 06b19697..aaaa8f5d 100644
--- a/test/Java/JAVAC.py
+++ b/test/Java/JAVAC.py
@@ -51,8 +51,8 @@ while args:
break
args = args[1:]
for file in args:
- infile = open(file, 'rb')
- outfile = open(file[:-5] + '.class', 'wb')
+ infile = open(file, 'r')
+ outfile = open(file[:-5] + '.class', 'w')
for l in infile.readlines():
if l[:9] != '/*javac*/':
outfile.write(l)
@@ -71,9 +71,9 @@ test1.java
line 3
""")
-test.run(arguments = '.', stderr = None)
+test.run(arguments='.', stderr=None)
-test.must_match('test1.class', "test1.java\nline 3\n")
+test.must_match('test1.class', "test1.java\nline 3\n", mode='r')
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
@@ -89,9 +89,9 @@ test2.JAVA
line 3
""")
- test.run(arguments = '.', stderr = None)
+ test.run(arguments='.', stderr=None)
- test.must_match('test2.class', "test2.JAVA\nline 3\n")
+ test.must_match('test2.class', "test2.JAVA\nline 3\n", mode='r')
diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py
index f647b030..f07ebb9d 100644
--- a/test/Java/JAVAH.py
+++ b/test/Java/JAVAH.py
@@ -41,7 +41,7 @@ while args:
outdir = args[1]
args = args[1:]
elif a == '-o':
- outfile = open(args[1], 'wb')
+ outfile = open(args[1], 'w')
args = args[1:]
elif a == '-classpath':
args = args[1:]
@@ -51,7 +51,7 @@ while args:
break
args = args[1:]
for file in args:
- infile = open(file, 'rb')
+ infile = open(file, 'r')
for l in infile.readlines():
if l[:9] != '/*javah*/':
outfile.write(l)
@@ -70,9 +70,9 @@ test1.java
line 3
""")
-test.run(arguments = '.', stderr = None)
+test.run(arguments='.', stderr=None)
-test.must_match('test1.h', "test1.java\nline 3\n")
+test.must_match('test1.h', "test1.java\nline 3\n", mode='r')
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
@@ -88,9 +88,9 @@ test2.JAVA
line 3
""")
- test.run(arguments = '.', stderr = None)
+ test.run(arguments='.', stderr=None)
- test.must_match('test2.h', "test2.JAVA\nline 3\n")
+ test.must_match('test2.h', "test2.JAVA\nline 3\n", mode='r')
where_javac, java_version = test.java_where_javac()
@@ -105,7 +105,7 @@ if java_version:
if test.javac_is_gcj:
test.skip_test('Test not valid for gcj (gnu java); skipping test(s).\n')
-test.file_fixture('wrapper.py')
+test.file_fixture('wrapper_with_args.py')
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'javah', 'install'],
@@ -115,7 +115,7 @@ jv = %(java_version)s
if jv:
foo['JAVAVERSION'] = jv
javah = foo.Dictionary('JAVAH')
-bar = foo.Clone(JAVAH = r'%(_python_)s wrapper.py ' + javah)
+bar = foo.Clone(JAVAH = r'%(_python_)s wrapper_with_args.py ' + javah)
foo.Java(target = 'class1', source = 'com/sub/foo')
bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar')
foo_classes = foo.Java(target = 'class3', source = 'src')
@@ -282,7 +282,8 @@ class Private {
test.run(arguments = '.')
-test.fail_test(test.read('wrapper.out') != "wrapper.py %(where_javah)s -d outdir2 -classpath class2 com.sub.bar.Example4 com.other.Example5 com.sub.bar.Example6\n" % locals())
+test.must_match('wrapper.out', "wrapper_with_args.py %(where_javah)s -d outdir2 -classpath class2 com.sub.bar.Example4 com.other.Example5 com.sub.bar.Example6\n" % locals(),
+ mode='r')
test.must_exist(['outdir1', 'com_sub_foo_Example1.h'])
test.must_exist(['outdir1', 'com_other_Example2.h'])
diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py
index 5f5decd4..b29a466f 100644
--- a/test/Java/RMIC.py
+++ b/test/Java/RMIC.py
@@ -49,8 +49,8 @@ while args:
break
args = args[1:]
for file in args:
- infile = open(file, 'rb')
- outfile = open(os.path.join(outdir, file[:-5] + '.class'), 'wb')
+ infile = open(file, 'r')
+ outfile = open(os.path.join(outdir, file[:-5] + '.class'), 'w')
for l in infile.readlines():
if l[:8] != '/*rmic*/':
outfile.write(l)
@@ -71,7 +71,7 @@ line 3
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read(['outdir', 'test1.class']) != "test1.java\nline 3\n")
+test.must_match(['outdir', 'test1.class'], "test1.java\nline 3\n", mode='r')
if os.path.normcase('.java') == os.path.normcase('.JAVA'):
@@ -89,7 +89,7 @@ line 3
test.run(arguments = '.', stderr = None)
- test.fail_test(test.read(['outdir', 'test2.class']) != "test2.JAVA\nline 3\n")
+ test.must_match(['outdir', 'test2.class'], "test2.JAVA\nline 3\n", mode='r')
where_javac, java_version = test.java_where_javac()
where_rmic = test.java_where_rmic()
@@ -111,7 +111,7 @@ if java_version.count('.') == 1:
# Note, how we allow simple version strings like "5" and
# "6" to successfully pass this test.
if curver < (1, 8):
- test.file_fixture('wrapper.py')
+ test.file_fixture('wrapper_with_args.py')
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'rmic'],
@@ -124,7 +124,7 @@ foo.RMIC(target = 'outdir1',
JAVACLASSDIR = 'class1')
rmic = foo.Dictionary('RMIC')
-bar = foo.Clone(RMIC = r'%(_python_)s wrapper.py ' + rmic)
+bar = foo.Clone(RMIC = r'%(_python_)s wrapper_with_args.py ' + rmic)
bar_classes = bar.Java(target = 'class2', source = 'com/sub/bar')
# XXX This is kind of a Python brute-force way to do what Ant
# does with its "excludes" attribute. We should probably find
@@ -321,7 +321,9 @@ public class Example4 extends UnicastRemoteObject implements Hello {
test.run(arguments = '.')
- test.fail_test(test.read('wrapper.out') != "wrapper.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic)
+ test.must_match('wrapper.out',
+ "wrapper_with_args.py %s -d outdir2 -classpath class2 com.sub.bar.Example3 com.sub.bar.Example4\n" % where_rmic,
+ mode='r')
test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example1_Stub.class'))
test.must_exist(test.workpath('outdir1', 'com', 'sub', 'foo', 'Example2_Stub.class'))
diff --git a/test/MSVC/batch.py b/test/MSVC/batch.py
index 86482926..8b7945b4 100644
--- a/test/MSVC/batch.py
+++ b/test/MSVC/batch.py
@@ -55,20 +55,20 @@ else:
# Delay writing the .log output until here so any trailing slash or
# backslash has been stripped, and the output comparisons later in this
# script don't have to account for the difference.
-open('fake_cl.log', 'ab').write(" ".join(sys.argv[1:]) + '\\n')
+open('fake_cl.log', 'a').write(" ".join(sys.argv[1:]) + '\\n')
for infile in input_files:
if dir:
outfile = os.path.join(dir, infile.replace('.c', '.obj'))
else:
outfile = output
- open(outfile, 'wb').write(open(infile, 'rb').read())
+ open(outfile, 'w').write(open(infile, 'r').read())
""")
test.write('fake_link.py', """\
import sys
-ofp = open(sys.argv[1], 'wb')
+ofp = open(sys.argv[1], 'w')
for infile in sys.argv[2:]:
- ofp.write(open(infile, 'rb').read())
+ ofp.write(open(infile, 'r').read())
""")
test.write('SConstruct', """
@@ -94,10 +94,10 @@ test.write('f2.c', "f2.c\n")
test.run(arguments = 'MSVC_BATCH=1 .')
-test.must_match('prog.exe', "prog.c\nf1.c\nf2.c\n")
+test.must_match('prog.exe', "prog.c\nf1.c\nf2.c\n", mode='r')
test.must_match('fake_cl.log', """\
/Fo. prog.c f1.c f2.c
-""")
+""", mode='r')
test.up_to_date(options = 'MSVC_BATCH=1', arguments = '.')
@@ -107,11 +107,11 @@ test.write('f1.c', "f1.c 2\n")
test.run(arguments = 'MSVC_BATCH=1 .')
-test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n")
+test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n", mode='r')
test.must_match('fake_cl.log', """\
/Fo. prog.c f1.c f2.c
/Fo. f1.c
-""")
+""", mode='r')
test.up_to_date(options = 'MSVC_BATCH=1', arguments = '.')
@@ -125,12 +125,12 @@ test.unlink('fake_cl.log')
test.run(arguments = '. MSVC_BATCH=0')
-test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n")
+test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n", mode='r')
test.must_match('fake_cl.log', """\
/Fof1.obj f1.c
/Fof2.obj f2.c
/Foprog.obj prog.c
-""")
+""", mode='r')
test.run(arguments = '-c .')
test.unlink('fake_cl.log')
@@ -138,12 +138,12 @@ test.unlink('fake_cl.log')
test.run(arguments = '. MSVC_BATCH=False')
-test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n")
+test.must_match('prog.exe', "prog.c\nf1.c 2\nf2.c\n", mode='r')
test.must_match('fake_cl.log', """\
/Fof1.obj f1.c
/Fof2.obj f2.c
/Foprog.obj prog.c
-""")
+""", mode='r')
@@ -151,13 +151,13 @@ test.write('f1.c', "f1.c 3\n")
test.run(arguments = '. MSVC_BATCH=0')
-test.must_match('prog.exe', "prog.c\nf1.c 3\nf2.c\n")
+test.must_match('prog.exe', "prog.c\nf1.c 3\nf2.c\n", mode='r')
test.must_match('fake_cl.log', """\
/Fof1.obj f1.c
/Fof2.obj f2.c
/Foprog.obj prog.c
/Fof1.obj f1.c
-""")
+""", mode='r')
diff --git a/test/MSVC/embed-manifest.py b/test/MSVC/embed-manifest.py
index 13f1defb..c0f84083 100644
--- a/test/MSVC/embed-manifest.py
+++ b/test/MSVC/embed-manifest.py
@@ -76,14 +76,14 @@ testdll(int argc, char *argv)
}
""")
-test.run(arguments = '.')
+test.run(arguments='.')
test.must_exist('test%s' % _exe)
test.must_exist('test%s.manifest' % _exe)
-test.must_contain('exe-extracted.manifest', '</assembly>')
+test.must_contain('exe-extracted.manifest', '</assembly>', mode='r')
test.must_exist('testdll%s' % _dll)
test.must_exist('testdll%s.manifest' % _dll)
-test.must_contain('dll-extracted.manifest', '</assembly>')
+test.must_contain('dll-extracted.manifest', '</assembly>', mode='r')
test.pass_test()
diff --git a/test/MSVC/generate-rc.py b/test/MSVC/generate-rc.py
index 40ef95e0..00e90902 100644
--- a/test/MSVC/generate-rc.py
+++ b/test/MSVC/generate-rc.py
@@ -39,15 +39,15 @@ fake_rc = test.workpath('fake_rc.py')
test.write(fake_rc, """\
import sys
-contents = open(sys.argv[2], 'rb').read()
-open(sys.argv[1], 'wb').write("fake_rc.py\\n" + contents)
+contents = open(sys.argv[2], 'r').read()
+open(sys.argv[1], 'w').write("fake_rc.py\\n" + contents)
""")
test.write('SConstruct', """
def generate_rc(target, source, env):
t = str(target[0])
s = str(source[0])
- tfp = open(t, 'wb')
+ tfp = open(t, 'w')
tfp.write('generate_rc\\n' + open(s, 'r').read())
env = Environment(tools=['msvc'],
@@ -64,8 +64,8 @@ test.write('my.in', "my.in\n")
test.run(arguments = '.')
-test.must_match('my.rc', "generate_rc\nmy.in\n")
-test.must_match('my.res', "fake_rc.py\ngenerate_rc\nmy.in\n")
+test.must_match('my.rc', "generate_rc\nmy.in\n", mode='r')
+test.must_match('my.res', "fake_rc.py\ngenerate_rc\nmy.in\n", mode='r')
test.pass_test()
diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py
index a70ed67f..838922cf 100644
--- a/test/MSVC/msvc.py
+++ b/test/MSVC/msvc.py
@@ -43,6 +43,7 @@ test.skip_if_not_msvc()
test.write('SConstruct',"""
import os
+DefaultEnvironment(tools=[])
# TODO: this is order-dependent (putting 'mssdk' second or third breaks),
# and ideally we shouldn't need to specify the tools= list anyway.
env = Environment(tools=['mssdk', 'msvc', 'mslink'])
@@ -179,6 +180,8 @@ start = time.time()
test.run(arguments='slow.obj', stderr=None)
slow = time.time() - start
+
+# TODO: Reevaluate if having this part of the test makes sense any longer
# using precompiled headers should be faster
limit = slow*0.90
if fast >= limit:
diff --git a/test/Parallel/ref_count.py b/test/Parallel/ref_count.py
index ce59668c..7ce59109 100644
--- a/test/Parallel/ref_count.py
+++ b/test/Parallel/ref_count.py
@@ -74,9 +74,9 @@ while args:
time.sleep(int(args.pop(0)))
contents = ''
for ifile in args:
- contents = contents + open(ifile, 'rb').read()
+ contents = contents + open(ifile, 'r').read()
for ofile in outputs:
- ofp = open(ofile, 'wb')
+ ofp = open(ofile, 'w')
ofp.write('%s: building from %s\\n' % (ofile, " ".join(args)))
ofp.write(contents)
ofp.close()
@@ -136,7 +136,7 @@ test.run(arguments = '-j4 after.out')
test.must_match('after.out', """\
after.out: building from after.in
after.in
-""")
+""", mode='r')
test.write('file5.c', "file5.c modified\n")
@@ -147,7 +147,7 @@ test.run(arguments = '-j4 after.out')
test.must_match('after.out', """\
after.out: building from after.in
after.in modified
-""")
+""", mode='r')
test.pass_test()
diff --git a/test/RANLIB/RANLIBFLAGS.py b/test/RANLIB/RANLIBFLAGS.py
index e13bac89..93a5abf3 100644
--- a/test/RANLIB/RANLIBFLAGS.py
+++ b/test/RANLIB/RANLIBFLAGS.py
@@ -101,7 +101,7 @@ test.run(arguments = 'b' + _exe,
stderr=TestSCons.noisy_ar,
match=TestSCons.match_re_dotall)
-test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+test.must_match('wrapper.out', "wrapper.py\n", mode='r')
test.pass_test()
diff --git a/test/Repository/Default.py b/test/Repository/Default.py
index 44aecfb4..bd9d5f88 100644
--- a/test/Repository/Default.py
+++ b/test/Repository/Default.py
@@ -47,7 +47,7 @@ def copy(env, source, target):
source = str(source[0])
target = str(target[0])
print('copy() < %s > %s' % (source, target))
- open(target, "wb").write(open(source, "rb").read())
+ open(target, "w").write(open(source, "r").read())
Build = Builder(action=copy)
env = Environment(BUILDERS={'Build':Build})
@@ -80,19 +80,19 @@ test.writable('repository', 0)
test.run(chdir = 'work', options = opts, arguments = '')
test.fail_test(os.path.exists(work_aaa_out))
-test.fail_test(test.read(work_bbb_out) != "repository/bbb.in\n")
+test.must_match(work_bbb_out, "repository/bbb.in\n", mode='r')
test.fail_test(os.path.exists(work_ccc_out))
test.fail_test(os.path.exists(work_subdir_ddd_out))
-test.fail_test(test.read(work_subdir_eee_out) != "repository/subdir/eee.in\n")
+test.must_match(work_subdir_eee_out, "repository/subdir/eee.in\n", mode='r')
test.fail_test(os.path.exists(work_subdir_fff_out))
#
test.run(chdir = 'work', options = opts, arguments = '.')
-test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n")
-test.fail_test(test.read(work_ccc_out) != "repository/ccc.in\n")
-test.fail_test(test.read(work_subdir_ddd_out) != "repository/subdir/ddd.in\n")
-test.fail_test(test.read(work_subdir_fff_out) != "repository/subdir/fff.in\n")
+test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r')
+test.must_match(work_ccc_out, "repository/ccc.in\n", mode='r')
+test.must_match(work_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r')
+test.must_match(work_subdir_fff_out, "repository/subdir/fff.in\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = '.')
diff --git a/test/Repository/Install-Local.py b/test/Repository/Install-Local.py
index 36310438..fe64feb6 100644
--- a/test/Repository/Install-Local.py
+++ b/test/Repository/Install-Local.py
@@ -51,8 +51,8 @@ test.write(['repository', 'file2'], "repository/file2\n")
test.run(chdir = 'repository', options = opts, arguments = 'install')
-test.fail_test(test.read(repository_install_file1) != "repository/file1\n")
-test.fail_test(test.read(repository_install_file2) != "repository/file2\n")
+test.must_match(repository_install_file1, "repository/file1\n", mode='r')
+test.must_match(repository_install_file2, "repository/file2\n", mode='r')
test.up_to_date(chdir = 'repository', options = opts, arguments = 'install')
@@ -62,8 +62,8 @@ test.writable('repository', 0)
test.run(chdir = 'work', options = opts, arguments = 'install')
-test.fail_test(test.read(work_install_file1) != "repository/file1\n")
-test.fail_test(test.read(work_install_file2) != "repository/file2\n")
+test.must_match(work_install_file1, "repository/file1\n", mode='r')
+test.must_match(work_install_file2, "repository/file2\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = 'install')
@@ -73,8 +73,8 @@ test.write(['work', 'file2'], "work/file2\n")
test.run(chdir = 'work', options = opts, arguments = 'install')
-test.fail_test(test.read(work_install_file1) != "work/file1\n")
-test.fail_test(test.read(work_install_file2) != "work/file2\n")
+test.must_match(work_install_file1, "work/file1\n", mode='r')
+test.must_match(work_install_file2, "work/file2\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = 'install')
diff --git a/test/Repository/Install.py b/test/Repository/Install.py
index 5e64d55d..75052e78 100644
--- a/test/Repository/Install.py
+++ b/test/Repository/Install.py
@@ -51,7 +51,7 @@ test.writable('repository', 0)
test.run(chdir = 'work', options = opts, arguments = install)
-test.fail_test(test.read(install_file) != "repository/file\n")
+test.must_match(install_file, "repository/file\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = install)
diff --git a/test/Repository/InstallAs.py b/test/Repository/InstallAs.py
index 0923d887..d717254d 100644
--- a/test/Repository/InstallAs.py
+++ b/test/Repository/InstallAs.py
@@ -56,9 +56,9 @@ test.writable('repository', 0)
test.run(chdir = 'work', options = opts, arguments = install)
-test.fail_test(test.read(install_file1_out) != "repository/file1.in\n")
-test.fail_test(test.read(install_file2_out) != "repository/file2.in\n")
-test.fail_test(test.read(install_file3_out) != "repository/file3.in\n")
+test.must_match(install_file1_out, "repository/file1.in\n", mode='r')
+test.must_match(install_file2_out, "repository/file2.in\n", mode='r')
+test.must_match(install_file3_out, "repository/file3.in\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = install)
diff --git a/test/Repository/LIBPATH.py b/test/Repository/LIBPATH.py
index c95d29a1..8b396fa0 100644
--- a/test/Repository/LIBPATH.py
+++ b/test/Repository/LIBPATH.py
@@ -46,7 +46,7 @@ bbb_exe = env_yyy.Program('bbb', 'bbb.c')
def write_LIBDIRFLAGS(env, target, source):
pre = env.subst('$LIBDIRPREFIX')
suf = env.subst('$LIBDIRSUFFIX')
- f = open(str(target[0]), 'wb')
+ f = open(str(target[0]), 'w')
for arg in env.subst('$_LIBDIRFLAGS', target=target).split():
if arg[:len(pre)] == pre:
arg = arg[len(pre):]
@@ -97,14 +97,12 @@ test.run(chdir = 'work', options = opts, arguments = ".")
#dirs = ['.', workpath_foo, workpath_bar, workpath_foo_zzz]
dirs = ['.', workpath_foo, workpath_bar,
'zzz', workpath_foo_zzz, workpath_bar_zzz]
-test.fail_test(test.read(['work', 'zzz.out']) !=
- '\n'.join(dirs) + '\n')
+test.must_match(['work', 'zzz.out'],'\n'.join(dirs) + '\n', mode='r')
#dirs = [workpath_bar_yyy, '.', workpath_foo, workpath_bar]
dirs = ['yyy', workpath_foo_yyy, workpath_bar_yyy,
'.', workpath_foo, workpath_bar]
-test.fail_test(test.read(['work', 'yyy.out']) !=
- '\n'.join(dirs) + '\n')
+test.must_match(['work', 'yyy.out'], '\n'.join(dirs) + '\n', mode='r')
#
test.run(chdir = 'work', options = '-c', arguments = ".")
@@ -117,14 +115,12 @@ test.run(chdir = 'work', options = opts, arguments = ".")
#dirs = ['.', workpath_foo, workpath_bar, 'zzz', workpath_foo_zzz]
dirs = ['.', workpath_foo, workpath_bar,
'zzz', workpath_foo_zzz, workpath_bar_zzz]
-test.fail_test(test.read(['work', 'zzz.out']) !=
- '\n'.join(dirs) + '\n')
+test.must_match(['work', 'zzz.out'], '\n'.join(dirs) + '\n', mode='r')
#dirs = ['yyy', workpath_bar_yyy, '.', workpath_foo, workpath_bar]
dirs = ['yyy', workpath_foo_yyy, workpath_bar_yyy,
'.', workpath_foo, workpath_bar]
-test.fail_test(test.read(['work', 'yyy.out']) !=
- '\n'.join(dirs) + '\n')
+test.must_match(['work', 'yyy.out'], '\n'.join(dirs) + '\n', mode='r')
#
test.pass_test()
diff --git a/test/Repository/Local.py b/test/Repository/Local.py
index ea03281e..95fd8987 100644
--- a/test/Repository/Local.py
+++ b/test/Repository/Local.py
@@ -49,7 +49,7 @@ def copy(env, source, target):
source = str(source[0])
target = str(target[0])
print('copy() < %s > %s' % (source, target))
- open(target, "wb").write(open(source, "rb").read())
+ open(target, "w").write(open(source, "r").read())
Build = Builder(action=copy)
env = Environment(BUILDERS={'Build':Build}, BBB='bbb')
@@ -66,7 +66,7 @@ test.write(['repository', 'src', 'SConscript'], r"""
def bbb_copy(env, source, target):
target = str(target[0])
print('bbb_copy()')
- open(target, "wb").write(open('build/bbb.1', "rb").read())
+ open(target, "w").write(open('build/bbb.1', "r").read())
Import("env")
env.Build('bbb.1', 'bbb.0')
@@ -82,8 +82,8 @@ test.write(['repository', 'src', 'bbb.x'], "repository/src/bbb.x\n")
#
test.run(chdir = 'repository', options = opts, arguments = '.')
-test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n")
-test.fail_test(test.read(repository_build_bbb_2) != "repository/src/bbb.0\n")
+test.must_match(repository_aaa_out, "repository/aaa.in\n", mode='r')
+test.must_match(repository_build_bbb_2, "repository/src/bbb.0\n", mode='r')
test.up_to_date(chdir = 'repository', options = opts, arguments = '.')
@@ -95,8 +95,8 @@ test.writable('repository', 0)
test.run(chdir = 'work', options = opts, arguments = 'aaa.out build/bbb.2')
test.fail_test(os.path.exists(work_aaa_mid))
-test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n")
-test.fail_test(test.read(work_build_bbb_1) != "repository/src/bbb.0\n")
+test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r')
+test.must_match(work_build_bbb_1, "repository/src/bbb.0\n", mode='r')
test.fail_test(os.path.exists(work_build_bbb_2))
#
@@ -105,8 +105,8 @@ test.write(['work', 'aaa.in'], "work/aaa.in\n")
#
test.run(chdir = 'work', options = opts, arguments = '.')
-test.fail_test(test.read(work_aaa_mid) != "work/aaa.in\n")
-test.fail_test(test.read(work_aaa_out) != "work/aaa.in\n")
+test.must_match(work_aaa_mid, "work/aaa.in\n", mode='r')
+test.must_match(work_aaa_out, "work/aaa.in\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = '.')
diff --git a/test/Repository/SConscript.py b/test/Repository/SConscript.py
index 22956acd..1b67c07d 100644
--- a/test/Repository/SConscript.py
+++ b/test/Repository/SConscript.py
@@ -61,9 +61,9 @@ SConscript('src/SConscript')
test.write(['rep1', 'src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
- f = open(target, "wb")
+ f = open(target, "w")
for src in source:
- f.write(open(str(src), "rb").read())
+ f.write(open(str(src), "r").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in'])
@@ -79,11 +79,11 @@ test.writable('rep1', 0)
test.run(chdir = 'work', arguments = ".")
-test.fail_test(test.read(['work', 'src', 'foo']) != """\
+test.must_match(['work', 'src', 'foo'], """\
rep1/src/aaa.in
rep1/src/bbb.in
rep1/src/ccc.in
-""")
+""", mode='r')
test.up_to_date(chdir = 'work', arguments = ".")
@@ -115,11 +115,11 @@ test.write(['rep2', 'src', 'ccc.in'], "rep2/src/ccc.in\n")
test.run(chdir = 'rep2/build', arguments = ".")
-test.fail_test(test.read(['rep2', 'build', 'src', 'foo']) != """\
+test.must_match(['rep2', 'build', 'src', 'foo'], """\
rep2/src/aaa.in
rep2/src/bbb.in
rep2/src/ccc.in
-""")
+""", mode='r')
#
test.pass_test()
diff --git a/test/Repository/VariantDir.py b/test/Repository/VariantDir.py
index 0258ff5e..8887f868 100644
--- a/test/Repository/VariantDir.py
+++ b/test/Repository/VariantDir.py
@@ -49,9 +49,9 @@ def cat(env, source, target):
target = str(target[0])
source = list(map(str, source))
print('cat(%s) > %s' % (source, target))
- f = open(target, "wb")
+ f = open(target, "w")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(src, "r").read())
f.close()
env = Environment(BUILDERS={'Build':Builder(action=cat)})
@@ -72,11 +72,11 @@ test.writable('repository', 0)
#
test.run(chdir = 'work1', options = opts, arguments = '.')
-test.fail_test(test.read(['work1', 'build0', 'output']) !=
+test.must_match(['work1', 'build0', 'output'],
"""repository/src/aaa.in
repository/src/bbb.in
repository/src/ccc.in
-""")
+""", mode='r')
test.fail_test(os.path.exists('work1/build0/aaa.in'))
test.fail_test(os.path.exists('work1/build0/bbb.in'))
@@ -85,11 +85,11 @@ test.fail_test(not os.path.exists('work1/build0/aaa.mid'))
test.fail_test(not os.path.exists('work1/build0/bbb.mid'))
test.fail_test(not os.path.exists('work1/build0/ccc.mid'))
-test.fail_test(test.read(['work1', 'build1', 'output']) !=
+test.must_match(['work1', 'build1', 'output'],
"""repository/src/aaa.in
repository/src/bbb.in
repository/src/ccc.in
-""")
+""", mode='r')
test.fail_test(not os.path.exists('work1/build1/aaa.in'))
test.fail_test(not os.path.exists('work1/build1/bbb.in'))
@@ -105,11 +105,11 @@ test.write(['work1', 'src', 'bbb.in'], "work1/src/bbb.in\n")
test.run(chdir = 'work1', options = opts, arguments = '.')
-test.fail_test(test.read(['work1', 'build0', 'output']) !=
+test.must_match(['work1', 'build0', 'output'],
"""repository/src/aaa.in
work1/src/bbb.in
repository/src/ccc.in
-""")
+""", mode='r')
test.fail_test(os.path.exists('work1/build0/aaa.in'))
test.fail_test(os.path.exists('work1/build0/bbb.in'))
@@ -118,11 +118,11 @@ test.fail_test(not os.path.exists('work1/build0/aaa.mid'))
test.fail_test(not os.path.exists('work1/build0/bbb.mid'))
test.fail_test(not os.path.exists('work1/build0/ccc.mid'))
-test.fail_test(test.read(['work1', 'build1', 'output']) !=
+test.must_match(['work1', 'build1', 'output'],
"""repository/src/aaa.in
work1/src/bbb.in
repository/src/ccc.in
-""")
+""", mode='r')
test.fail_test(not os.path.exists('work1/build1/aaa.in'))
test.fail_test(not os.path.exists('work1/build1/bbb.in'))
@@ -167,11 +167,11 @@ test.write(['work2', 'src', 'bbb.in'], "work2/src/bbb.in\n")
test.run(chdir = 'work2', options = opts, arguments = '.')
-test.fail_test(test.read(['work2', 'build0', 'output']) !=
+test.must_match(['work2', 'build0', 'output'],
"""repository/src/aaa.in
work2/src/bbb.in
repository/src/ccc.in
-""")
+""", mode='r')
test.fail_test(os.path.exists('work2/build0/aaa.in'))
test.fail_test(os.path.exists('work2/build0/bbb.in'))
@@ -180,11 +180,11 @@ test.fail_test(os.path.exists('work2/build0/aaa.mid'))
test.fail_test(not os.path.exists('work2/build0/bbb.mid'))
test.fail_test(os.path.exists('work2/build0/ccc.mid'))
-test.fail_test(test.read(['work2', 'build1', 'output']) !=
+test.must_match(['work2', 'build1', 'output'],
"""repository/src/aaa.in
work2/src/bbb.in
repository/src/ccc.in
-""")
+""", mode='r')
test.fail_test(not os.path.exists('work2/build1/aaa.in'))
test.fail_test(not os.path.exists('work2/build1/bbb.in'))
diff --git a/test/Repository/option-c.py b/test/Repository/option-c.py
index c06c7d8e..b0d85334 100644
--- a/test/Repository/option-c.py
+++ b/test/Repository/option-c.py
@@ -66,7 +66,7 @@ def copy(env, source, target):
source = str(source[0])
target = str(target[0])
print('copy() < %s > %s' % (source, target))
- open(target, "wb").write(open(source, "rb").read())
+ open(target, "w").write(open(source, "r").read())
Build = Builder(action=copy)
env = Environment(BUILDERS={'Build':Build})
@@ -100,14 +100,14 @@ test.writable('repository', 0)
# copying them from the Repository.
test.run(chdir = 'work', options = opts, arguments = '.')
-test.fail_test(test.read(work_aaa_mid) != "repository/aaa.in\n")
-test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n")
-test.fail_test(test.read(work_bbb_mid) != "repository/bbb.in\n")
-test.fail_test(test.read(work_bbb_out) != "repository/bbb.in\n")
-test.fail_test(test.read(work_subdir_ccc_mid) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(work_subdir_ccc_out) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(work_subdir_ddd_mid) != "repository/subdir/ddd.in\n")
-test.fail_test(test.read(work_subdir_ddd_out) != "repository/subdir/ddd.in\n")
+test.must_match(work_aaa_mid, "repository/aaa.in\n", mode='r')
+test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r')
+test.must_match(work_bbb_mid, "repository/bbb.in\n", mode='r')
+test.must_match(work_bbb_out, "repository/bbb.in\n", mode='r')
+test.must_match(work_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(work_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(work_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r')
+test.must_match(work_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r')
test.up_to_date(chdir = 'work', options = opts, arguments = '.')
@@ -117,14 +117,14 @@ test.writable('repository', 1)
# Now build everything in the repository.
test.run(chdir = 'repository', options = opts, arguments = '.')
-test.fail_test(test.read(repository_aaa_mid) != "repository/aaa.in\n")
-test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n")
-test.fail_test(test.read(repository_bbb_mid) != "repository/bbb.in\n")
-test.fail_test(test.read(repository_bbb_out) != "repository/bbb.in\n")
-test.fail_test(test.read(repository_subdir_ccc_mid) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(repository_subdir_ccc_out) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(repository_subdir_ddd_mid) != "repository/subdir/ddd.in\n")
-test.fail_test(test.read(repository_subdir_ddd_out) != "repository/subdir/ddd.in\n")
+test.must_match(repository_aaa_mid, "repository/aaa.in\n", mode='r')
+test.must_match(repository_aaa_out, "repository/aaa.in\n", mode='r')
+test.must_match(repository_bbb_mid, "repository/bbb.in\n", mode='r')
+test.must_match(repository_bbb_out, "repository/bbb.in\n", mode='r')
+test.must_match(repository_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(repository_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(repository_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r')
+test.must_match(repository_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r')
test.up_to_date(chdir = 'repository', options = opts, arguments = '.')
@@ -135,20 +135,20 @@ test.writable('repository', 0)
#
test.run(chdir = 'work', options = opts + ' -c', arguments = 'bbb.mid bbb.out')
-test.fail_test(test.read(work_aaa_mid) != "repository/aaa.in\n")
-test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n")
+test.must_match(work_aaa_mid, "repository/aaa.in\n", mode='r')
+test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r')
test.fail_test(os.path.exists(work_bbb_mid))
test.fail_test(os.path.exists(work_bbb_out))
-test.fail_test(test.read(work_subdir_ccc_mid) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(work_subdir_ccc_out) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(work_subdir_ddd_mid) != "repository/subdir/ddd.in\n")
-test.fail_test(test.read(work_subdir_ddd_out) != "repository/subdir/ddd.in\n")
+test.must_match(work_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(work_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(work_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r')
+test.must_match(work_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r')
#
test.run(chdir = 'work', options = opts + ' -c', arguments = 'subdir')
-test.fail_test(test.read(work_aaa_mid) != "repository/aaa.in\n")
-test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n")
+test.must_match(work_aaa_mid, "repository/aaa.in\n", mode='r')
+test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r')
test.fail_test(os.path.exists(work_bbb_mid))
test.fail_test(os.path.exists(work_bbb_out))
test.fail_test(os.path.exists(work_subdir_ccc_mid))
@@ -169,14 +169,14 @@ test.fail_test(os.path.exists(work_subdir_ddd_mid))
test.fail_test(os.path.exists(work_subdir_ddd_out))
# Double-check that nothing in the repository got deleted.
-test.fail_test(test.read(repository_aaa_mid) != "repository/aaa.in\n")
-test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n")
-test.fail_test(test.read(repository_bbb_mid) != "repository/bbb.in\n")
-test.fail_test(test.read(repository_bbb_out) != "repository/bbb.in\n")
-test.fail_test(test.read(repository_subdir_ccc_mid) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(repository_subdir_ccc_out) != "repository/subdir/ccc.in\n")
-test.fail_test(test.read(repository_subdir_ddd_mid) != "repository/subdir/ddd.in\n")
-test.fail_test(test.read(repository_subdir_ddd_out) != "repository/subdir/ddd.in\n")
+test.must_match(repository_aaa_mid, "repository/aaa.in\n", mode='r')
+test.must_match(repository_aaa_out, "repository/aaa.in\n", mode='r')
+test.must_match(repository_bbb_mid, "repository/bbb.in\n", mode='r')
+test.must_match(repository_bbb_out, "repository/bbb.in\n", mode='r')
+test.must_match(repository_subdir_ccc_mid, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(repository_subdir_ccc_out, "repository/subdir/ccc.in\n", mode='r')
+test.must_match(repository_subdir_ddd_mid, "repository/subdir/ddd.in\n", mode='r')
+test.must_match(repository_subdir_ddd_out, "repository/subdir/ddd.in\n", mode='r')
#
test.pass_test()
diff --git a/test/Repository/option-f.py b/test/Repository/option-f.py
index 8511f6ac..c990f2fe 100644
--- a/test/Repository/option-f.py
+++ b/test/Repository/option-f.py
@@ -76,7 +76,7 @@ test.writable('repository', 0)
#
test.run(chdir = 'work', options = opts, arguments = 'aaa.out')
-test.fail_test(test.read(['work', 'aaa.out']) != "repository/aaa.in\n")
+test.must_match(['work', 'aaa.out'], "repository/aaa.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('work', 'bbb.out')))
test.fail_test(os.path.exists(test.workpath('work', 'ccc.out')))
test.fail_test(os.path.exists(test.workpath('work', 'src', 'xxx.out')))
@@ -84,15 +84,15 @@ test.fail_test(os.path.exists(test.workpath('work', 'src', 'yyy.out')))
test.run(chdir = 'work', options = opts, arguments = 'bbb.out src')
-test.fail_test(test.read(['work', 'bbb.out']) != "repository/bbb.in\n")
+test.must_match(['work', 'bbb.out'], "repository/bbb.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('work', 'ccc.out')))
-test.fail_test(test.read(['work', 'src', 'xxx.out']) != "repository/src/xxx.in\n")
-test.fail_test(test.read(['work', 'src', 'yyy.out']) != "repository/src/yyy.in\n")
+test.must_match(['work', 'src', 'xxx.out'], "repository/src/xxx.in\n", mode='r')
+test.must_match(['work', 'src', 'yyy.out'], "repository/src/yyy.in\n", mode='r')
#
test.run(chdir = 'work', options = opts, arguments = '.')
-test.fail_test(test.read(['work', 'ccc.out']) != "repository/ccc.in\n")
+test.must_match(['work', 'ccc.out'], "repository/ccc.in\n", mode='r')
#
test.pass_test()
diff --git a/test/Repository/option-n.py b/test/Repository/option-n.py
index 2a0ae5d5..d23a200e 100644
--- a/test/Repository/option-n.py
+++ b/test/Repository/option-n.py
@@ -49,7 +49,7 @@ def copy(env, source, target):
source = str(source[0])
target = str(target[0])
print('copy() < %s > %s' % (source, target))
- open(target, "wb").write(open(source, "rb").read())
+ open(target, "w").write(open(source, "r").read())
Build = Builder(action=copy)
env = Environment(BUILDERS={'Build':Build})
@@ -62,7 +62,7 @@ test.write(['repository', 'aaa.in'], "repository/aaa.in\n")
#
test.run(chdir = 'repository', options = opts, arguments = '.')
-test.fail_test(test.read(repository_aaa_out) != "repository/aaa.in\n")
+test.must_match(repository_aaa_out,"repository/aaa.in\n", mode='r')
test.up_to_date(chdir = 'repository', options = opts, arguments = '.')
@@ -88,7 +88,7 @@ test.run(chdir = 'work',
arguments = 'aaa.out',
stdout = expect)
-test.fail_test(test.read(work_aaa_out) != "repository/aaa.in\n")
+test.must_match(work_aaa_out, "repository/aaa.in\n", mode='r')
#
test.pass_test()
diff --git a/test/Repository/targets.py b/test/Repository/targets.py
index 0fbc8964..0bc625a9 100644
--- a/test/Repository/targets.py
+++ b/test/Repository/targets.py
@@ -44,9 +44,9 @@ def cat(env, source, target):
target = str(target[0])
source = list(map(str, source))
print('cat(%s) > %s' % (source, target))
- f = open(target, "wb")
+ f = open(target, "w")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(src, "r").read())
f.close()
env = Environment(BUILDERS={'Build':Builder(action=cat)})
@@ -77,7 +77,7 @@ test.writable('repository', 0)
#
test.run(chdir = 'work', options = opts, arguments = 'aaa.out')
-test.fail_test(test.read(['work', 'aaa.out']) != "repository/aaa.in\n")
+test.must_match(['work', 'aaa.out'], "repository/aaa.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('work', 'bbb.out')))
test.fail_test(os.path.exists(test.workpath('work', 'ccc.out')))
test.fail_test(os.path.exists(test.workpath('work', 'src', 'xxx.out')))
@@ -85,15 +85,15 @@ test.fail_test(os.path.exists(test.workpath('work', 'src', 'yyy.out')))
test.run(chdir = 'work', options = opts, arguments = 'bbb.out src')
-test.fail_test(test.read(['work', 'bbb.out']) != "repository/bbb.in\n")
+test.must_match(['work', 'bbb.out'], "repository/bbb.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('work', 'ccc.out')))
-test.fail_test(test.read(['work', 'src', 'xxx.out']) != "repository/src/xxx.in\n")
-test.fail_test(test.read(['work', 'src', 'yyy.out']) != "repository/src/yyy.in\n")
+test.must_match(['work', 'src', 'xxx.out'], "repository/src/xxx.in\n", mode='r')
+test.must_match(['work', 'src', 'yyy.out'], "repository/src/yyy.in\n", mode='r')
#
test.run(chdir = 'work', options = opts, arguments = '.')
-test.fail_test(test.read(['work', 'ccc.out']) != "repository/ccc.in\n")
+test.must_match(['work', 'ccc.out'], "repository/ccc.in\n", mode='r')
#
test.pass_test()
diff --git a/test/Requires/eval-order.py b/test/Requires/eval-order.py
index 86002215..696b5e9d 100644
--- a/test/Requires/eval-order.py
+++ b/test/Requires/eval-order.py
@@ -53,10 +53,10 @@ test.write('prereq.in', "prereq.in 1\n")
# not, we'll get an error when the build action tries to use it to
# build file.out.
-test.run(arguments = 'file.out')
+test.run(arguments='file.out')
-test.must_match('prereq.out', "prereq.in 1\n")
-test.must_match('file.out', "file.in 1\n")
+test.must_match('prereq.out', "prereq.in 1\n", mode='r')
+test.must_match('file.out', "file.in 1\n", mode='r')
test.pass_test()
diff --git a/test/Rpcgen/RPCGEN.py b/test/Rpcgen/RPCGEN.py
index f79e18e7..2f793e28 100644
--- a/test/Rpcgen/RPCGEN.py
+++ b/test/Rpcgen/RPCGEN.py
@@ -26,10 +26,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
-_python_ = TestSCons._python_
-_exe = TestSCons._exe
+_python_=TestSCons._python_
+_exe=TestSCons._exe
-test = TestSCons.TestSCons()
+test=TestSCons.TestSCons()
@@ -68,10 +68,10 @@ expect_h = output % ('-h', test.workpath('rpcif.h'))
expect_svc = output % ('-m', test.workpath('rpcif_svc.c'))
expect_xdr = output % ('-c', test.workpath('rpcif_xdr.c'))
-test.must_match('rpcif_clnt.c', expect_clnt)
-test.must_match('rpcif.h', expect_h)
-test.must_match('rpcif_svc.c', expect_svc)
-test.must_match('rpcif_xdr.c', expect_xdr)
+test.must_match('rpcif_clnt.c', expect_clnt, mode='r')
+test.must_match('rpcif.h', expect_h, mode='r')
+test.must_match('rpcif_svc.c', expect_svc, mode='r')
+test.must_match('rpcif_xdr.c', expect_xdr, mode='r')
diff --git a/test/Rpcgen/RPCGENCLIENTFLAGS.py b/test/Rpcgen/RPCGENCLIENTFLAGS.py
index 9440d57f..96129527 100644
--- a/test/Rpcgen/RPCGENCLIENTFLAGS.py
+++ b/test/Rpcgen/RPCGENCLIENTFLAGS.py
@@ -71,10 +71,10 @@ expect_h = output % ('-h', test.workpath('rpcif.h'))
expect_svc = output % ('-m', test.workpath('rpcif_svc.c'))
expect_xdr = output % ('-c', test.workpath('rpcif_xdr.c'))
-test.must_match('rpcif_clnt.c', expect_clnt)
-test.must_match('rpcif.h', expect_h)
-test.must_match('rpcif_svc.c', expect_svc)
-test.must_match('rpcif_xdr.c', expect_xdr)
+test.must_match('rpcif_clnt.c', expect_clnt, mode='r')
+test.must_match('rpcif.h', expect_h, mode='r')
+test.must_match('rpcif_svc.c', expect_svc, mode='r')
+test.must_match('rpcif_xdr.c', expect_xdr, mode='r')
diff --git a/test/Rpcgen/RPCGENFLAGS.py b/test/Rpcgen/RPCGENFLAGS.py
index b94ffe51..d4be92c4 100644
--- a/test/Rpcgen/RPCGENFLAGS.py
+++ b/test/Rpcgen/RPCGENFLAGS.py
@@ -70,10 +70,10 @@ expect_h = output % ('-h', test.workpath('rpcif.h'))
expect_svc = output % ('-m', test.workpath('rpcif_svc.c'))
expect_xdr = output % ('-c', test.workpath('rpcif_xdr.c'))
-test.must_match('rpcif_clnt.c', expect_clnt)
-test.must_match('rpcif.h', expect_h)
-test.must_match('rpcif_svc.c', expect_svc)
-test.must_match('rpcif_xdr.c', expect_xdr)
+test.must_match('rpcif_clnt.c', expect_clnt, mode='r')
+test.must_match('rpcif.h', expect_h, mode='r')
+test.must_match('rpcif_svc.c', expect_svc, mode='r')
+test.must_match('rpcif_xdr.c', expect_xdr, mode='r')
diff --git a/test/Rpcgen/RPCGENHEADERFLAGS.py b/test/Rpcgen/RPCGENHEADERFLAGS.py
index f65da8e8..4beca643 100644
--- a/test/Rpcgen/RPCGENHEADERFLAGS.py
+++ b/test/Rpcgen/RPCGENHEADERFLAGS.py
@@ -71,10 +71,10 @@ expect_h = output_h % ('-h', test.workpath('rpcif.h'))
expect_svc = output % ('-m', test.workpath('rpcif_svc.c'))
expect_xdr = output % ('-c', test.workpath('rpcif_xdr.c'))
-test.must_match('rpcif_clnt.c', expect_clnt)
-test.must_match('rpcif.h', expect_h)
-test.must_match('rpcif_svc.c', expect_svc)
-test.must_match('rpcif_xdr.c', expect_xdr)
+test.must_match('rpcif_clnt.c', expect_clnt, mode='r')
+test.must_match('rpcif.h', expect_h, mode='r')
+test.must_match('rpcif_svc.c', expect_svc, mode='r')
+test.must_match('rpcif_xdr.c', expect_xdr, mode='r')
diff --git a/test/Rpcgen/RPCGENSERVICEFLAGS.py b/test/Rpcgen/RPCGENSERVICEFLAGS.py
index a956d4f9..7644485d 100644
--- a/test/Rpcgen/RPCGENSERVICEFLAGS.py
+++ b/test/Rpcgen/RPCGENSERVICEFLAGS.py
@@ -71,10 +71,10 @@ expect_h = output % ('-h', test.workpath('rpcif.h'))
expect_svc = output_svc % ('-m', test.workpath('rpcif_svc.c'))
expect_xdr = output % ('-c', test.workpath('rpcif_xdr.c'))
-test.must_match('rpcif_clnt.c', expect_clnt)
-test.must_match('rpcif.h', expect_h)
-test.must_match('rpcif_svc.c', expect_svc)
-test.must_match('rpcif_xdr.c', expect_xdr)
+test.must_match('rpcif_clnt.c', expect_clnt, mode='r')
+test.must_match('rpcif.h', expect_h, mode='r')
+test.must_match('rpcif_svc.c', expect_svc, mode='r')
+test.must_match('rpcif_xdr.c', expect_xdr, mode='r')
diff --git a/test/Rpcgen/RPCGENXDRFLAGS.py b/test/Rpcgen/RPCGENXDRFLAGS.py
index 0dc1366d..41da70c5 100644
--- a/test/Rpcgen/RPCGENXDRFLAGS.py
+++ b/test/Rpcgen/RPCGENXDRFLAGS.py
@@ -71,10 +71,10 @@ expect_h = output % ('-h', test.workpath('rpcif.h'))
expect_svc = output % ('-m', test.workpath('rpcif_svc.c'))
expect_xdr = output_xdr % ('-c', test.workpath('rpcif_xdr.c'))
-test.must_match('rpcif_clnt.c', expect_clnt)
-test.must_match('rpcif.h', expect_h)
-test.must_match('rpcif_svc.c', expect_svc)
-test.must_match('rpcif_xdr.c', expect_xdr)
+test.must_match('rpcif_clnt.c', expect_clnt, mode='r')
+test.must_match('rpcif.h', expect_h, mode='r')
+test.must_match('rpcif_svc.c', expect_svc, mode='r')
+test.must_match('rpcif_xdr.c', expect_xdr, mode='r')
diff --git a/test/SConscript/Return.py b/test/SConscript/Return.py
index 997de9d0..1f678afc 100644
--- a/test/SConscript/Return.py
+++ b/test/SConscript/Return.py
@@ -39,50 +39,50 @@ x = SConscript('SConscript2')
y, z = SConscript('SConscript3')
a4, b4 = SConscript('SConscript4')
foo, bar = SConscript('SConscript5')
-print ("x =", x)
-print ("y =", y)
-print ("z =", z)
-print ("a4 =", a4)
-print ("b4 =", b4)
-print ("foo =", foo)
-print ("bar =", bar)
+print("x =", x)
+print("y =", y)
+print("z =", z)
+print("a4 =", a4)
+print("b4 =", b4)
+print("foo =", foo)
+print("bar =", bar)
""")
test.write('SConscript1', """\
-print ("line 1")
+print("line 1")
Return()
-print ("line 2")
+print("line 2")
""")
test.write('SConscript2', """\
-print ("line 3")
+print("line 3")
x = 7
Return('x')
-print ("line 4")
+print("line 4")
""")
test.write('SConscript3', """\
-print ("line 5")
+print("line 5")
y = 8
z = 9
Return('y z')
-print ("line 6")
+print("line 6")
""")
test.write('SConscript4', """\
a4 = 'aaa'
b4 = 'bbb'
-print ("line 7")
+print("line 7")
Return('a4', 'b4', stop=False)
b4 = 'b-after'
-print ("line 8")
+print("line 8")
""")
test.write('SConscript5', """\
foo = 'foo'
bar = 'bar'
Return(["foo", "bar"])
-print ("line 9")
+print("line 9")
""")
expect = """\
diff --git a/test/SConscript/SConscript.py b/test/SConscript/SConscript.py
index d1e09ce4..2eeb2112 100644
--- a/test/SConscript/SConscript.py
+++ b/test/SConscript/SConscript.py
@@ -37,7 +37,7 @@ import foo
assert foo.foo == 4
-print ("SConstruct", os.getcwd())
+print("SConstruct", os.getcwd())
SConscript('SConscript')
x1 = "SConstruct x1"
@@ -89,7 +89,7 @@ test.write('SConscript', """\
assert "os" not in globals()
import os
-print ("SConscript " + os.getcwd())
+print("SConscript " + os.getcwd())
""")
test.write('SConscript1', """
diff --git a/test/SWIG/live.py b/test/SWIG/live.py
index 5e95dc79..05971aab 100644
--- a/test/SWIG/live.py
+++ b/test/SWIG/live.py
@@ -131,8 +131,9 @@ test.run(arguments = ldmodule_prefix+'foo' + _dll)
test.must_not_exist(test.workpath('wrapper.out'))
test.run(program = python, stdin = """\
+from __future__ import print_function
import foo
-print foo.foo_string()
+print(foo.foo_string())
""", stdout="""\
This is foo.c!
""")
@@ -144,10 +145,11 @@ test.run(arguments = ldmodule_prefix+'bar' + _dll)
test.must_match('wrapper.out', "wrapper.py\n")
test.run(program = python, stdin = """\
+from __future__ import print_function
import foo
import bar
-print foo.foo_string()
-print bar.bar_string()
+print(foo.foo_string())
+print(bar.bar_string())
""", stdout="""\
This is foo.c!
This is bar.c!
diff --git a/test/Scanner/FindPathDirs.py b/test/Scanner/FindPathDirs.py
index ef3ea46d..7f8b993e 100644
--- a/test/Scanner/FindPathDirs.py
+++ b/test/Scanner/FindPathDirs.py
@@ -41,14 +41,14 @@ test.write('build.py', r"""
import os.path
import sys
path = sys.argv[1].split()
-input = open(sys.argv[2], 'rb')
-output = open(sys.argv[3], 'wb')
+input = open(sys.argv[2], 'r')
+output = open(sys.argv[3], 'w')
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):
diff --git a/test/Scanner/Scanner.py b/test/Scanner/Scanner.py
index 8d48b730..625b3729 100644
--- a/test/Scanner/Scanner.py
+++ b/test/Scanner/Scanner.py
@@ -32,14 +32,14 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-input = open(sys.argv[1], 'rb')
-output = open(sys.argv[2], 'wb')
+input = open(sys.argv[1], 'r')
+output = open(sys.argv[2], 'w')
def process(infp, outfp):
for line in infp.readlines():
if line[:8] == 'include ':
file = line[8:-1]
- process(open(file, 'rb'), outfp)
+ process(open(file, 'r'), outfp)
elif line[:8] == 'getfile ':
outfp.write('include ')
outfp.write(line[8:])
@@ -114,7 +114,7 @@ bar = env.BarBld(target='bar', source='bar.in')
# automatically applied to targets generated from that Builder
def blork(env, target, source):
- open(str(target[0]), 'wb').write(
+ open(str(target[0]), 'w').write(
source[0].get_text_contents().replace('getfile', 'MISSEDME'))
kbld = Builder(action=r'%(_python_)s build.py $SOURCES $TARGET',
diff --git a/test/Scanner/generated.py b/test/Scanner/generated.py
index 7246cbe4..9dd2a86b 100644
--- a/test/Scanner/generated.py
+++ b/test/Scanner/generated.py
@@ -301,7 +301,7 @@ import os
Scanned = {}
def write_out(file, dict):
- f = open(file, 'wb')
+ f = open(file, 'w')
for k in sorted(dict.keys()):
file = os.path.split(k)[1]
f.write(file + ": " + str(dict[k]) + "\\n")
diff --git a/test/Scanner/no-Dir-node.py b/test/Scanner/no-Dir-node.py
index 3a918bff..123764e8 100644
--- a/test/Scanner/no-Dir-node.py
+++ b/test/Scanner/no-Dir-node.py
@@ -54,16 +54,16 @@ test.write('build.py', r"""
import os.path
import sys
path = sys.argv[1].split()
-input = open(sys.argv[2], 'rb')
-output = open(sys.argv[3], 'wb')
+input = open(sys.argv[2], 'r')
+output = open(sys.argv[3], 'w')
def find_file(f):
if os.path.isabs(f):
- return open(f, 'rb')
+ return open(f, 'r')
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):
@@ -81,7 +81,7 @@ sys.exit(0)
test.write('SConstruct', """\
def foo(target, source, env):
- fp = open(str(target[0]), 'wb')
+ fp = open(str(target[0]), 'w')
for c in sorted(source[0].children(), key=lambda t: t.name):
fp.write('%s\\n' % c)
fp.close()
diff --git a/test/TAR/TAR.py b/test/TAR/TAR.py
index 8aa2747b..65e6182f 100644
--- a/test/TAR/TAR.py
+++ b/test/TAR/TAR.py
@@ -44,15 +44,11 @@ for opt, arg in opts:
if opt == '-f': out = arg
def process(outfile, name):
if os.path.isdir(name):
- ## TODO 2.4: the next three lines can be replaced by
- #for entry in sorted(os.listdir(name)):
- list = os.listdir(name)
- list.sort()
- for entry in list:
+ for entry in sorted(os.listdir(name)):
process(outfile, os.path.join(name, entry))
else:
- outfile.write(open(name, 'rb').read())
-outfile = open(out, 'wb')
+ outfile.write(open(name, 'r').read())
+outfile = open(out, 'w')
for infile in args:
process(outfile, infile)
outfile.close()
@@ -77,11 +73,11 @@ test.write(['sub1', 'file6'], "sub1/file6\n")
test.run(arguments = 'aaa.tar', stderr = None)
-test.fail_test(test.read('aaa.tar') != "file1\nfile2\nfile3\n")
+test.must_match('aaa.tar', "file1\nfile2\nfile3\n", mode='r')
test.run(arguments = 'bbb.tar', stderr = None)
-test.fail_test(test.read('bbb.tar') != "sub1/file5\nsub1/file6\nfile4\n")
+test.must_match('bbb.tar', "sub1/file5\nsub1/file6\nfile4\n", mode='r')
tar = test.detect('TAR', 'tar')
diff --git a/test/TAR/TARFLAGS.py b/test/TAR/TARFLAGS.py
index 034539c2..e1eae0f4 100644
--- a/test/TAR/TARFLAGS.py
+++ b/test/TAR/TARFLAGS.py
@@ -46,15 +46,11 @@ for opt, arg in cmd_opts:
else: opt_string = opt_string + ' ' + opt
def process(outfile, name):
if os.path.isdir(name):
- ## TODO 2.5: the next three lines can be replaced by
- #for entry in sorted(os.listdir(name)):
- entries = os.listdir(name)
- entries.sort()
- for entry in entries:
+ for entry in sorted(os.listdir(name)):
process(outfile, os.path.join(name, entry))
else:
- outfile.write(open(name, 'rb').read())
-outfile = open(out, 'wb')
+ outfile.write(open(name, 'r').read())
+outfile = open(out, 'w')
outfile.write('options: %s\\n' % opt_string)
for infile in args:
process(outfile, infile)
@@ -82,11 +78,11 @@ test.write(['sub1', 'file6'], "sub1/file6\n")
test.run(arguments = 'aaa.tar', stderr = None)
-test.fail_test(test.read('aaa.tar') != "options: -x\nfile1\nfile2\nfile3\n")
+test.must_match('aaa.tar', "options: -x\nfile1\nfile2\nfile3\n", mode='r')
test.run(arguments = 'bbb.tar', stderr = None)
-test.fail_test(test.read('bbb.tar') != "options: -x\nsub1/file5\nsub1/file6\nfile4\n")
+test.must_match('bbb.tar', "options: -x\nsub1/file5\nsub1/file6\nfile4\n", mode='r')
diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py
index 8e756afb..f0743e60 100644
--- a/test/TEMPFILEPREFIX.py
+++ b/test/TEMPFILEPREFIX.py
@@ -38,8 +38,9 @@ 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
+print(sys.argv)
""")
echo_py = test.workpath('echo.py')
diff --git a/test/TEX/LATEXFLAGS.py b/test/TEX/LATEXFLAGS.py
index 46e0479d..48cfa9c0 100644
--- a/test/TEX/LATEXFLAGS.py
+++ b/test/TEX/LATEXFLAGS.py
@@ -43,8 +43,8 @@ opt_string = ''
for opt, arg in cmd_opts:
opt_string = opt_string + ' ' + opt
base_name = os.path.splitext(args[0])[0]
-infile = open(args[0], 'rb')
-out_file = open(base_name+'.dvi', 'wb')
+infile = open(args[0], 'r')
+out_file = open(base_name+'.dvi', 'w')
out_file.write(opt_string + "\n")
for l in infile.readlines():
if l[0] != '\\':
@@ -70,9 +70,9 @@ test.write('test2.latex', r"""This is a .latex test.
test.run(arguments = '.', stderr = None)
-test.fail_test(test.read('test1.dvi') != " -x\nThis is a .ltx test.\n")
+test.must_match('test1.dvi', " -x\nThis is a .ltx test.\n", mode='r')
-test.fail_test(test.read('test2.dvi') != " -t\nThis is a .latex test.\n")
+test.must_match('test2.dvi', " -t\nThis is a .latex test.\n", mode='r')
@@ -111,7 +111,7 @@ This is the %s LaTeX file.
test.run(arguments = 'bar.dvi', stderr = None)
- test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
+ test.must_match('wrapper.out', "wrapper.py\n", mode='r')
test.fail_test(not os.path.exists(test.workpath('bar.dvi')))
diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py
index 1c606353..2f4f69ec 100644
--- a/test/Variables/Variables.py
+++ b/test/Variables/Variables.py
@@ -320,7 +320,10 @@ opts.Add('UNSPECIFIED',
env = Environment(variables=opts)
-Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env,sort=cmp))
+def compare(a,b):
+ return a < b
+
+Help('Variables settable in custom.py or on the command line:\\n' + opts.GenerateHelpText(env,sort=compare))
""")
diff --git a/test/VariantDir/Clean.py b/test/VariantDir/Clean.py
index d1e0bb84..b2e93a33 100644
--- a/test/VariantDir/Clean.py
+++ b/test/VariantDir/Clean.py
@@ -43,8 +43,8 @@ VariantDir('build1', '.', duplicate=1)
def build_sample(target, source, env):
targetdir = str(target[0].dir)
target = str(target[0])
- open(target, 'wb').write(open(str(source[0]), 'rb').read())
- open(targetdir+'/sample.junk', 'wb').write('Side effect!\\n')
+ open(target, 'w').write(open(str(source[0]), 'r').read())
+ open(targetdir+'/sample.junk', 'w').write('Side effect!\\n')
t0 = Command("build0/sample.out", "sample.in", build_sample)
t1 = Command("build1/sample.out", "sample.in", build_sample)
diff --git a/test/VariantDir/File-create.py b/test/VariantDir/File-create.py
index 725404ce..50db618e 100644
--- a/test/VariantDir/File-create.py
+++ b/test/VariantDir/File-create.py
@@ -49,12 +49,12 @@ SConscript('src/SConscript', variant_dir='build1', chdir=1, duplicate=1)
test.write(['src', 'SConscript'], """\
#f1_in = File('f1.in')
#Command('f1.out', f1_in, Copy('$TARGET', '$SOURCE'))
-#open('f1.in', 'wb').write("f1.in\\n")
+#open('f1.in', 'w').write("f1.in\\n")
f2_in = File('f2.in')
str(f2_in)
Command('f2.out', f2_in, Copy('$TARGET', '$SOURCE'))
-open('f2.in', 'wb').write("f2.in\\n")
+open('f2.in', 'w').write("f2.in\\n")
""")
test.run(arguments = '--tree=all .')
diff --git a/test/VariantDir/errors.py b/test/VariantDir/errors.py
index d1490d42..c74d1037 100644
--- a/test/VariantDir/errors.py
+++ b/test/VariantDir/errors.py
@@ -57,9 +57,9 @@ def fake_scan(node, env, target):
def cat(env, source, target):
target = str(target[0])
- f = open(target, "wb")
+ f = open(target, "w")
for src in source:
- f.write(open(str(src), "rb").read())
+ f.write(open(str(src), "r").read())
f.close()
env = Environment(BUILDERS={'Build':Builder(action=cat)},
@@ -77,7 +77,7 @@ env.Build('file.out', 'file.in')
# Just verify that the normal case works fine.
test.run(chdir = 'normal', arguments = ".")
-test.fail_test(test.read(['normal', 'build', 'file.out']) != "normal/src/file.in\n")
+test.must_match(['normal', 'build', 'file.out'], "normal/src/file.in\n", mode='r')
# Verify the error when the VariantDir itself is read-only. Don't bother
# to test this on Windows, because the ACL (I think) still allows the
diff --git a/test/builderrors.py b/test/builderrors.py
index 3d443bf7..a3e2f4de 100644
--- a/test/builderrors.py
+++ b/test/builderrors.py
@@ -38,8 +38,8 @@ test.write('build.py', r"""
import sys
exitval = int(sys.argv[1])
if exitval == 0:
- contents = open(sys.argv[3], 'rb').read()
- file = open(sys.argv[2], 'wb')
+ contents = open(sys.argv[3], 'r').read()
+ file = open(sys.argv[2], 'w')
file.write(contents)
file.close()
sys.exit(exitval)
@@ -81,7 +81,7 @@ test.write(['two', 'f3.in'], "two/f3.in\n")
test.run(chdir = 'two', arguments = "f1.out f2.out f3.out",
stderr = "scons: *** [f2.out] Error 1\n", status = 2)
-test.fail_test(test.read(['two', 'f1.out']) != "two/f1.in\n")
+test.must_match(['two', 'f1.out'], "two/f1.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('f2.out')))
test.fail_test(os.path.exists(test.workpath('f3.out')))
@@ -101,8 +101,8 @@ test.write(['three', 'f3.in'], "three/f3.in\n")
test.run(chdir = 'three', arguments = "f1.out f2.out f3.out",
stderr = "scons: *** [f3.out] Error 1\n", status = 2)
-test.fail_test(test.read(['three', 'f1.out']) != "three/f1.in\n")
-test.fail_test(test.read(['three', 'f2.out']) != "three/f2.in\n")
+test.must_match(['three', 'f1.out'], "three/f1.in\n", mode='r')
+test.must_match(['three', 'f2.out'], "three/f2.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('f3.out')))
test.write('SConstruct', """
@@ -171,6 +171,7 @@ test.must_not_contain_any_line(test.stderr(), ['Exception', 'Traceback'])
# Should not give traceback; the task error should get converted
# to a BuildError.
test.write('SConstruct', """
+from __future__ import print_function
import atexit
env = Environment()
@@ -182,7 +183,7 @@ env2.Install("target", "dir2/myFile")
def print_build_failures():
from SCons.Script import GetBuildFailures
for bf in GetBuildFailures():
- print bf.action
+ print(bf.action)
atexit.register(print_build_failures)
""")
diff --git a/test/fixture/wrapper.py b/test/fixture/wrapper.py
index f02ea03d..bd8187cc 100644
--- a/test/fixture/wrapper.py
+++ b/test/fixture/wrapper.py
@@ -2,5 +2,5 @@ import os
import sys
if '--version' not in sys.argv and '-dumpversion' not in sys.argv:
path = os.path.join(os.path.dirname(os.path.relpath(__file__)), 'wrapper.out')
- open(path, 'wb').write(b"wrapper.py\n")
+ open(path, 'w').write("wrapper.py\n")
os.system(" ".join(sys.argv[1:]))
diff --git a/test/fixture/wrapper_with_args.py b/test/fixture/wrapper_with_args.py
new file mode 100644
index 00000000..fccab729
--- /dev/null
+++ b/test/fixture/wrapper_with_args.py
@@ -0,0 +1,7 @@
+import os
+import sys
+
+path = os.path.join(os.path.dirname(os.path.relpath(__file__)), 'wrapper.out')
+
+open(path, 'a').write("wrapper_with_args.py %s\n" % " ".join(sys.argv[1:]))
+os.system(" ".join(sys.argv[1:]))
diff --git a/test/option--.py b/test/option--.py
index 3c932c06..8e06260e 100644
--- a/test/option--.py
+++ b/test/option--.py
@@ -34,7 +34,7 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
diff --git a/test/option--Q.py b/test/option--Q.py
index 4322bcd0..da6d2e12 100644
--- a/test/option--Q.py
+++ b/test/option--Q.py
@@ -34,7 +34,7 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
diff --git a/test/option-i.py b/test/option-i.py
index b32bd9cd..9b5212d4 100644
--- a/test/option-i.py
+++ b/test/option-i.py
@@ -34,7 +34,7 @@ test = TestSCons.TestSCons()
test.write('succeed.py', r"""
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write("succeed.py: %s\n" % sys.argv[1])
file.close()
sys.exit(0)
@@ -73,22 +73,21 @@ test.run(arguments = '-i aaa.1 aaa.out bbb.1 bbb.out',
'scons: *** [bbb.1] Error 1\n')
test.fail_test(os.path.exists(test.workpath('aaa.1')))
-test.fail_test(test.read('aaa.out') != "succeed.py: aaa.out\n")
+test.fail_test(test.read('aaa.out',mode='r') != "succeed.py: aaa.out\n")
test.fail_test(os.path.exists(test.workpath('bbb.1')))
-test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n")
+test.fail_test(test.read('bbb.out',mode='r') != "succeed.py: bbb.out\n")
test.unlink("aaa.out")
test.unlink("bbb.out")
-test.run(arguments = '--ignore-errors aaa.1 aaa.out bbb.1 bbb.out',
- stderr =
- 'scons: *** [aaa.1] Error 1\n'
+test.run(arguments='--ignore-errors aaa.1 aaa.out bbb.1 bbb.out',
+ stderr='scons: *** [aaa.1] Error 1\n'
'scons: *** [bbb.1] Error 1\n')
test.fail_test(os.path.exists(test.workpath('aaa.1')))
-test.fail_test(test.read('aaa.out') != "succeed.py: aaa.out\n")
+test.fail_test(test.read('aaa.out', mode='r') != "succeed.py: aaa.out\n")
test.fail_test(os.path.exists(test.workpath('bbb.1')))
-test.fail_test(test.read('bbb.out') != "succeed.py: bbb.out\n")
+test.fail_test(test.read('bbb.out', mode='r') != "succeed.py: bbb.out\n")
test.pass_test()
diff --git a/test/option-j.py b/test/option-j.py
index 69ef4142..acd97f8b 100644
--- a/test/option-j.py
+++ b/test/option-j.py
@@ -51,7 +51,7 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import time
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write(str(time.time()) + '\n')
time.sleep(1)
file.write(str(time.time()))
diff --git a/test/option-k.py b/test/option-k.py
index a367c653..7a01ed3b 100644
--- a/test/option-k.py
+++ b/test/option-k.py
@@ -38,7 +38,7 @@ test.subdir('work1', 'work2', 'work3')
test.write('succeed.py', r"""
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write("succeed.py: %s\n" % sys.argv[1])
file.close()
sys.exit(0)
@@ -55,6 +55,7 @@ sys.exit(1)
#
test.write(['work1', 'SConstruct'], """\
+DefaultEnvironment(tools=[])
Succeed = Builder(action = r'%(_python_)s ../succeed.py $TARGETS')
Fail = Builder(action = r'%(_python_)s ../fail.py $TARGETS')
env = Environment(BUILDERS = { 'Succeed' : Succeed, 'Fail' : Fail })
@@ -82,7 +83,7 @@ test.run(chdir = 'work1',
test.must_not_exist(test.workpath('work1', 'aaa.1'))
test.must_not_exist(test.workpath('work1', 'aaa.out'))
-test.must_match(['work1', 'bbb.out'], "succeed.py: bbb.out\n")
+test.must_match(['work1', 'bbb.out'], "succeed.py: bbb.out\n", mode='r')
test.unlink(['work1', 'bbb.out'])
@@ -93,7 +94,7 @@ test.run(chdir = 'work1',
test.must_not_exist(test.workpath('work1', 'aaa.1'))
test.must_not_exist(test.workpath('work1', 'aaa.out'))
-test.must_match(['work1', 'bbb.out'], "succeed.py: bbb.out\n")
+test.must_match(['work1', 'bbb.out'], "succeed.py: bbb.out\n", mode='r')
expect = """\
scons: Reading SConscript files ...
@@ -118,6 +119,7 @@ test.must_not_exist(test.workpath('work1', 'bbb.out'))
#
test.write(['work2', 'SConstruct'], """\
+DefaultEnvironment(tools=[])
Succeed = Builder(action = r'%(_python_)s ../succeed.py $TARGETS')
Fail = Builder(action = r'%(_python_)s ../fail.py $TARGETS')
env = Environment(BUILDERS = { 'Succeed' : Succeed, 'Fail' : Fail })
@@ -146,8 +148,8 @@ scons: done building targets (errors occurred during build).
test.must_not_exist(['work2', 'aaa.out'])
test.must_not_exist(['work2', 'bbb.out'])
-test.must_match(['work2', 'ccc.out'], "succeed.py: ccc.out\n")
-test.must_match(['work2', 'ddd.out'], "succeed.py: ddd.out\n")
+test.must_match(['work2', 'ccc.out'], "succeed.py: ccc.out\n", mode='r')
+test.must_match(['work2', 'ddd.out'], "succeed.py: ddd.out\n", mode='r')
@@ -173,6 +175,7 @@ test.must_match(['work2', 'ddd.out'], "succeed.py: ddd.out\n")
#
test.write(['work3', 'SConstruct'], """\
+DefaultEnvironment(tools=[])
Succeed = Builder(action = r'%(_python_)s ../succeed.py $TARGETS')
Fail = Builder(action = r'%(_python_)s ../fail.py $TARGETS')
env = Environment(BUILDERS = { 'Succeed' : Succeed, 'Fail' : Fail })
diff --git a/test/option-n.py b/test/option-n.py
index a32dfb72..0fd7bfe7 100644
--- a/test/option-n.py
+++ b/test/option-n.py
@@ -52,7 +52,7 @@ test.subdir('build', 'src')
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
diff --git a/test/option-s.py b/test/option-s.py
index f79c3470..bbde2d14 100644
--- a/test/option-s.py
+++ b/test/option-s.py
@@ -34,7 +34,7 @@ test = TestSCons.TestSCons()
test.write('build.py', r"""
import sys
-file = open(sys.argv[1], 'wb')
+file = open(sys.argv[1], 'w')
file.write("build.py: %s\n" % sys.argv[1])
file.close()
""")
diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py
index 26609272..07347306 100644
--- a/test/scons-time/run/config/python.py
+++ b/test/scons-time/run/config/python.py
@@ -62,9 +62,9 @@ prof0 = test.workpath('foo-000-0.prof')
prof1 = test.workpath('foo-000-1.prof')
prof2 = test.workpath('foo-000-2.prof')
-test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0)
-test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1)
-test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2)
+test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0, mode='r')
+test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1, mode='r')
+test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2, mode='r')
test.pass_test()
diff --git a/test/scons-time/run/config/scons.py b/test/scons-time/run/config/scons.py
index 0c8b6434..b782e839 100644
--- a/test/scons-time/run/config/scons.py
+++ b/test/scons-time/run/config/scons.py
@@ -58,9 +58,9 @@ prof0 = test.workpath('foo-000-0.prof')
prof1 = test.workpath('foo-000-1.prof')
prof2 = test.workpath('foo-000-2.prof')
-test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0)
-test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1)
-test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2)
+test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0, mode='r')
+test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1, mode='r')
+test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2, mode='r')
test.pass_test()
diff --git a/test/scons-time/run/option/python.py b/test/scons-time/run/option/python.py
index 70feb70a..d0592b61 100644
--- a/test/scons-time/run/option/python.py
+++ b/test/scons-time/run/option/python.py
@@ -57,9 +57,9 @@ prof0 = test.workpath('foo-000-0.prof')
prof1 = test.workpath('foo-000-1.prof')
prof2 = test.workpath('foo-000-2.prof')
-test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0)
-test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1)
-test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2)
+test.must_match('foo-000-0.log', "my_python.py: %s\n" % prof0, mode='r')
+test.must_match('foo-000-1.log', "my_python.py: %s\n" % prof1, mode='r')
+test.must_match('foo-000-2.log', "my_python.py: %s\n" % prof2, mode='r')
test.pass_test()
diff --git a/test/scons-time/run/option/scons.py b/test/scons-time/run/option/scons.py
index 71d8ca2b..e2479c3b 100644
--- a/test/scons-time/run/option/scons.py
+++ b/test/scons-time/run/option/scons.py
@@ -52,9 +52,9 @@ prof0 = test.workpath('foo-000-0.prof')
prof1 = test.workpath('foo-000-1.prof')
prof2 = test.workpath('foo-000-2.prof')
-test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0)
-test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1)
-test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2)
+test.must_match('foo-000-0.log', "my_scons.py: %s\n" % prof0, mode='r')
+test.must_match('foo-000-1.log', "my_scons.py: %s\n" % prof1, mode='r')
+test.must_match('foo-000-2.log', "my_scons.py: %s\n" % prof2, mode='r')
test.pass_test()
diff --git a/test/subdivide.py b/test/subdivide.py
index 770870dd..8c8eff02 100644
--- a/test/subdivide.py
+++ b/test/subdivide.py
@@ -80,6 +80,7 @@ test.chmod(fake_cc_py, 0o755)
test.chmod(fake_link_py, 0o755)
test.write('SConstruct', """\
+DefaultEnvironment(tools=[])
SConsignFile(None)
env = Environment(PROGSUFFIX = '.exe',
OBJSUFFIX = '.obj',
@@ -91,6 +92,7 @@ env.Object('foo.c')
""" % locals())
test.write(['src', 'SConstruct'], """\
+DefaultEnvironment(tools=[])
SConsignFile(None)
env = Environment(PROGSUFFIX = '.exe',
OBJSUFFIX = '.obj',
@@ -134,7 +136,7 @@ src/sub/bar.c
if os.sep == '\\':
expect = expect.replace('\\', '\\\\')
-test.must_match(['src', 'prog.exe'], expect)
+test.must_match(['src', 'prog.exe'], expect, mode='r')
test.up_to_date(chdir='src', arguments = test.workpath())