summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/AR/AR.py6
-rw-r--r--test/AR/ARCOM.py2
-rw-r--r--test/AR/ARCOMSTR.py2
-rw-r--r--test/AR/ARFLAGS.py6
-rw-r--r--test/AS/AS.py3
-rw-r--r--test/AS/ASCOM.py2
-rw-r--r--test/AS/ASCOMSTR.py2
-rw-r--r--test/AS/ASFLAGS.py3
-rw-r--r--test/AS/ASPP.py3
-rw-r--r--test/AS/ASPPCOM.py2
-rw-r--r--test/AS/ASPPCOMSTR.py4
-rw-r--r--test/AS/ASPPFLAGS.py3
-rw-r--r--test/AS/as-live.py8
-rw-r--r--test/AS/ml.py6
-rw-r--r--test/AS/nasm.py12
-rw-r--r--test/Actions/actions.py12
-rw-r--r--test/Actions/addpost-link.py3
-rw-r--r--test/Actions/function.py2
-rw-r--r--test/AddOption/help.py15
-rw-r--r--test/Alias/action.py11
-rw-r--r--test/Alias/scanner.py3
-rw-r--r--test/BitKeeper/BITKEEPERCOM.py3
-rw-r--r--test/BitKeeper/BITKEEPERCOMSTR.py3
-rw-r--r--test/BitKeeper/BitKeeper.py9
-rw-r--r--test/Builder/multi/same-overrides.py4
-rw-r--r--test/CC/CC.py9
-rw-r--r--test/CC/CCCOM.py2
-rw-r--r--test/CC/CCCOMSTR.py2
-rw-r--r--test/CC/SHCC.py6
-rw-r--r--test/CC/SHCCCOM.py2
-rw-r--r--test/CC/SHCCCOMSTR.py2
-rw-r--r--test/CC/SHCCFLAGS.py3
-rw-r--r--test/CC/SHCFLAGS.py3
-rw-r--r--test/CFILESUFFIX.py3
-rw-r--r--test/CPPPATH/absolute-path.py3
-rw-r--r--test/CVS.py9
-rw-r--r--test/CVSCOM.py3
-rw-r--r--test/CVSCOMSTR.py3
-rw-r--r--test/CXX/CXX.py9
-rw-r--r--test/CXX/CXXCOM.py2
-rw-r--r--test/CXX/CXXCOMSTR.py2
-rw-r--r--test/CXX/CXXFILESUFFIX.py3
-rw-r--r--test/CXX/CXXFLAGS.py3
-rw-r--r--test/CXX/SHCXX.py6
-rw-r--r--test/CXX/SHCXXCOM.py2
-rw-r--r--test/CXX/SHCXXCOMSTR.py2
-rw-r--r--test/CXX/SHCXXFLAGS.py3
-rw-r--r--test/CacheDir/CacheDir.py3
-rw-r--r--test/CacheDir/VariantDir.py3
-rw-r--r--test/CacheDir/debug.py3
-rw-r--r--test/CacheDir/environment.py3
-rw-r--r--test/CacheDir/option--cd.py3
-rw-r--r--test/CacheDir/option--cf.py3
-rw-r--r--test/CacheDir/option--cs.py3
-rw-r--r--test/Case.py3
-rw-r--r--test/Chmod.py3
-rw-r--r--test/Climb/explicit-parent--D.py3
-rw-r--r--test/Climb/explicit-parent--U.py3
-rw-r--r--test/Climb/explicit-parent-u.py3
-rw-r--r--test/Climb/option-u.py3
-rw-r--r--test/Configure/config-h.py9
-rw-r--r--test/Copy-Action.py7
-rw-r--r--test/DVIPDF/DVIPDF.py7
-rw-r--r--test/DVIPDF/DVIPDFCOM.py2
-rw-r--r--test/DVIPDF/DVIPDFCOMSTR.py2
-rw-r--r--test/DVIPDF/DVIPDFFLAGS.py7
-rw-r--r--test/DVIPS/DVIPS.py7
-rw-r--r--test/DVIPS/DVIPSFLAGS.py7
-rw-r--r--test/DVIPS/PSCOM.py2
-rw-r--r--test/DVIPS/PSCOMSTR.py2
-rw-r--r--test/Delete.py6
-rw-r--r--test/Deprecated/BuildDir.py8
-rw-r--r--test/Deprecated/Options/BoolOption.py4
-rw-r--r--test/Deprecated/Options/EnumOption.py3
-rw-r--r--test/Deprecated/Options/ListOption.py3
-rw-r--r--test/Deprecated/Options/Options.py32
-rw-r--r--test/Deprecated/Options/PackageOption.py3
-rw-r--r--test/Deprecated/Options/PathOption.py3
-rw-r--r--test/Deprecated/SConscript-build_dir.py3
-rw-r--r--test/Deprecated/debug-stree.py6
-rw-r--r--test/ESCAPE.py3
-rw-r--r--test/Errors/InternalError.py2
-rw-r--r--test/Errors/UserError.py2
-rw-r--r--test/Errors/execute-a-directory.py3
-rw-r--r--test/Errors/non-executable-file.py3
-rw-r--r--test/Errors/nonexistent-executable.py3
-rw-r--r--test/Exit.py7
-rw-r--r--test/Flatten.py11
-rw-r--r--test/Fortran/F77.py7
-rw-r--r--test/Fortran/F77COMSTR.py2
-rw-r--r--test/Fortran/F77FLAGS.py7
-rw-r--r--test/Fortran/F90.py5
-rw-r--r--test/Fortran/F90COMSTR.py2
-rw-r--r--test/Fortran/F90FLAGS.py5
-rw-r--r--test/Fortran/F95.py7
-rw-r--r--test/Fortran/F95COMSTR.py2
-rw-r--r--test/Fortran/F95FLAGS.py7
-rw-r--r--test/Fortran/FORTRAN.py7
-rw-r--r--test/Fortran/FORTRANCOMSTR.py2
-rw-r--r--test/Fortran/FORTRANFLAGS.py7
-rw-r--r--test/Fortran/FORTRANMODDIR.py3
-rw-r--r--test/Fortran/SHF77.py7
-rw-r--r--test/Fortran/SHF77COMSTR.py2
-rw-r--r--test/Fortran/SHF77FLAGS.py7
-rw-r--r--test/Fortran/SHF90.py7
-rw-r--r--test/Fortran/SHF90COMSTR.py2
-rw-r--r--test/Fortran/SHF90FLAGS.py5
-rw-r--r--test/Fortran/SHF95.py7
-rw-r--r--test/Fortran/SHF95COMSTR.py2
-rw-r--r--test/Fortran/SHF95FLAGS.py7
-rw-r--r--test/Fortran/SHFORTRAN.py7
-rw-r--r--test/Fortran/SHFORTRANCOMSTR.py2
-rw-r--r--test/Fortran/SHFORTRANFLAGS.py7
-rw-r--r--test/Fortran/USE-MODULE.py3
-rw-r--r--test/Fortran/common.py3
-rw-r--r--test/GetBuildFailures/serial.py3
-rw-r--r--test/GetOption/help.py6
-rw-r--r--test/Ghostscript/GS.py6
-rw-r--r--test/Ghostscript/GSCOM.py2
-rw-r--r--test/Ghostscript/GSCOMSTR.py2
-rw-r--r--test/Ghostscript/GSFLAGS.py6
-rw-r--r--test/Glob/Repository.py3
-rw-r--r--test/IDL/MIDLCOM.py2
-rw-r--r--test/IDL/MIDLCOMSTR.py2
-rw-r--r--test/Install/Install.py6
-rw-r--r--test/Install/wrap-by-attribute.py3
-rw-r--r--test/Interactive/implicit-VariantDir.py3
-rw-r--r--test/Interactive/shell.py3
-rw-r--r--test/Java/JAR.py13
-rw-r--r--test/Java/JARCHDIR.py3
-rw-r--r--test/Java/JARCOM.py2
-rw-r--r--test/Java/JARCOMSTR.py2
-rw-r--r--test/Java/JARFLAGS.py3
-rw-r--r--test/Java/JAVABOOTCLASSPATH.py3
-rw-r--r--test/Java/JAVACCOM.py2
-rw-r--r--test/Java/JAVACCOMSTR.py2
-rw-r--r--test/Java/JAVACFLAGS.py3
-rw-r--r--test/Java/JAVAH.py8
-rw-r--r--test/Java/JAVAHCOM.py2
-rw-r--r--test/Java/JAVAHCOMSTR.py2
-rw-r--r--test/Java/Java-1.4.py3
-rw-r--r--test/Java/Java-1.5.py3
-rw-r--r--test/Java/Java-1.6.py3
-rw-r--r--test/Java/RMIC.py11
-rw-r--r--test/Java/RMICCOM.py2
-rw-r--r--test/Java/RMICCOMSTR.py2
-rw-r--r--test/LEX/LEX.py3
-rw-r--r--test/LEX/LEXCOM.py2
-rw-r--r--test/LEX/LEXCOMSTR.py2
-rw-r--r--test/LEX/LEXFLAGS.py5
-rw-r--r--test/LEX/live.py7
-rw-r--r--test/LINK/LINK.py6
-rw-r--r--test/LINK/LINKCOM.py2
-rw-r--r--test/LINK/LINKCOMSTR.py4
-rw-r--r--test/LINK/LINKFLAGS.py8
-rw-r--r--test/LINK/SHLINK.py6
-rw-r--r--test/LINK/SHLINKCOM.py4
-rw-r--r--test/LINK/SHLINKCOMSTR.py4
-rw-r--r--test/LINK/SHLINKFLAGS.py8
-rw-r--r--test/Libs/SharedLibrary.py11
-rw-r--r--test/Libs/SharedLibraryIxes.py12
-rw-r--r--test/LoadableModule.py5
-rw-r--r--test/M4/M4.py9
-rw-r--r--test/M4/M4COM.py2
-rw-r--r--test/M4/M4COMSTR.py2
-rw-r--r--test/MSVC/PCHCOM.py2
-rw-r--r--test/MSVC/PCHCOMSTR.py2
-rw-r--r--test/MSVC/RCCOM.py2
-rw-r--r--test/MSVC/RCCOMSTR.py2
-rw-r--r--test/MSVC/batch.py6
-rw-r--r--test/MSVS/vs-8.0-x64-files.py7
-rw-r--r--test/MinGW/RCCOM.py2
-rw-r--r--test/MinGW/RCCOMSTR.py2
-rw-r--r--test/Mkdir.py9
-rw-r--r--test/Move.py3
-rw-r--r--test/NodeOps.py11
-rw-r--r--test/Parallel/ref_count.py3
-rw-r--r--test/ParseConfig.py6
-rw-r--r--test/Perforce/P4COM.py3
-rw-r--r--test/Perforce/P4COMSTR.py3
-rw-r--r--test/Perforce/Perforce.py22
-rw-r--r--test/Progress/TARGET.py3
-rw-r--r--test/Progress/file.py3
-rw-r--r--test/Progress/spinner.py3
-rw-r--r--test/QT/QTFLAGS.py3
-rw-r--r--test/QT/Tool.py8
-rw-r--r--test/QT/copied-env.py8
-rw-r--r--test/QT/generated-ui.py2
-rw-r--r--test/QT/installed.py9
-rw-r--r--test/QT/manual.py2
-rw-r--r--test/QT/source-from-ui.py3
-rw-r--r--test/QT/up-to-date.py3
-rw-r--r--test/QT/warnings.py3
-rw-r--r--test/RANLIB/RANLIB.py6
-rw-r--r--test/RANLIB/RANLIBCOM.py4
-rw-r--r--test/RANLIB/RANLIBCOMSTR.py4
-rw-r--r--test/RANLIB/RANLIBFLAGS.py6
-rw-r--r--test/RCS/RCS_COCOM.py3
-rw-r--r--test/RCS/RCS_COCOMSTR.py3
-rw-r--r--test/RCS/diskcheck.py5
-rw-r--r--test/RCS/explicit.py3
-rw-r--r--test/RCS/transparent.py3
-rw-r--r--test/Repository/LIBPATH.py12
-rw-r--r--test/Repository/M4.py3
-rw-r--r--test/Repository/RMIC.py6
-rw-r--r--test/Repository/SConscript.py6
-rw-r--r--test/Repository/SharedLibrary.py3
-rw-r--r--test/Repository/VariantDir.py2
-rw-r--r--test/Repository/option-f.py3
-rw-r--r--test/Repository/targets.py2
-rw-r--r--test/Requires/basic.py4
-rw-r--r--test/Requires/eval-order.py4
-rw-r--r--test/Rpcgen/RPCGEN.py5
-rw-r--r--test/Rpcgen/RPCGENCLIENTFLAGS.py5
-rw-r--r--test/Rpcgen/RPCGENFLAGS.py5
-rw-r--r--test/Rpcgen/RPCGENHEADERFLAGS.py5
-rw-r--r--test/Rpcgen/RPCGENSERVICEFLAGS.py5
-rw-r--r--test/Rpcgen/RPCGENXDRFLAGS.py5
-rw-r--r--test/SCCS/SCCSCOM.py3
-rw-r--r--test/SCCS/SCCSCOMSTR.py3
-rw-r--r--test/SCCS/diskcheck.py10
-rw-r--r--test/SCCS/explicit.py9
-rw-r--r--test/SCCS/implicit.py6
-rw-r--r--test/SCCS/transparent.py9
-rw-r--r--test/SConscript/SConscript.py2
-rw-r--r--test/SConscript/src_dir.py2
-rw-r--r--test/SHELL.py5
-rw-r--r--test/SPAWN.py5
-rw-r--r--test/SWIG/SWIGCOM.py2
-rw-r--r--test/SWIG/SWIGCOMSTR.py2
-rw-r--r--test/SWIG/live.py6
-rw-r--r--test/Scanner/FindPathDirs.py3
-rw-r--r--test/Scanner/Scanner.py4
-rw-r--r--test/Scanner/exception.py4
-rw-r--r--test/Scanner/generated.py36
-rw-r--r--test/Scanner/no-Dir-node.py3
-rw-r--r--test/SourceCode.py3
-rw-r--r--test/Subversion.py6
-rw-r--r--test/TAR/TAR.py6
-rw-r--r--test/TAR/TARCOM.py2
-rw-r--r--test/TAR/TARCOMSTR.py2
-rw-r--r--test/TAR/TARFLAGS.py7
-rw-r--r--test/TARGET-dir.py3
-rw-r--r--test/TARGETS.py24
-rw-r--r--test/TEX/LATEX.py7
-rw-r--r--test/TEX/LATEXCOM.py2
-rw-r--r--test/TEX/LATEXCOMSTR.py2
-rw-r--r--test/TEX/LATEXFLAGS.py6
-rw-r--r--test/TEX/PDFLATEX.py7
-rw-r--r--test/TEX/PDFLATEXCOM.py2
-rw-r--r--test/TEX/PDFLATEXCOMSTR.py2
-rw-r--r--test/TEX/PDFLATEXFLAGS.py6
-rw-r--r--test/TEX/PDFTEX.py7
-rw-r--r--test/TEX/PDFTEXCOM.py2
-rw-r--r--test/TEX/PDFTEXCOMSTR.py2
-rw-r--r--test/TEX/PDFTEXFLAGS.py6
-rw-r--r--test/TEX/TEX.py18
-rw-r--r--test/TEX/TEXCOM.py2
-rw-r--r--test/TEX/TEXCOMSTR.py2
-rw-r--r--test/TEX/TEXFLAGS.py6
-rw-r--r--test/ToolSurrogate.py9
-rw-r--r--test/Touch.py3
-rw-r--r--test/Value.py3
-rw-r--r--test/Variables/BoolVariable.py3
-rw-r--r--test/Variables/EnumVariable.py3
-rw-r--r--test/Variables/ListVariable.py3
-rw-r--r--test/Variables/PackageVariable.py3
-rw-r--r--test/Variables/PathVariable.py3
-rw-r--r--test/Variables/Variables.py32
-rw-r--r--test/VariantDir/SConscript-variant_dir.py3
-rw-r--r--test/VariantDir/VariantDir.py8
-rw-r--r--test/VariantDir/errors.py3
-rw-r--r--test/WhereIs.py23
-rw-r--r--test/Win32/bad-drive.py8
-rw-r--r--test/Win32/default-drive.py3
-rw-r--r--test/Win32/mingw.py7
-rw-r--r--test/Win32/win32pathmadness.py9
-rw-r--r--test/YACC/YACC.py3
-rw-r--r--test/YACC/YACCCOM.py2
-rw-r--r--test/YACC/YACCCOMSTR.py2
-rw-r--r--test/YACC/YACCFLAGS.py5
-rw-r--r--test/YACC/YACCHFILESUFFIX.py5
-rw-r--r--test/YACC/YACCHXXFILESUFFIX.py5
-rw-r--r--test/YACC/YACCVCGFILESUFFIX.py5
-rw-r--r--test/YACC/live.py7
-rw-r--r--test/ZIP/ZIP.py11
-rw-r--r--test/ZIP/ZIPCOM.py2
-rw-r--r--test/ZIP/ZIPCOMSTR.py2
-rw-r--r--test/custom-concat.py2
-rw-r--r--test/explain/basic.py3
-rw-r--r--test/gnutools.py5
-rw-r--r--test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py3
-rw-r--r--test/long-lines/signature.py3
-rw-r--r--test/no-arguments.py2
-rw-r--r--test/no-target.py3
-rw-r--r--test/option--C.py5
-rw-r--r--test/option--random.py3
-rw-r--r--test/option-j.py9
-rw-r--r--test/option/debug-count.py6
-rw-r--r--test/option/debug-memory.py5
-rw-r--r--test/option/debug-presub.py3
-rw-r--r--test/option/debug-time.py7
-rw-r--r--test/option/help-options.py16
-rw-r--r--test/option/md5-chunksize.py4
-rw-r--r--test/option/profile.py6
-rw-r--r--test/option/stack-size.py4
-rw-r--r--test/option/tree-all.py13
-rw-r--r--test/packaging/convenience-functions.py9
-rw-r--r--test/preserve-source.py2
-rw-r--r--test/python-version.py1
-rw-r--r--test/runtest/fallback.py7
-rw-r--r--test/runtest/noqmtest.py3
-rw-r--r--test/runtest/python.py3
-rw-r--r--test/runtest/qmtest.py3
-rw-r--r--test/runtest/xml/output.py1
-rw-r--r--test/scons-time/help/all-subcommands.py7
-rw-r--r--test/sconsign/ghost-entries.py2
-rw-r--r--test/sconsign/script/SConsignFile.py3
-rw-r--r--test/sconsign/script/Signatures.py3
-rw-r--r--test/sconsign/script/no-SConsignFile.py3
-rw-r--r--test/special-filenames.py8
-rw-r--r--test/srcchange.py6
-rw-r--r--test/subdivide.py3
-rw-r--r--test/suffixes.py3
-rw-r--r--test/textfile.py19
325 files changed, 630 insertions, 982 deletions
diff --git a/test/AR/AR.py b/test/AR/AR.py
index 41105da..8fb8073 100644
--- a/test/AR/AR.py
+++ b/test/AR/AR.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -36,11 +35,10 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(LIBS = ['foo'], LIBPATH = ['.'])
diff --git a/test/AR/ARCOM.py b/test/AR/ARCOM.py
index 65cae2e..f26ced6 100644
--- a/test/AR/ARCOM.py
+++ b/test/AR/ARCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*ar*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*ar*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AR/ARCOMSTR.py b/test/AR/ARCOMSTR.py
index c4a8c77..4c0bb85 100644
--- a/test/AR/ARCOMSTR.py
+++ b/test/AR/ARCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*ar*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*ar*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AR/ARFLAGS.py b/test/AR/ARFLAGS.py
index 8734659..be4e8bd 100644
--- a/test/AR/ARFLAGS.py
+++ b/test/AR/ARFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -36,11 +35,10 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(LIBS = ['foo'], LIBPATH = ['.'])
diff --git a/test/AS/AS.py b/test/AS/AS.py
index 0857a62..38ea655 100644
--- a/test/AS/AS.py
+++ b/test/AS/AS.py
@@ -43,7 +43,6 @@ test = TestSCons.TestSCons()
if sys.platform == 'win32':
test.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -51,7 +50,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
diff --git a/test/AS/ASCOM.py b/test/AS/ASCOM.py
index 1be592c..a874f32 100644
--- a/test/AS/ASCOM.py
+++ b/test/AS/ASCOM.py
@@ -42,7 +42,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in filter(lambda l: l != "#as\n", infile.readlines()):
+for l in [l for l in infile.readlines() if l != "#as\n"]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AS/ASCOMSTR.py b/test/AS/ASCOMSTR.py
index eaa344a..f7cc34e 100644
--- a/test/AS/ASCOMSTR.py
+++ b/test/AS/ASCOMSTR.py
@@ -43,7 +43,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in filter(lambda l: l != "#as\n", infile.readlines()):
+for l in [l for l in infile.readlines() if l != "#as\n"]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AS/ASFLAGS.py b/test/AS/ASFLAGS.py
index 5581b07..4f89c2c 100644
--- a/test/AS/ASFLAGS.py
+++ b/test/AS/ASFLAGS.py
@@ -41,7 +41,6 @@ if sys.platform == 'win32':
o_c = ' -x'
test.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -49,7 +48,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
diff --git a/test/AS/ASPP.py b/test/AS/ASPP.py
index d8fb3be..f8bea47 100644
--- a/test/AS/ASPP.py
+++ b/test/AS/ASPP.py
@@ -38,7 +38,6 @@ test = TestSCons.TestSCons()
if sys.platform == 'win32':
test.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -46,7 +45,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
diff --git a/test/AS/ASPPCOM.py b/test/AS/ASPPCOM.py
index 53f4add..73b3ec3 100644
--- a/test/AS/ASPPCOM.py
+++ b/test/AS/ASPPCOM.py
@@ -40,7 +40,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in filter(lambda l: l != "#as\n", infile.readlines()):
+for l in [l for l in infile.readlines() if l != "#as\n"]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AS/ASPPCOMSTR.py b/test/AS/ASPPCOMSTR.py
index 20e3de0..7de3b12 100644
--- a/test/AS/ASPPCOMSTR.py
+++ b/test/AS/ASPPCOMSTR.py
@@ -29,8 +29,6 @@ Test that the $ASPPCOMSTR construction variable allows you to customize
the displayed assembler string.
"""
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -43,7 +41,7 @@ test.write('myas.py', r"""
import sys
infile = open(sys.argv[2], 'rb')
outfile = open(sys.argv[1], 'wb')
-for l in filter(lambda l: l != "#as\n", infile.readlines()):
+for l in [l for l in infile.readlines() if l != "#as\n"]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/AS/ASPPFLAGS.py b/test/AS/ASPPFLAGS.py
index e306c22..f27d0ad 100644
--- a/test/AS/ASPPFLAGS.py
+++ b/test/AS/ASPPFLAGS.py
@@ -41,7 +41,6 @@ if sys.platform == 'win32':
o_c = ' -x'
test.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -49,7 +48,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
diff --git a/test/AS/as-live.py b/test/AS/as-live.py
index 0ee7c16..0f7ec38 100644
--- a/test/AS/as-live.py
+++ b/test/AS/as-live.py
@@ -28,7 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify correct use of the live 'as' assembler.
"""
-import string
import sys
import TestSCons
@@ -43,7 +42,7 @@ test = TestSCons.TestSCons()
if not test.detect('AS', 'as'):
test.skip_test("as not found; skipping test\n")
-x86 = (sys.platform == 'win32' or string.find(sys.platform, 'linux') != -1)
+x86 = (sys.platform == 'win32' or sys.platform.find('linux') != -1)
if not x86:
test.skip_test("skipping as test on non-x86 platform '%s'\n" % sys.platform)
@@ -52,12 +51,11 @@ if not x86:
test.write("wrapper.py", """\
import os
-import string
import sys
open('%s', 'wb').write("wrapper.py: %%s\\n" %% sys.argv[-1])
-cmd = string.join(sys.argv[1:])
+cmd = " ".join(sys.argv[1:])
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """\
aaa = Environment()
diff --git a/test/AS/ml.py b/test/AS/ml.py
index a731efb..9491e36 100644
--- a/test/AS/ml.py
+++ b/test/AS/ml.py
@@ -28,7 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify correct use of the live 'ml' assembler.
"""
-import string
import sys
import TestSCons
@@ -48,11 +47,10 @@ if not ml:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/AS/nasm.py b/test/AS/nasm.py
index b6d61a3..be7db3e 100644
--- a/test/AS/nasm.py
+++ b/test/AS/nasm.py
@@ -29,7 +29,6 @@ Verify correct use of the live 'nasm' assembler.
"""
import os
-import string
import sys
import TestSCons
@@ -44,7 +43,7 @@ nasm = test.where_is('nasm')
if not nasm:
test.skip_test('nasm not found; skipping test\n')
-if string.find(sys.platform, 'linux') == -1:
+if sys.platform.find('linux') == -1:
test.skip_test("skipping test on non-Linux platform '%s'\n" % sys.platform)
try:
@@ -53,7 +52,7 @@ try:
except OSError:
test.skip_test('could not determine nasm version; skipping test\n')
else:
- version = string.split(stdout.read())[2]
+ version = stdout.read().split()[2]
if version[:4] != '0.98':
test.skip_test("skipping test of nasm version %s\n" % version)
@@ -71,17 +70,16 @@ else:
nasm_format = 'elf'
format_map = {}
for k, v in format_map.items():
- if string.find(sys.platform, k) != -1:
+ if sys.platform.find(k) != -1:
nasm_format = v
break
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
eee = Environment(tools = ['gcc', 'gnulink', 'nasm'],
diff --git a/test/Actions/actions.py b/test/Actions/actions.py
index aae2bb9..1837ee7 100644
--- a/test/Actions/actions.py
+++ b/test/Actions/actions.py
@@ -67,10 +67,9 @@ test.up_to_date(arguments = '.')
test.write('SConstruct', """
import os
-import string
def func(env, target, source):
- cmd = r'%(_python_)s build.py %%s 3 %%s' %% (string.join(map(str, target)),
- string.join(map(str, source)))
+ cmd = r'%(_python_)s build.py %%s 3 %%s' %% (' '.join(map(str, target)),
+ ' '.join(map(str, source)))
print cmd
return os.system(cmd)
B = Builder(action = func)
@@ -86,8 +85,7 @@ test.up_to_date(arguments = '.')
test.write('SConstruct', """
import os
-assert not globals().has_key('string')
-import string
+assert 'string' not in globals()
class bld:
def __init__(self):
self.cmd = r'%(_python_)s build.py %%s 4 %%s'
@@ -96,8 +94,8 @@ class bld:
print cmd
return os.system(cmd)
def get_contents(self, env, target, source):
- return self.cmd %% (string.join(map(str, target)),
- string.join(map(str, source)))
+ return self.cmd %% (' '.join(map(str, target)),
+ ' '.join(map(str, source)))
B = Builder(action = bld())
env = Environment(BUILDERS = { 'B' : B })
env.B(target = 'foo.out', source = 'foo.in')
diff --git a/test/Actions/addpost-link.py b/test/Actions/addpost-link.py
index 9c79662..a148051 100644
--- a/test/Actions/addpost-link.py
+++ b/test/Actions/addpost-link.py
@@ -39,9 +39,8 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
test.write('strip.py', """\
-import string
import sys
-print "strip.py: %s" % string.join(sys.argv[1:])
+print "strip.py: %s" % " ".join(sys.argv[1:])
""")
test.write('SConstruct', """\
diff --git a/test/Actions/function.py b/test/Actions/function.py
index 6d18e5c..2039197 100644
--- a/test/Actions/function.py
+++ b/test/Actions/function.py
@@ -136,7 +136,7 @@ genHeaderBld = SCons.Builder.Builder(
env = Environment()
env.Append(BUILDERS = {'GenHeader' : genHeaderBld})
-envdeps = map(str, range(int(optEnv['NbDeps'])))
+envdeps = list(map(str, range(int(optEnv['NbDeps']))))
env.GenHeader('Out', None, ENVDEPS=envdeps)
""")
diff --git a/test/AddOption/help.py b/test/AddOption/help.py
index 7b5c01d..26b9775 100644
--- a/test/AddOption/help.py
+++ b/test/AddOption/help.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -29,8 +30,6 @@ Verify the help text when the AddOption() function is used (and when
it's not).
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -56,27 +55,27 @@ expected_lines = [
]
test.run(arguments = '-h')
-lines = string.split(test.stdout(), '\n')
-missing = filter(lambda e, l=lines: not e in l, expected_lines)
+lines = test.stdout().split('\n')
+missing = [e for e in expected_lines if e not in lines]
if missing:
print "====== STDOUT:"
print test.stdout()
print "====== Missing the following lines in the above AddOption() help output:"
- print string.join(missing, "\n")
+ print "\n".join(missing)
test.fail_test()
test.unlink('SConstruct')
test.run(arguments = '-h')
-lines = string.split(test.stdout(), '\n')
-unexpected = filter(lambda e, l=lines: e in l, expected_lines)
+lines = test.stdout().split('\n')
+unexpected = [e for e in expected_lines if e in lines]
if unexpected:
print "====== STDOUT:"
print test.stdout()
print "====== Unexpected lines in the above non-AddOption() help output:"
- print string.join(unexpected, "\n")
+ print "\n".join(unexpected)
test.fail_test()
test.pass_test()
diff --git a/test/Alias/action.py b/test/Alias/action.py
index 72aab6e..74eb6f9 100644
--- a/test/Alias/action.py
+++ b/test/Alias/action.py
@@ -35,20 +35,19 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def cat(target, source, env):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
def foo(target, source, env):
- target = map(str, target)
- source = map(str, source)
+ target = list(map(str, target))
+ source = list(map(str, source))
open('foo', 'wb').write("foo(%s, %s)\\n" % (target, source))
def bar(target, source, env):
- target = map(str, target)
- source = map(str, source)
+ target = list(map(str, target))
+ source = list(map(str, source))
open('bar', 'wb').write("bar(%s, %s)\\n" % (target, source))
env = Environment(BUILDERS = {'Cat':Builder(action=cat)})
diff --git a/test/Alias/scanner.py b/test/Alias/scanner.py
index 743191c..fc78546 100644
--- a/test/Alias/scanner.py
+++ b/test/Alias/scanner.py
@@ -35,10 +35,9 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
XBuilder = Builder(action = cat, src_suffix = '.x', suffix = '.c')
diff --git a/test/BitKeeper/BITKEEPERCOM.py b/test/BitKeeper/BITKEEPERCOM.py
index aed066c..d01ad96 100644
--- a/test/BitKeeper/BITKEEPERCOM.py
+++ b/test/BitKeeper/BITKEEPERCOM.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'BitKeeper'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/BitKeeper/BITKEEPERCOMSTR.py b/test/BitKeeper/BITKEEPERCOMSTR.py
index a8207c6..311ef4d 100644
--- a/test/BitKeeper/BITKEEPERCOMSTR.py
+++ b/test/BitKeeper/BITKEEPERCOMSTR.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'BitKeeper'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/BitKeeper/BitKeeper.py b/test/BitKeeper/BitKeeper.py
index 9a61e75..24b9ccc 100644
--- a/test/BitKeeper/BitKeeper.py
+++ b/test/BitKeeper/BitKeeper.py
@@ -91,10 +91,9 @@ env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
test.write(['work1', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
BITKEEPERGETFLAGS='-e')
@@ -191,10 +190,9 @@ env.Cat('all', ['ddd.out', 'eee.out', 'fff.out'])
test.write(['work2', 'SConstruct'], """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
BITKEEPERGET='$BITKEEPER co',
@@ -287,10 +285,9 @@ test.run(chdir = 'import',
test.write(['work3', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
DefaultEnvironment(tools=['SCCS'])['SCCS'] = r'%s'
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
diff --git a/test/Builder/multi/same-overrides.py b/test/Builder/multi/same-overrides.py
index 5a3a7f8..9a428a2 100644
--- a/test/Builder/multi/same-overrides.py
+++ b/test/Builder/multi/same-overrides.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Verify that everything works if two multi calls have the same overrides.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons(match=TestSCons.match_re)
@@ -56,7 +54,7 @@ env.B(target = 'file4.out', source = 'file4b.in', foo=3)
test.write('file4a.in', 'file4a.in\n')
test.write('file4b.in', 'file4b.in\n')
-python_expr = string.replace(TestSCons.python, '\\', '\\\\')
+python_expr = TestSCons.python.replace('\\', '\\\\')
act = TestSCons.re_escape('"%s" build.py \$foo \$TARGET \$SOURCES' % python_expr)
expect = ("""
diff --git a/test/CC/CC.py b/test/CC/CC.py
index c412094..2c66040 100644
--- a/test/CC/CC.py
+++ b/test/CC/CC.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -39,7 +38,6 @@ test = TestSCons.TestSCons()
if sys.platform == 'win32':
test.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -47,7 +45,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
@@ -149,11 +147,10 @@ env.Program(target = 'test2', source = 'test2.C')
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/CC/CCCOM.py b/test/CC/CCCOM.py
index 6634e15..8d06942 100644
--- a/test/CC/CCCOM.py
+++ b/test/CC/CCCOM.py
@@ -43,7 +43,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in [l for l in infile.readlines() if l[:6] != '/*cc*/']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CC/CCCOMSTR.py b/test/CC/CCCOMSTR.py
index f66a192..6874406 100644
--- a/test/CC/CCCOMSTR.py
+++ b/test/CC/CCCOMSTR.py
@@ -44,7 +44,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in [l for l in infile.readlines() if l[:6] != '/*cc*/']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CC/SHCC.py b/test/CC/SHCC.py
index f80dfe5..b624bf2 100644
--- a/test/CC/SHCC.py
+++ b/test/CC/SHCC.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -35,11 +34,10 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/CC/SHCCCOM.py b/test/CC/SHCCCOM.py
index ab61035..0e87b62 100644
--- a/test/CC/SHCCCOM.py
+++ b/test/CC/SHCCCOM.py
@@ -42,7 +42,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in [l for l in infile.readlines() if l[:6] != '/*cc*/']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CC/SHCCCOMSTR.py b/test/CC/SHCCCOMSTR.py
index 05c27ad..15bfa85 100644
--- a/test/CC/SHCCCOMSTR.py
+++ b/test/CC/SHCCCOMSTR.py
@@ -44,7 +44,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:6] != '/*cc*/', infile.readlines()):
+for l in [l for l in infile.readlines() if l[:6] != '/*cc*/']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CC/SHCCFLAGS.py b/test/CC/SHCCFLAGS.py
index d77d247..72d36b1 100644
--- a/test/CC/SHCCFLAGS.py
+++ b/test/CC/SHCCFLAGS.py
@@ -27,7 +27,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import TestSCons
import os
-import string
test = TestSCons.TestSCons()
@@ -37,7 +36,7 @@ barflags = e['SHCCFLAGS'] + ' -DBAR'
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
-if string.find(sys.platform, 'irix') > -1:
+if sys.platform.find('irix') > -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'
test.write('SConstruct', """
diff --git a/test/CC/SHCFLAGS.py b/test/CC/SHCFLAGS.py
index c201c97..3ec6778 100644
--- a/test/CC/SHCFLAGS.py
+++ b/test/CC/SHCFLAGS.py
@@ -27,7 +27,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import TestSCons
import os
-import string
test = TestSCons.TestSCons()
@@ -37,7 +36,7 @@ barflags = e['SHCFLAGS'] + ' -DBAR'
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
-if string.find(sys.platform, 'irix') > -1:
+if sys.platform.find('irix') > -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'
test.write('SConstruct', """
diff --git a/test/CFILESUFFIX.py b/test/CFILESUFFIX.py
index e167155..1a81240 100644
--- a/test/CFILESUFFIX.py
+++ b/test/CFILESUFFIX.py
@@ -38,12 +38,11 @@ test = TestSCons.TestSCons()
test.write('mylex.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 't', [])
for a in args:
contents = open(a, 'rb').read()
- sys.stdout.write(string.replace(contents, 'LEX', 'mylex.py'))
+ sys.stdout.write(contents.replace('LEX', 'mylex.py'))
sys.exit(0)
""")
diff --git a/test/CPPPATH/absolute-path.py b/test/CPPPATH/absolute-path.py
index 1fe6230..f414e09 100644
--- a/test/CPPPATH/absolute-path.py
+++ b/test/CPPPATH/absolute-path.py
@@ -30,7 +30,6 @@ is not strictly a test of using $CPPPATH, but it's in the ball park...)
"""
import os
-import string
import TestSCons
@@ -45,7 +44,7 @@ does_not_exist_h = test.workpath('include', 'does_not_exist.h')
# Verify that including an absolute path still works even if they
# double the separators in the input file. This can happen especially
# on Windows if they use \\ to represent an escaped backslash.
-inc2_h = string.replace(inc2_h, os.sep, os.sep+os.sep)
+inc2_h = inc2_h.replace(os.sep, os.sep+os.sep)
test.write(['work', 'SConstruct'], """\
Program('prog.c')
diff --git a/test/CVS.py b/test/CVS.py
index b702d98..eb2553d 100644
--- a/test/CVS.py
+++ b/test/CVS.py
@@ -91,10 +91,9 @@ test.write(['work1', 'SConstruct'], """
import os
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(ENV = { 'PATH' : os.environ['PATH'],
'EDITOR' : os.environ.get('EDITOR', 'ed') },
@@ -156,10 +155,9 @@ test.write(['work2', 'SConstruct'], """
import os
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(ENV = { 'PATH' : os.environ['PATH'],
'EDITOR' : os.environ.get('EDITOR', 'ed') },
@@ -228,10 +226,9 @@ test.write(['work3', 'SConstruct'], """\
import os
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(ENV = { 'PATH' : os.environ['PATH'],
'EDITOR' : os.environ.get('EDITOR', 'ed') },
diff --git a/test/CVSCOM.py b/test/CVSCOM.py
index 79acb5a..546e777 100644
--- a/test/CVSCOM.py
+++ b/test/CVSCOM.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'CVS'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/CVSCOMSTR.py b/test/CVSCOMSTR.py
index ae42841..d45bca6 100644
--- a/test/CVSCOMSTR.py
+++ b/test/CVSCOMSTR.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'CVS'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/CXX/CXX.py b/test/CXX/CXX.py
index e6bc82b..1e338a6 100644
--- a/test/CXX/CXX.py
+++ b/test/CXX/CXX.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -39,7 +38,6 @@ test = TestSCons.TestSCons()
if sys.platform == 'win32':
test.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -47,7 +45,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
@@ -179,11 +177,10 @@ env.Program(target = 'test6', source = 'test6.C')
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/CXX/CXXCOM.py b/test/CXX/CXXCOM.py
index f623eaf..a3da81a 100644
--- a/test/CXX/CXXCOM.py
+++ b/test/CXX/CXXCOM.py
@@ -41,7 +41,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:7] != '/*c++*/', infile.readlines()):
+for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CXX/CXXCOMSTR.py b/test/CXX/CXXCOMSTR.py
index ebacd19..9d54e91 100644
--- a/test/CXX/CXXCOMSTR.py
+++ b/test/CXX/CXXCOMSTR.py
@@ -42,7 +42,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*c++*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CXX/CXXFILESUFFIX.py b/test/CXX/CXXFILESUFFIX.py
index 749ca69..8439aef 100644
--- a/test/CXX/CXXFILESUFFIX.py
+++ b/test/CXX/CXXFILESUFFIX.py
@@ -34,12 +34,11 @@ test = TestSCons.TestSCons()
test.write('mylex.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 't', [])
for a in args:
contents = open(a, 'rb').read()
- sys.stdout.write(string.replace(contents, 'LEX', 'mylex.py'))
+ sys.stdout.write(contents.replace('LEX', 'mylex.py'))
sys.exit(0)
""")
diff --git a/test/CXX/CXXFLAGS.py b/test/CXX/CXXFLAGS.py
index f83fe48..8d72708 100644
--- a/test/CXX/CXXFLAGS.py
+++ b/test/CXX/CXXFLAGS.py
@@ -30,7 +30,6 @@ and shared object files.
"""
import os
-import string
import sys
import TestSCons
@@ -39,7 +38,7 @@ _obj = TestSCons._obj
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
-if string.find(sys.platform, 'irix') > -1:
+if sys.platform.find('irix') > -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'
test = TestSCons.TestSCons()
diff --git a/test/CXX/SHCXX.py b/test/CXX/SHCXX.py
index 6351cfe..9a78881 100644
--- a/test/CXX/SHCXX.py
+++ b/test/CXX/SHCXX.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -35,11 +34,10 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/CXX/SHCXXCOM.py b/test/CXX/SHCXXCOM.py
index 7c5e45f..0f0940b 100644
--- a/test/CXX/SHCXXCOM.py
+++ b/test/CXX/SHCXXCOM.py
@@ -41,7 +41,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l[:7] != '/*c++*/', infile.readlines()):
+for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CXX/SHCXXCOMSTR.py b/test/CXX/SHCXXCOMSTR.py
index afe647a..716c9ad 100644
--- a/test/CXX/SHCXXCOMSTR.py
+++ b/test/CXX/SHCXXCOMSTR.py
@@ -42,7 +42,7 @@ test.write('mycc.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*c++*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*c++*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/CXX/SHCXXFLAGS.py b/test/CXX/SHCXXFLAGS.py
index a4d552e..343be30 100644
--- a/test/CXX/SHCXXFLAGS.py
+++ b/test/CXX/SHCXXFLAGS.py
@@ -29,7 +29,6 @@ Verify that $SHCXXFLAGS settings are used to build shared object files.
"""
import os
-import string
import sys
import TestSCons
@@ -38,7 +37,7 @@ _obj = TestSCons._obj
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
-if string.find(sys.platform, 'irix') > -1:
+if sys.platform.find('irix') > -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'
test = TestSCons.TestSCons()
diff --git a/test/CacheDir/CacheDir.py b/test/CacheDir/CacheDir.py
index c72b2d0..9abe0e0 100644
--- a/test/CacheDir/CacheDir.py
+++ b/test/CacheDir/CacheDir.py
@@ -53,10 +53,9 @@ test.write(['src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/CacheDir/VariantDir.py b/test/CacheDir/VariantDir.py
index 8ba3e78..b665fe3 100644
--- a/test/CacheDir/VariantDir.py
+++ b/test/CacheDir/VariantDir.py
@@ -43,10 +43,9 @@ test.write(['src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/CacheDir/debug.py b/test/CacheDir/debug.py
index 94880be..307687d 100644
--- a/test/CacheDir/debug.py
+++ b/test/CacheDir/debug.py
@@ -53,10 +53,9 @@ test.write(['src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/CacheDir/environment.py b/test/CacheDir/environment.py
index 297d46d..4fb9b51 100644
--- a/test/CacheDir/environment.py
+++ b/test/CacheDir/environment.py
@@ -54,10 +54,9 @@ test.write(['src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env_cache = Environment(BUILDERS={'Cat':Builder(action=cat)})
env_nocache = env_cache.Clone()
diff --git a/test/CacheDir/option--cd.py b/test/CacheDir/option--cd.py
index 9b9f2f7..b77cfeb 100644
--- a/test/CacheDir/option--cd.py
+++ b/test/CacheDir/option--cd.py
@@ -42,10 +42,9 @@ test.write(['src', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/CacheDir/option--cf.py b/test/CacheDir/option--cf.py
index b223755..6d64059 100644
--- a/test/CacheDir/option--cf.py
+++ b/test/CacheDir/option--cf.py
@@ -41,10 +41,9 @@ test.write(['src', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/CacheDir/option--cs.py b/test/CacheDir/option--cs.py
index df1a87f..b6bb52a 100644
--- a/test/CacheDir/option--cs.py
+++ b/test/CacheDir/option--cs.py
@@ -57,10 +57,9 @@ test.write(['src1', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
open('cat.out', 'ab').write(target + "\\n")
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Internal':Builder(action=cat),
'External':Builder(action='%(_python_)s build.py $TARGET $SOURCES')})
diff --git a/test/Case.py b/test/Case.py
index 435ca4a..fb6821d 100644
--- a/test/Case.py
+++ b/test/Case.py
@@ -24,7 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
import sys
import TestSCons
@@ -73,7 +72,7 @@ if sys.platform in ['cygwin', 'win32']:
sys.stdout.flush()
test.run(stderr = None, status = None)
- test.fail_test(string.split(test.stderr(), '\n')[0] ==
+ test.fail_test(test.stderr().split('\n')[0] ==
"scons: *** Multiple ways to build the same target were specified for: foo.o")
else:
diff --git a/test/Chmod.py b/test/Chmod.py
index cf31d00..c00aea0 100644
--- a/test/Chmod.py
+++ b/test/Chmod.py
@@ -45,10 +45,9 @@ Execute(Chmod('d2', 0777))
Execute(Chmod(Dir('d2-Dir'), 0777))
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
diff --git a/test/Climb/explicit-parent--D.py b/test/Climb/explicit-parent--D.py
index da58b38..f894e33 100644
--- a/test/Climb/explicit-parent--D.py
+++ b/test/Climb/explicit-parent--D.py
@@ -38,10 +38,9 @@ test.subdir(['subdir'])
test.write('SConstruct', """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('f1.out', 'f1.in')
diff --git a/test/Climb/explicit-parent--U.py b/test/Climb/explicit-parent--U.py
index 18cb589..ab2d33e 100644
--- a/test/Climb/explicit-parent--U.py
+++ b/test/Climb/explicit-parent--U.py
@@ -38,10 +38,9 @@ test.subdir('subdir')
test.write('SConstruct', """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('foo.out', 'foo.in')
diff --git a/test/Climb/explicit-parent-u.py b/test/Climb/explicit-parent-u.py
index 633a4d3..e3e774e 100644
--- a/test/Climb/explicit-parent-u.py
+++ b/test/Climb/explicit-parent-u.py
@@ -39,10 +39,9 @@ test.subdir('subdir')
test.write('SConstruct', """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('f1.out', 'f1.in')
diff --git a/test/Climb/option-u.py b/test/Climb/option-u.py
index 6fc2720..eeb2ccc 100644
--- a/test/Climb/option-u.py
+++ b/test/Climb/option-u.py
@@ -43,10 +43,9 @@ test.subdir('sub1',
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment()
env.Append(BUILDERS = {'Cat' : Builder(action=cat)})
diff --git a/test/Configure/config-h.py b/test/Configure/config-h.py
index 9276ec8..cda6c3b 100644
--- a/test/Configure/config-h.py
+++ b/test/Configure/config-h.py
@@ -30,14 +30,13 @@ Verify creation of a config.h file from a Configure context.
import os
import re
-import string
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_exact)
lib = test.Configure_lib
-LIB = "LIB" + string.upper(lib)
+LIB = "LIB" + lib.upper()
test.write('SConstruct', """\
env = Environment()
@@ -85,7 +84,7 @@ scons: Configure: creating config.h
expected_stdout = test.wrap_stdout(build_str=expected_build_str,
read_str=expected_read_str)
-expected_config_h = string.replace("""\
+expected_config_h = ("""\
#ifndef CONFIG_H_SEEN
#define CONFIG_H_SEEN
@@ -130,7 +129,7 @@ expected_config_h = string.replace("""\
/* #undef HAVE_LIBHOPEFULLYNOLIB2 */
#endif /* CONFIG_H_SEEN */
-""" % locals(), "\n", os.linesep)
+""" % locals()).replace("\n", os.linesep)
test.run(stdout=expected_stdout)
@@ -157,7 +156,7 @@ expected_read_str = re.sub(r'\b((yes)|(no))\b',
expected_build_str = "scons: `.' is up to date.\n"
expected_stdout = test.wrap_stdout(build_str=expected_build_str,
read_str=expected_read_str)
-#expected_stdout = string.replace(expected_stdout, "\n", os.linesep)
+#expected_stdout = expected_stdout.replace("\n", os.linesep)
test.run(stdout=expected_stdout)
diff --git a/test/Copy-Action.py b/test/Copy-Action.py
index 6e9c54f..f64defe 100644
--- a/test/Copy-Action.py
+++ b/test/Copy-Action.py
@@ -43,10 +43,9 @@ Execute(Copy(File('d2.out'), 'd2.in'))
Execute(Copy('d3.out', File('f3.in')))
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
@@ -155,9 +154,9 @@ errors = 0
def must_be_same(f1, f2):
global errors
if type(f1) is type([]):
- f1 = apply(os.path.join, f1)
+ f1 = os.path.join(*f1)
if type(f2) is type([]):
- f2 = apply(os.path.join, f2)
+ f2 = os.path.join(*f2)
s1 = os.stat(f1)
s2 = os.stat(f2)
for value in ['ST_MODE', 'ST_MTIME']:
diff --git a/test/DVIPDF/DVIPDF.py b/test/DVIPDF/DVIPDF.py
index 7b3e292..e760741 100644
--- a/test/DVIPDF/DVIPDF.py
+++ b/test/DVIPDF/DVIPDF.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -110,12 +108,11 @@ tex = test.where_is('tex')
if dvipdf and tex:
test.write("wrapper.py", """import os
-import string
import sys
-cmd = string.join(sys.argv[1:], " ")
+cmd = " ".join(sys.argv[1:])
open('%s', 'ab').write("%%s\\n" %% cmd)
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/DVIPDF/DVIPDFCOM.py b/test/DVIPDF/DVIPDFCOM.py
index 1ff5a3d..362279e 100644
--- a/test/DVIPDF/DVIPDFCOM.py
+++ b/test/DVIPDF/DVIPDFCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*pdf*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*pdf*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/DVIPDF/DVIPDFCOMSTR.py b/test/DVIPDF/DVIPDFCOMSTR.py
index 8b048bb..0063e84 100644
--- a/test/DVIPDF/DVIPDFCOMSTR.py
+++ b/test/DVIPDF/DVIPDFCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*pdf*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*pdf*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/DVIPDF/DVIPDFFLAGS.py b/test/DVIPDF/DVIPDFFLAGS.py
index 93a435f..4d03644 100644
--- a/test/DVIPDF/DVIPDFFLAGS.py
+++ b/test/DVIPDF/DVIPDFFLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -114,12 +112,11 @@ tex = test.where_is('tex')
if dvipdf and tex:
test.write("wrapper.py", """import os
-import string
import sys
-cmd = string.join(sys.argv[1:], " ")
+cmd = " ".join(sys.argv[1:])
open('%s', 'ab').write("%%s\\n" %% cmd)
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/DVIPS/DVIPS.py b/test/DVIPS/DVIPS.py
index 540869d..e28a121 100644
--- a/test/DVIPS/DVIPS.py
+++ b/test/DVIPS/DVIPS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -122,12 +120,11 @@ dvips = test.where_is('dvips')
if dvips:
test.write("wrapper.py", """import os
-import string
import sys
-cmd = string.join(sys.argv[1:], " ")
+cmd = " ".join(sys.argv[1:])
open('%s', 'ab').write("%%s\\n" %% cmd)
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/DVIPS/DVIPSFLAGS.py b/test/DVIPS/DVIPSFLAGS.py
index a5be0a2..285c729 100644
--- a/test/DVIPS/DVIPSFLAGS.py
+++ b/test/DVIPS/DVIPSFLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -129,12 +127,11 @@ dvips = test.where_is('dvips')
if dvips:
test.write("wrapper.py", """import os
-import string
import sys
-cmd = string.join(sys.argv[1:], " ")
+cmd = " ".join(sys.argv[1:])
open('%s', 'ab').write("%%s\\n" %% cmd)
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/DVIPS/PSCOM.py b/test/DVIPS/PSCOM.py
index 3e1e5e9..fe4832b 100644
--- a/test/DVIPS/PSCOM.py
+++ b/test/DVIPS/PSCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*ps*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*ps*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/DVIPS/PSCOMSTR.py b/test/DVIPS/PSCOMSTR.py
index 96814a0..7c57ded 100644
--- a/test/DVIPS/PSCOMSTR.py
+++ b/test/DVIPS/PSCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*ps*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*ps*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Delete.py b/test/Delete.py
index 20dc889..f3dfcb6 100644
--- a/test/Delete.py
+++ b/test/Delete.py
@@ -39,10 +39,9 @@ Execute(Delete('f1'))
Execute(Delete('d2'))
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
@@ -164,10 +163,9 @@ test.must_match('f16.out', "f16.in\n")
test.write("SConstruct", """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
diff --git a/test/Deprecated/BuildDir.py b/test/Deprecated/BuildDir.py
index 02ef139..e8755da 100644
--- a/test/Deprecated/BuildDir.py
+++ b/test/Deprecated/BuildDir.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -32,8 +33,6 @@ under the covers).
Note that using BuildDir() does not yet print a deprecation warning.
"""
-import string
-
import TestSCons
_exe = TestSCons._exe
@@ -191,10 +190,9 @@ test.write(['work1', 'src', 'f4h.in'], r"""
def blank_output(err):
if not err:
return 1
- stderrlines = filter(lambda l: l, string.split(err, '\n'))
+ stderrlines = [l for l in err.split('\n') if l]
msg = "warning: tempnam() possibly used unsafely"
- stderrlines = filter(lambda l, msg=msg: string.find(l, msg) == -1,
- stderrlines)
+ stderrlines = [l for l in stderrlines if l.find(msg) == -1]
return len(stderrlines) == 0
test.run(chdir='work1', arguments = '. ../build', stderr=None)
diff --git a/test/Deprecated/Options/BoolOption.py b/test/Deprecated/Options/BoolOption.py
index 57a44c8..d99544f 100644
--- a/test/Deprecated/Options/BoolOption.py
+++ b/test/Deprecated/Options/BoolOption.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test the BoolOption canned Option type.
"""
-import string
-
try:
True, False
except NameError:
@@ -43,7 +41,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
diff --git a/test/Deprecated/Options/EnumOption.py b/test/Deprecated/Options/EnumOption.py
index 26b14d8..6756f09 100644
--- a/test/Deprecated/Options/EnumOption.py
+++ b/test/Deprecated/Options/EnumOption.py
@@ -29,7 +29,6 @@ Test the EnumOption canned Option type.
"""
import os.path
-import string
import TestSCons
@@ -38,7 +37,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
diff --git a/test/Deprecated/Options/ListOption.py b/test/Deprecated/Options/ListOption.py
index 28983d2..bb3775b 100644
--- a/test/Deprecated/Options/ListOption.py
+++ b/test/Deprecated/Options/ListOption.py
@@ -29,7 +29,6 @@ Test the ListOption canned Option type.
"""
import os
-import string
import TestSCons
@@ -39,7 +38,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
r = result[1:len(expect)+1]
assert r == expect, (r, expect)
diff --git a/test/Deprecated/Options/Options.py b/test/Deprecated/Options/Options.py
index d1c7114..8116a63 100644
--- a/test/Deprecated/Options/Options.py
+++ b/test/Deprecated/Options/Options.py
@@ -25,23 +25,19 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
-import string
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
test.write('SConstruct', """
-import string
env = Environment()
print env['CC']
-print string.join(env['CCFLAGS'])
+print " ".join(env['CCFLAGS'])
Default(env.Alias('dummy', None))
""")
test.run()
-cc, ccflags = string.split(test.stdout(), '\n')[1:3]
+cc, ccflags = test.stdout().split('\n')[1:3]
test.write('SConstruct', """
-import string
-
# test validator. Change a key and add a new one to the environment
def validator(key, value, environ):
environ[key] = "v"
@@ -106,15 +102,15 @@ Help('Variables settable in custom.py or on the command line:\\n' + opts.Generat
print env['RELEASE_BUILD']
print env['DEBUG_BUILD']
print env['CC']
-print string.join(env['CCFLAGS'])
+print " ".join(env['CCFLAGS'])
print env['VALIDATE']
print env['valid_key']
# unspecified options should not be set:
-assert not env.has_key('UNSPECIFIED')
+assert 'UNSPECIFIED' not in env
# undeclared options should be ignored:
-assert not env.has_key('UNDECLARED')
+assert 'UNDECLARED' not in env
# calling Update() should not effect options that
# are not declared on the options object:
@@ -133,26 +129,26 @@ scons: warning: The Options class is deprecated; use the Variables class instead
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
test.run(stderr=warnings)
-check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v'])
test.run(arguments='RELEASE_BUILD=1', stderr=warnings)
-check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
+check(['1', '1', cc, (ccflags + ' -O -g').strip(), 'v', 'v'])
test.run(arguments='RELEASE_BUILD=1 DEBUG_BUILD=0', stderr=warnings)
-check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
+check(['1', '0', cc, (ccflags + ' -O').strip(), 'v', 'v'])
test.run(arguments='CC=not_a_c_compiler', stderr=warnings)
-check(['0', '1', 'not_a_c_compiler', string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', 'not_a_c_compiler', (ccflags + ' -g').strip(), 'v', 'v'])
test.run(arguments='UNDECLARED=foo', stderr=warnings)
-check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v'])
test.run(arguments='CCFLAGS=--taco', stderr=warnings)
-check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v'])
test.write('custom.py', """
DEBUG_BUILD=0
@@ -160,10 +156,10 @@ RELEASE_BUILD=1
""")
test.run(stderr=warnings)
-check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
+check(['1', '0', cc, (ccflags + ' -O').strip(), 'v', 'v'])
test.run(arguments='DEBUG_BUILD=1', stderr=warnings)
-check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
+check(['1', '1', cc, (ccflags + ' -O -g').strip(), 'v', 'v'])
test.run(arguments='-h',
stdout = """\
diff --git a/test/Deprecated/Options/PackageOption.py b/test/Deprecated/Options/PackageOption.py
index bb39653..b9f0400 100644
--- a/test/Deprecated/Options/PackageOption.py
+++ b/test/Deprecated/Options/PackageOption.py
@@ -29,7 +29,6 @@ Test the PackageOption canned Option type.
"""
import os.path
-import string
try:
True, False
@@ -44,7 +43,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
diff --git a/test/Deprecated/Options/PathOption.py b/test/Deprecated/Options/PathOption.py
index 3c73617..4701420 100644
--- a/test/Deprecated/Options/PathOption.py
+++ b/test/Deprecated/Options/PathOption.py
@@ -31,7 +31,6 @@ various canned validators.
import os.path
import re
-import string
import TestSCons
@@ -40,7 +39,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
#### test PathOption ####
diff --git a/test/Deprecated/SConscript-build_dir.py b/test/Deprecated/SConscript-build_dir.py
index d54f3af..41b5222 100644
--- a/test/Deprecated/SConscript-build_dir.py
+++ b/test/Deprecated/SConscript-build_dir.py
@@ -61,10 +61,9 @@ var9 = Dir('../build/var9')
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/Deprecated/debug-stree.py b/test/Deprecated/debug-stree.py
index 43a370a..907dedf 100644
--- a/test/Deprecated/debug-stree.py
+++ b/test/Deprecated/debug-stree.py
@@ -29,8 +29,6 @@ Test that the --debug=stree option prints a dependency tree with output
that indicates the state of various Node status flags.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
@@ -98,7 +96,7 @@ stree = """
test.run(arguments = "--debug=stree foo.xxx",
stderr = stderr)
-test.fail_test(string.count(test.stdout(), stree) != 1)
+test.fail_test(test.stdout().count(stree) != 1)
stree2 = """
E = exists
@@ -130,7 +128,7 @@ test.run(arguments = '-c foo.xxx')
test.run(arguments = "--no-exec --debug=stree foo.xxx",
stderr = stderr)
-test.fail_test(string.count(test.stdout(), stree2) != 1)
+test.fail_test(test.stdout().count(stree2) != 1)
test.pass_test()
diff --git a/test/ESCAPE.py b/test/ESCAPE.py
index 68835f1..0651b92 100644
--- a/test/ESCAPE.py
+++ b/test/ESCAPE.py
@@ -43,13 +43,12 @@ ofp.close()
""")
test.write('SConstruct', """\
-import string
# We still need to run this through the original ESCAPE function,
# because that's set up to work in tandem with the existing SHELL,
# which we're not replacing.
orig_escape = Environment()['ESCAPE']
def my_escape(s):
- s = string.replace(s, 'file.in', 'file.xxx')
+ s = s.replace('file.in', 'file.xxx')
return orig_escape(s)
env = Environment(ESCAPE = my_escape)
env.Command('file.out', 'file.in', '%(_python_)s cat.py $TARGET $SOURCES')
diff --git a/test/Errors/InternalError.py b/test/Errors/InternalError.py
index 032c7a7..49d9fdd 100644
--- a/test/Errors/InternalError.py
+++ b/test/Errors/InternalError.py
@@ -35,7 +35,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
# Test InternalError.
test.write('SConstruct', """
-assert not globals().has_key("InternalError")
+assert "InternalError" not in globals()
from SCons.Errors import InternalError
raise InternalError, 'error inside'
""")
diff --git a/test/Errors/UserError.py b/test/Errors/UserError.py
index c534ed6..0212a52 100644
--- a/test/Errors/UserError.py
+++ b/test/Errors/UserError.py
@@ -34,7 +34,7 @@ import TestSCons
test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
test.write('SConstruct', """
-assert not globals().has_key("UserError")
+assert "UserError" not in globals()
import SCons.Errors
raise SCons.Errors.UserError, 'Depends() requires both sources and targets.'
""")
diff --git a/test/Errors/execute-a-directory.py b/test/Errors/execute-a-directory.py
index e02dcb0..bf2c246 100644
--- a/test/Errors/execute-a-directory.py
+++ b/test/Errors/execute-a-directory.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -41,7 +40,7 @@ test.write('SConstruct', r"""
bld = Builder(action = '%s $SOURCES $TARGET')
env = Environment(BUILDERS = { 'bld' : bld })
env.bld(target = 'f3', source = 'f3.in')
-""" % string.replace(test.workdir, '\\', '\\\\'))
+""" % test.workdir.replace('\\', '\\\\'))
test.run(arguments='.',
stdout = test.wrap_stdout("%s f3.in f3\n" % test.workdir, error=1),
diff --git a/test/Errors/non-executable-file.py b/test/Errors/non-executable-file.py
index dc6b606..e51dc85 100644
--- a/test/Errors/non-executable-file.py
+++ b/test/Errors/non-executable-file.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -72,7 +71,7 @@ test.write('SConstruct', r"""
bld = Builder(action = '%s $SOURCES $TARGET')
env = Environment(BUILDERS = { 'bld': bld })
env.bld(target = 'f1', source = 'f1.in')
-""" % string.replace(not_executable, '\\', '\\\\'))
+""" % not_executable.replace('\\', '\\\\'))
test.run(arguments='.',
stdout = test.wrap_stdout("%s f1.in f1\n" % not_executable, error=1),
diff --git a/test/Errors/nonexistent-executable.py b/test/Errors/nonexistent-executable.py
index ab6d118..1272e81 100644
--- a/test/Errors/nonexistent-executable.py
+++ b/test/Errors/nonexistent-executable.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -39,7 +38,7 @@ test.write('SConstruct', r"""
bld = Builder(action = '%s $SOURCES $TARGET')
env = Environment(BUILDERS = { 'bld' : bld })
env.bld(target = 'f1', source = 'f1.in')
-""" % string.replace(no_such_file, '\\', '\\\\'))
+""" % no_such_file.replace('\\', '\\\\'))
test.run(arguments='.',
stdout = test.wrap_stdout("%s f1.in f1\n" % no_such_file, error=1),
diff --git a/test/Exit.py b/test/Exit.py
index 98d6bba..877a0b6 100644
--- a/test/Exit.py
+++ b/test/Exit.py
@@ -104,10 +104,9 @@ SConscript('subdir/SConscript')
test.write(['subdir', 'SConscript'], """\
def exit_builder(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Exit(27)
env = Environment(BUILDERS = {'my_exit' : Builder(action=exit_builder)})
@@ -134,11 +133,9 @@ exitscan = Scanner(function = exit_scanner, skeys = ['.k'])
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
-
outf = open(target, 'wb')
for src in source:
- outf.write(open(src, "rb").read())
+ outf.write(open(str(src), "rb").read())
outf.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
diff --git a/test/Flatten.py b/test/Flatten.py
index 2fae80b..b41c4fe 100644
--- a/test/Flatten.py
+++ b/test/Flatten.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test that the Flatten() function is available and works.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -39,16 +37,15 @@ test.subdir('work')
test.write(['work', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
f1 = env.Cat('../file1.out', 'file1.in')
f2 = env.Cat('../file2.out', ['file2a.in', 'file2b.in'])
-print map(str, Flatten(['begin', f1, 'middle', f2, 'end']))
-print map(str, env.Flatten([f1, [['a', 'b'], 'c'], f2]))
+print list(map(str, Flatten(['begin', f1, 'middle', f2, 'end'])))
+print list(map(str, env.Flatten([f1, [['a', 'b'], 'c'], f2])))
SConscript('SConscript', "env")
""")
@@ -64,7 +61,7 @@ test.write('file2b.in', "file2b.in\n")
def double_backslash(f):
p = test.workpath(f)
- return string.replace(p, '\\', '\\\\')
+ return p.replace('\\', '\\\\')
expect = """\
['begin', '%s', 'middle', '%s', 'end']
diff --git a/test/Fortran/F77.py b/test/Fortran/F77.py
index 2dc1bbf..0ebd7ee 100644
--- a/test/Fortran/F77.py
+++ b/test/Fortran/F77.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
from common import write_fake_link
@@ -100,11 +98,10 @@ if f77:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(F77 = '%(fc)s', tools = ['default', 'f77'], F77FILESUFFIXES = ['.f'])
diff --git a/test/Fortran/F77COMSTR.py b/test/Fortran/F77COMSTR.py
index 502473a..6c89833 100644
--- a/test/Fortran/F77COMSTR.py
+++ b/test/Fortran/F77COMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/F77FLAGS.py b/test/Fortran/F77FLAGS.py
index 70ef51c..b708f9e 100644
--- a/test/Fortran/F77FLAGS.py
+++ b/test/Fortran/F77FLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
from common import write_fake_link
@@ -81,11 +79,10 @@ if g77:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(F77 = '%(fc)s', tools = ['default', 'f77'], F77FILESUFFIXES = [".f"])
diff --git a/test/Fortran/F90.py b/test/Fortran/F90.py
index 7c31ee6..d7c73c6 100644
--- a/test/Fortran/F90.py
+++ b/test/Fortran/F90.py
@@ -100,11 +100,10 @@ if g90:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(F90 = '%(fc)s')
diff --git a/test/Fortran/F90COMSTR.py b/test/Fortran/F90COMSTR.py
index eec5795..117a5a9 100644
--- a/test/Fortran/F90COMSTR.py
+++ b/test/Fortran/F90COMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/F90FLAGS.py b/test/Fortran/F90FLAGS.py
index 5f8df8d..f0b3003 100644
--- a/test/Fortran/F90FLAGS.py
+++ b/test/Fortran/F90FLAGS.py
@@ -107,11 +107,10 @@ if g90:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(F90 = '%(fc)s')
diff --git a/test/Fortran/F95.py b/test/Fortran/F95.py
index eeadac7..e7745b1 100644
--- a/test/Fortran/F95.py
+++ b/test/Fortran/F95.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
from common import write_fake_link
@@ -102,11 +100,10 @@ if g95:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(F95 = '%(fc)s')
diff --git a/test/Fortran/F95COMSTR.py b/test/Fortran/F95COMSTR.py
index 1f9734a..5d162f9 100644
--- a/test/Fortran/F95COMSTR.py
+++ b/test/Fortran/F95COMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/F95FLAGS.py b/test/Fortran/F95FLAGS.py
index 86fd9f5..de18858 100644
--- a/test/Fortran/F95FLAGS.py
+++ b/test/Fortran/F95FLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
from common import write_fake_link
@@ -109,11 +107,10 @@ if g95:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(F95 = '%(fc)s')
diff --git a/test/Fortran/FORTRAN.py b/test/Fortran/FORTRAN.py
index 96f2749..df73ea6 100644
--- a/test/Fortran/FORTRAN.py
+++ b/test/Fortran/FORTRAN.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
from common import write_fake_link
@@ -95,11 +93,10 @@ if f77:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(FORTRAN = '%(fc)s')
diff --git a/test/Fortran/FORTRANCOMSTR.py b/test/Fortran/FORTRANCOMSTR.py
index ba923d3..5efa820 100644
--- a/test/Fortran/FORTRANCOMSTR.py
+++ b/test/Fortran/FORTRANCOMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/FORTRANFLAGS.py b/test/Fortran/FORTRANFLAGS.py
index 3424bfd..8c5e781 100644
--- a/test/Fortran/FORTRANFLAGS.py
+++ b/test/Fortran/FORTRANFLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
from common import write_fake_link
@@ -99,11 +97,10 @@ if g77:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(FORTRAN = '%(fc)s')
diff --git a/test/Fortran/FORTRANMODDIR.py b/test/Fortran/FORTRANMODDIR.py
index 96a341a..3c14632 100644
--- a/test/Fortran/FORTRANMODDIR.py
+++ b/test/Fortran/FORTRANMODDIR.py
@@ -36,12 +36,11 @@ test = TestSCons.TestSCons()
test.write('myfortran.py', r"""
import os.path
import re
-import string
import sys
mod_regex = "(?im)^\\s*MODULE\\s+(?!PROCEDURE)(\\w+)"
contents = open(sys.argv[2]).read()
modules = re.findall(mod_regex, contents)
-modules = map(lambda m: os.path.join(sys.argv[1], string.lower(m)+'.mod'), modules)
+modules = [os.path.join(sys.argv[1], m.lower()+'.mod') for m in modules]
for t in sys.argv[3:] + modules:
open(t, 'wb').write('myfortran.py wrote %s\n' % os.path.split(t)[1])
sys.exit(0)
diff --git a/test/Fortran/SHF77.py b/test/Fortran/SHF77.py
index 9cc569a..ff2a0ca 100644
--- a/test/Fortran/SHF77.py
+++ b/test/Fortran/SHF77.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -98,11 +96,10 @@ if f77:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHF77 = '%(fc)s')
diff --git a/test/Fortran/SHF77COMSTR.py b/test/Fortran/SHF77COMSTR.py
index 9ca6631..7a43a4a 100644
--- a/test/Fortran/SHF77COMSTR.py
+++ b/test/Fortran/SHF77COMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/SHF77FLAGS.py b/test/Fortran/SHF77FLAGS.py
index f3939b6..7d55a91 100644
--- a/test/Fortran/SHF77FLAGS.py
+++ b/test/Fortran/SHF77FLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -79,11 +77,10 @@ if g77:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHF77 = '%(fc)s')
diff --git a/test/Fortran/SHF90.py b/test/Fortran/SHF90.py
index dc5f1de..486b57b 100644
--- a/test/Fortran/SHF90.py
+++ b/test/Fortran/SHF90.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -100,11 +98,10 @@ if g90:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHF90 = '%(fc)s')
diff --git a/test/Fortran/SHF90COMSTR.py b/test/Fortran/SHF90COMSTR.py
index 61045ee..a3353fa 100644
--- a/test/Fortran/SHF90COMSTR.py
+++ b/test/Fortran/SHF90COMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/SHF90FLAGS.py b/test/Fortran/SHF90FLAGS.py
index 88ae656..7ff3a43 100644
--- a/test/Fortran/SHF90FLAGS.py
+++ b/test/Fortran/SHF90FLAGS.py
@@ -103,11 +103,10 @@ if g90:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHF90 = '%(fc)s')
diff --git a/test/Fortran/SHF95.py b/test/Fortran/SHF95.py
index a6b1f6d..0b64923 100644
--- a/test/Fortran/SHF95.py
+++ b/test/Fortran/SHF95.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -99,11 +97,10 @@ if g95:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHF95 = '%(fc)s')
diff --git a/test/Fortran/SHF95COMSTR.py b/test/Fortran/SHF95COMSTR.py
index 0124727..5aec6b0 100644
--- a/test/Fortran/SHF95COMSTR.py
+++ b/test/Fortran/SHF95COMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/SHF95FLAGS.py b/test/Fortran/SHF95FLAGS.py
index e3d36a0..b809d22 100644
--- a/test/Fortran/SHF95FLAGS.py
+++ b/test/Fortran/SHF95FLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -107,11 +105,10 @@ if g95:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHF95 = '%(fc)s')
diff --git a/test/Fortran/SHFORTRAN.py b/test/Fortran/SHFORTRAN.py
index 2e4bd61..d9ae55d 100644
--- a/test/Fortran/SHFORTRAN.py
+++ b/test/Fortran/SHFORTRAN.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -93,11 +91,10 @@ if fortran:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHFORTRAN = '%(fc)s')
diff --git a/test/Fortran/SHFORTRANCOMSTR.py b/test/Fortran/SHFORTRANCOMSTR.py
index a2cf47c..3b801db 100644
--- a/test/Fortran/SHFORTRANCOMSTR.py
+++ b/test/Fortran/SHFORTRANCOMSTR.py
@@ -37,7 +37,7 @@ import sys
fline = '#'+sys.argv[1]+'\n'
outfile = open(sys.argv[2], 'wb')
infile = open(sys.argv[3], 'rb')
-for l in filter(lambda l, fl=fline: l != fl, infile.readlines()):
+for l in [l for l in infile.readlines() if l != fline]:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Fortran/SHFORTRANFLAGS.py b/test/Fortran/SHFORTRANFLAGS.py
index 90f0c65..65f6a6c 100644
--- a/test/Fortran/SHFORTRANFLAGS.py
+++ b/test/Fortran/SHFORTRANFLAGS.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -95,11 +93,10 @@ if fortran:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(SHFORTRAN = '%(fc)s')
diff --git a/test/Fortran/USE-MODULE.py b/test/Fortran/USE-MODULE.py
index 2666992..8f537dd 100644
--- a/test/Fortran/USE-MODULE.py
+++ b/test/Fortran/USE-MODULE.py
@@ -36,12 +36,11 @@ test = TestSCons.TestSCons()
test.write('myfortran.py', r"""
import os.path
import re
-import string
import sys
mod_regex = "(?im)^\\s*MODULE\\s+(?!PROCEDURE)(\\w+)"
contents = open(sys.argv[1]).read()
modules = re.findall(mod_regex, contents)
-modules = map(lambda m: string.lower(m)+'.mod', modules)
+modules = [m.lower()+'.mod' for m in modules]
for t in sys.argv[2:] + modules:
open(t, 'wb').write('myfortran.py wrote %s\n' % os.path.split(t)[1])
sys.exit(0)
diff --git a/test/Fortran/common.py b/test/Fortran/common.py
index fe3f46c..b48c83b 100644
--- a/test/Fortran/common.py
+++ b/test/Fortran/common.py
@@ -34,7 +34,6 @@ def write_fake_link(t):
non-compiled) tests."""
if sys.platform == 'win32':
t.write('mylink.py', r"""
-import string
import sys
args = sys.argv[1:]
while args:
@@ -42,7 +41,7 @@ while args:
if a[0] != '/':
break
args = args[1:]
- if string.lower(a[:5]) == '/out:': out = a[5:]
+ if a[:5].lower() == '/out:': out = a[5:]
infile = open(args[0], 'rb')
outfile = open(out, 'wb')
for l in infile.readlines():
diff --git a/test/GetBuildFailures/serial.py b/test/GetBuildFailures/serial.py
index d3a9f77..a240d1e 100644
--- a/test/GetBuildFailures/serial.py
+++ b/test/GetBuildFailures/serial.py
@@ -89,14 +89,13 @@ Command('f15', 'f15.in', returnExcAction(SCons.Errors.InternalError("My Internal
def print_build_failures():
from SCons.Script import GetBuildFailures
- import string
bf_list = GetBuildFailures()
bf_list.sort(lambda a,b: cmp(str(a.node), str(b.node)))
for bf in bf_list:
assert( isinstance(bf, SCons.Errors.BuildError) )
print "BF: %%s failed (%%s): %%s" %% (bf.node, bf.status, bf.errstr)
if bf.command:
- print "BF: %%s" %% string.join(Flatten(bf.command))
+ print "BF: %%s" %% " ".join(Flatten(bf.command))
try:
import atexit
diff --git a/test/GetOption/help.py b/test/GetOption/help.py
index f20704e..e2eeef7 100644
--- a/test/GetOption/help.py
+++ b/test/GetOption/help.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test use of GetOption('help') to short-circuit work.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -46,10 +44,10 @@ test.run(arguments = '-q -Q', stdout = "no help for you\n")
expect = "GetOption('help') set"
test.run(arguments = '-q -Q -h')
-test.fail_test(string.split(test.stdout(), '\n')[0] != expect)
+test.fail_test(test.stdout().split('\n')[0] != expect)
test.run(arguments = '-q -Q --help')
-test.fail_test(string.split(test.stdout(), '\n')[0] != expect)
+test.fail_test(test.stdout().split('\n')[0] != expect)
test.pass_test()
diff --git a/test/Ghostscript/GS.py b/test/Ghostscript/GS.py
index c2e5dd7..2cae8b8 100644
--- a/test/Ghostscript/GS.py
+++ b/test/Ghostscript/GS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -76,12 +75,11 @@ if gs:
test.write("wrapper.py", """\
import os
-import string
import sys
-cmd = string.join(sys.argv[1:], " ")
+cmd = " ".join(sys.argv[1:])
open('%s', 'ab').write("%%s\\n" %% cmd)
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """\
import os
diff --git a/test/Ghostscript/GSCOM.py b/test/Ghostscript/GSCOM.py
index b43bc19..c86f8b6 100644
--- a/test/Ghostscript/GSCOM.py
+++ b/test/Ghostscript/GSCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*gs*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*gs*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Ghostscript/GSCOMSTR.py b/test/Ghostscript/GSCOMSTR.py
index acd1132..b39cf4f 100644
--- a/test/Ghostscript/GSCOMSTR.py
+++ b/test/Ghostscript/GSCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*gs*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*gs*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Ghostscript/GSFLAGS.py b/test/Ghostscript/GSFLAGS.py
index 057977e..16ad6c1 100644
--- a/test/Ghostscript/GSFLAGS.py
+++ b/test/Ghostscript/GSFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -84,12 +83,11 @@ gs = test.where_is(gs_executable)
if gs:
test.write("wrapper.py", """import os
-import string
import sys
-cmd = string.join(sys.argv[1:], " ")
+cmd = " ".join(sys.argv[1:])
open('%s', 'ab').write("%%s\\n" %% cmd)
os.system(cmd)
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """\
import os
diff --git a/test/Glob/Repository.py b/test/Glob/Repository.py
index 2b0a5bb..5783443 100644
--- a/test/Glob/Repository.py
+++ b/test/Glob/Repository.py
@@ -49,10 +49,9 @@ opts = "-Y " + test.workpath('repository')
test.write(['repository', 'SConstruct'], """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
# Verify that we can glob a repository-only Node that exists
diff --git a/test/IDL/MIDLCOM.py b/test/IDL/MIDLCOM.py
index 9005d6b..0525592 100644
--- a/test/IDL/MIDLCOM.py
+++ b/test/IDL/MIDLCOM.py
@@ -45,7 +45,7 @@ out_h = open(base + '.h', 'wb')
out_c = open(base + '_i.c', 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*midl*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*midl*/\\n']:
out_tlb.write(l)
out_h.write(l)
out_c.write(l)
diff --git a/test/IDL/MIDLCOMSTR.py b/test/IDL/MIDLCOMSTR.py
index 472526a..56f8c40 100644
--- a/test/IDL/MIDLCOMSTR.py
+++ b/test/IDL/MIDLCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*midl*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*midl*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Install/Install.py b/test/Install/Install.py
index ac84398..29a8276 100644
--- a/test/Install/Install.py
+++ b/test/Install/Install.py
@@ -29,7 +29,6 @@ Verify that the Install() Builder works
"""
import os.path
-import string
import time
import TestSCons
@@ -44,17 +43,16 @@ f3_out = test.workpath('work', 'export', 'f3.out')
f4_out = test.workpath('work', 'export', 'f4.out')
f5_txt = test.workpath('outside', 'f5.txt')
f6_txt = test.workpath('outside', 'f6.txt')
-f6_sep = string.replace(f6_txt, os.sep, '/')
+f6_sep = f6_txt.replace(os.sep, '/')
_SUBDIR_f4_out = os.path.join('$SUBDIR', 'f4.out')
test.write(['work', 'SConstruct'], """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
def my_install(dest, source, env):
diff --git a/test/Install/wrap-by-attribute.py b/test/Install/wrap-by-attribute.py
index e36d11d..912551e 100644
--- a/test/Install/wrap-by-attribute.py
+++ b/test/Install/wrap-by-attribute.py
@@ -46,10 +46,9 @@ import os.path
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(DESTDIR='dest')
diff --git a/test/Interactive/implicit-VariantDir.py b/test/Interactive/implicit-VariantDir.py
index 8975e90..5ef4583 100644
--- a/test/Interactive/implicit-VariantDir.py
+++ b/test/Interactive/implicit-VariantDir.py
@@ -37,7 +37,6 @@ deps must be cleared on the source files.
"""
import os.path
-import string
import TestSCons
@@ -94,7 +93,7 @@ test.write(['src', 'inc', 'foo.h'], """
# Start scons, to build only "build/foo"
build_foo_exe = os.path.join('build', 'foo' + TestSCons._exe)
-_build_foo_exe_ = '"%s"' % string.replace(build_foo_exe, '\\', '\\\\')
+_build_foo_exe_ = '"%s"' % build_foo_exe.replace('\\', '\\\\')
abs_foo_exe = test.workpath(build_foo_exe)
scons = test.start(arguments = '--interactive', combine=1)
diff --git a/test/Interactive/shell.py b/test/Interactive/shell.py
index 4e4907a..f4e89bd 100644
--- a/test/Interactive/shell.py
+++ b/test/Interactive/shell.py
@@ -28,7 +28,6 @@ Verify the ability of the "shell" command (and its "sh" and "!" aliases)
to shell out of interactive mode.
"""
-import string
import sys
import TestSCons
@@ -38,7 +37,7 @@ test = TestSCons.TestSCons(combine=1)
_python_ = TestSCons._python_
shell_command_py = test.workpath('shell_command.py')
-_shell_command_py_ = '"%s"' % string.replace(shell_command_py, '\\', '\\\\')
+_shell_command_py_ = '"%s"' % shell_command_py.replace('\\', '\\\\')
test.write(shell_command_py, """\
print 'hello from shell_command.py'
diff --git a/test/Java/JAR.py b/test/Java/JAR.py
index b0b193e..81664dc 100644
--- a/test/Java/JAR.py
+++ b/test/Java/JAR.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -89,9 +88,8 @@ line 3
test.write('myjar2.py', r"""
import sys
-import string
f=open(sys.argv[2], 'wb')
-f.write(string.join(sys.argv[1:]))
+f.write(" ".join(sys.argv[1:]))
f.write("\n")
f.close()
sys.exit(0)
@@ -128,11 +126,10 @@ where_jar = test.java_where_jar()
test.write("wrapper.py", """\
import os
-import string
import sys
-open('%s', 'ab').write("wrapper.py %%s\\n" %% string.join(sys.argv[1:]))
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+open('%s', 'ab').write("wrapper.py %%s\\n" %% " ".join(sys.argv[1:]))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'jar'],
@@ -238,7 +235,7 @@ 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 = string.replace(expected_wrapper_out, '/', os.sep)
+expected_wrapper_out = expected_wrapper_out.replace('/', os.sep)
test.must_match('wrapper.out',
expected_wrapper_out % locals())
diff --git a/test/Java/JARCHDIR.py b/test/Java/JARCHDIR.py
index e3f22db..d574fe7 100644
--- a/test/Java/JARCHDIR.py
+++ b/test/Java/JARCHDIR.py
@@ -34,7 +34,6 @@ ${TARGET} or ${SOURCE} work.
"""
import os
-import string
import TestSCons
@@ -100,7 +99,7 @@ test.write(['in', 's.class'], "s.class\n")
# env.subst() in the code that handle jar).
p = test.workpath('out')
-for d in string.split(test.workpath('in'), os.sep):
+for d in test.workpath('in').split(os.sep):
p = p + d
test.subdir(p)
p = p + os.sep
diff --git a/test/Java/JARCOM.py b/test/Java/JARCOM.py
index a51ea5a..9d93ba5 100644
--- a/test/Java/JARCOM.py
+++ b/test/Java/JARCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*jar*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*jar*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/JARCOMSTR.py b/test/Java/JARCOMSTR.py
index 4358f6b..069587f 100644
--- a/test/Java/JARCOMSTR.py
+++ b/test/Java/JARCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*jar*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*jar*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/JARFLAGS.py b/test/Java/JARFLAGS.py
index 7306426..c0ae627 100644
--- a/test/Java/JARFLAGS.py
+++ b/test/Java/JARFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -69,7 +68,7 @@ expect = test.wrap_stdout("""\
adding: src/Example1\.class.*
""" % locals())
-expect = string.replace(expect, '/', os.sep)
+expect = expect.replace('/', os.sep)
test.run(arguments = '.',
match=TestSCons.match_re_dotall,
diff --git a/test/Java/JAVABOOTCLASSPATH.py b/test/Java/JAVABOOTCLASSPATH.py
index e448165..6913c6a 100644
--- a/test/Java/JAVABOOTCLASSPATH.py
+++ b/test/Java/JAVABOOTCLASSPATH.py
@@ -30,7 +30,6 @@ on javac compilations.
"""
import os
-import string
import TestSCons
@@ -83,7 +82,7 @@ public class Example2
# we'll just take the easy way out and examine the -n output to see if
# the expected option shows up on the command line.
-bootclasspath = string.join(['dir1', 'dir2'], os.pathsep)
+bootclasspath = os.pathsep.join(['dir1', 'dir2'])
expect = """\
%(where_javac)s -bootclasspath %(bootclasspath)s -d class -sourcepath com com/Example1.java
diff --git a/test/Java/JAVACCOM.py b/test/Java/JAVACCOM.py
index c4eaa92..064feed 100644
--- a/test/Java/JAVACCOM.py
+++ b/test/Java/JAVACCOM.py
@@ -43,7 +43,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*javac*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*javac*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/JAVACCOMSTR.py b/test/Java/JAVACCOMSTR.py
index 23e7dfb..6440283 100644
--- a/test/Java/JAVACCOMSTR.py
+++ b/test/Java/JAVACCOMSTR.py
@@ -46,7 +46,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*javac*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*javac*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/JAVACFLAGS.py b/test/Java/JAVACFLAGS.py
index d86c267..6afd1b9 100644
--- a/test/Java/JAVACFLAGS.py
+++ b/test/Java/JAVACFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -57,7 +56,7 @@ public class Example1
""")
expected_wrapper_out = "%(where_javac)s -O -d classes -sourcepath src src/Example1.java\n"
-expected_wrapper_out = string.replace(expected_wrapper_out, '/', os.sep)
+expected_wrapper_out = expected_wrapper_out.replace('/', os.sep)
test.run(arguments = '.',
stdout = test.wrap_stdout(expected_wrapper_out % locals()))
diff --git a/test/Java/JAVAH.py b/test/Java/JAVAH.py
index 2518928..f7c9dcc 100644
--- a/test/Java/JAVAH.py
+++ b/test/Java/JAVAH.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -105,11 +104,10 @@ if java_version:
test.write("wrapper.py", """\
import os
-import string
import sys
-open('%s', 'ab').write("wrapper.py %%s\\n" %% string.join(sys.argv[1:]))
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+open('%s', 'ab').write("wrapper.py %%s\\n" %% " ".join(sys.argv[1:]))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(tools = ['javac', 'javah', 'install'],
diff --git a/test/Java/JAVAHCOM.py b/test/Java/JAVAHCOM.py
index 1030380..9db897a 100644
--- a/test/Java/JAVAHCOM.py
+++ b/test/Java/JAVAHCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*javah*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*javah*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/JAVAHCOMSTR.py b/test/Java/JAVAHCOMSTR.py
index f318524..f8120d6 100644
--- a/test/Java/JAVAHCOMSTR.py
+++ b/test/Java/JAVAHCOMSTR.py
@@ -52,7 +52,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*javah*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*javah*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/Java-1.4.py b/test/Java/Java-1.4.py
index f0f5a93..9cc1d96 100644
--- a/test/Java/Java-1.4.py
+++ b/test/Java/Java-1.4.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -361,7 +362,7 @@ def classes_must_match(dir, expect):
def classes_must_not_exist(dir, expect):
global failed
- present = filter(os.path.exists, expect)
+ present = list(filter(os.path.exists, expect))
if present:
sys.stderr.write("Found the following unexpected class files in '%s' after cleaning:\n" % dir)
for c in present:
diff --git a/test/Java/Java-1.5.py b/test/Java/Java-1.5.py
index e769c22..ca9cbce 100644
--- a/test/Java/Java-1.5.py
+++ b/test/Java/Java-1.5.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -357,7 +358,7 @@ def classes_must_match(dir, expect):
def classes_must_not_exist(dir, expect):
global failed
- present = filter(os.path.exists, expect)
+ present = list(filter(os.path.exists, expect))
if present:
sys.stderr.write("Found the following unexpected class files in '%s' after cleaning:\n" % dir)
for c in present:
diff --git a/test/Java/Java-1.6.py b/test/Java/Java-1.6.py
index d107e32..ec6df54 100644
--- a/test/Java/Java-1.6.py
+++ b/test/Java/Java-1.6.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -357,7 +358,7 @@ def classes_must_match(dir, expect):
def classes_must_not_exist(dir, expect):
global failed
- present = filter(os.path.exists, expect)
+ present = list(filter(os.path.exists, expect))
if present:
sys.stderr.write("Found the following unexpected class files in '%s' after cleaning:\n" % dir)
for c in present:
diff --git a/test/Java/RMIC.py b/test/Java/RMIC.py
index f08186e..f88dd14 100644
--- a/test/Java/RMIC.py
+++ b/test/Java/RMIC.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -97,14 +96,12 @@ where_rmic = test.java_where_rmic()
test.write("wrapper.py", """\
import os
-import string
import sys
-open('%s', 'ab').write("wrapper.py %%s\\n" %% string.join(sys.argv[1:]))
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+open('%s', 'ab').write("wrapper.py %%s\\n" %% " ".join(sys.argv[1:]))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
-import string
foo = Environment(tools = ['javac', 'rmic'],
JAVAC = r'%(where_javac)s',
RMIC = r'%(where_rmic)s')
@@ -120,7 +117,7 @@ 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
# a similar friendlier way to do this.
-bar_classes = filter(lambda c: string.find(str(c), 'Hello') == -1, bar_classes)
+bar_classes = [c for c in bar_classes if str(c).find('Hello') == -1]
bar.RMIC(target = Dir('outdir2'), source = bar_classes)
""" % locals() )
diff --git a/test/Java/RMICCOM.py b/test/Java/RMICCOM.py
index 6bc50da..ba7f965 100644
--- a/test/Java/RMICCOM.py
+++ b/test/Java/RMICCOM.py
@@ -51,7 +51,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*rmic*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*rmic*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Java/RMICCOMSTR.py b/test/Java/RMICCOMSTR.py
index 8981ed7..8fe535a 100644
--- a/test/Java/RMICCOMSTR.py
+++ b/test/Java/RMICCOMSTR.py
@@ -52,7 +52,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*rmic*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*rmic*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LEX/LEX.py b/test/LEX/LEX.py
index 0ead71a..975d4e9 100644
--- a/test/LEX/LEX.py
+++ b/test/LEX/LEX.py
@@ -37,12 +37,11 @@ test = TestSCons.TestSCons()
test.write('mylex.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 't', [])
for a in args:
contents = open(a, 'rb').read()
- sys.stdout.write(string.replace(contents, 'LEX', 'mylex.py'))
+ sys.stdout.write(contents.replace('LEX', 'mylex.py'))
sys.exit(0)
""")
diff --git a/test/LEX/LEXCOM.py b/test/LEX/LEXCOM.py
index f496f95..5fb82fe 100644
--- a/test/LEX/LEXCOM.py
+++ b/test/LEX/LEXCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*lex*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*lex*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LEX/LEXCOMSTR.py b/test/LEX/LEXCOMSTR.py
index fa0bbf1..83b2f9c 100644
--- a/test/LEX/LEXCOMSTR.py
+++ b/test/LEX/LEXCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*lex*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*lex*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LEX/LEXFLAGS.py b/test/LEX/LEXFLAGS.py
index aaabdf0..82ae586 100644
--- a/test/LEX/LEXFLAGS.py
+++ b/test/LEX/LEXFLAGS.py
@@ -39,7 +39,6 @@ test.subdir('in')
test.write('mylex.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'I:tx', [])
opt_string = ''
@@ -49,8 +48,8 @@ for opt, arg in cmd_opts:
else: opt_string = opt_string + ' ' + opt
for a in args:
contents = open(a, 'rb').read()
- contents = string.replace(contents, 'LEXFLAGS', opt_string)
- contents = string.replace(contents, 'I_ARGS', i_arguments)
+ contents = contents.replace('LEXFLAGS', opt_string)
+ contents = contents.replace('I_ARGS', i_arguments)
sys.stdout.write(contents)
sys.exit(0)
""")
diff --git a/test/LEX/live.py b/test/LEX/live.py
index da51175..f50b06f 100644
--- a/test/LEX/live.py
+++ b/test/LEX/live.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test LEX and LEXFLAGS with a live lex.
"""
-import string
-
import TestSCons
_exe = TestSCons._exe
@@ -45,11 +43,10 @@ if not lex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/LINK/LINK.py b/test/LINK/LINK.py
index 21e2d66..25d9efb 100644
--- a/test/LINK/LINK.py
+++ b/test/LINK/LINK.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -36,11 +35,10 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/LINK/LINKCOM.py b/test/LINK/LINKCOM.py
index b3c56d6..f09e8f8 100644
--- a/test/LINK/LINKCOM.py
+++ b/test/LINK/LINKCOM.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*link*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/LINKCOMSTR.py b/test/LINK/LINKCOMSTR.py
index 7e12c1d..113bdcd 100644
--- a/test/LINK/LINKCOMSTR.py
+++ b/test/LINK/LINKCOMSTR.py
@@ -29,8 +29,6 @@ Test that the $LINKCOMSTR construction variable allows you to customize
the displayed linker string.
"""
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -45,7 +43,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*link*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/LINKFLAGS.py b/test/LINK/LINKFLAGS.py
index 1726709..442baf7 100644
--- a/test/LINK/LINKFLAGS.py
+++ b/test/LINK/LINKFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -36,12 +35,11 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-args = filter(lambda s: s != 'fake_link_flag', sys.argv[1:])
-os.system(string.join(args, " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+args = [s for s in sys.argv[1:] if s != 'fake_link_flag']
+os.system(" ".join(args))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/LINK/SHLINK.py b/test/LINK/SHLINK.py
index 2bd9bd6..bc1239b 100644
--- a/test/LINK/SHLINK.py
+++ b/test/LINK/SHLINK.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -37,11 +36,10 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/LINK/SHLINKCOM.py b/test/LINK/SHLINKCOM.py
index c507d31..8bdb9b5 100644
--- a/test/LINK/SHLINKCOM.py
+++ b/test/LINK/SHLINKCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*cc*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*cc*/\n']:
outfile.write(l)
sys.exit(0)
@@ -51,7 +51,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*link*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py
index 1d93b75..dd6f22b 100644
--- a/test/LINK/SHLINKCOMSTR.py
+++ b/test/LINK/SHLINKCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*cc*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*cc*/\n']:
outfile.write(l)
sys.exit(0)
@@ -52,7 +52,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*link*/\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*link*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/LINK/SHLINKFLAGS.py b/test/LINK/SHLINKFLAGS.py
index ddd1a6c..57766de 100644
--- a/test/LINK/SHLINKFLAGS.py
+++ b/test/LINK/SHLINKFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -37,12 +36,11 @@ test = TestSCons.TestSCons()
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-args = filter(lambda s: s != 'fake_shlink_flag', sys.argv[1:])
-os.system(string.join(args, " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+args = [s for s in sys.argv[1:] if s != 'fake_shlink_flag']
+os.system(" ".join(args))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/Libs/SharedLibrary.py b/test/Libs/SharedLibrary.py
index 1bb91ea..18d1f24 100644
--- a/test/Libs/SharedLibrary.py
+++ b/test/Libs/SharedLibrary.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -202,13 +201,13 @@ test.run(arguments = '.',
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
-if string.find(sys.platform, 'irix') != -1:
+if sys.platform.find('irix') != -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'
test.run(program = test.workpath('prog'),
stdout = "f1.c\nf2a.c\nf2b.c\nf2c.c\nf3a.c\nf3b.c\nf3c.c\nprog.c\n")
-if sys.platform == 'win32' or string.find(sys.platform, 'irix') != -1:
+if sys.platform == 'win32' or sys.platform.find('irix') != -1:
test.run(arguments = '-f SConstructFoo')
else:
test.run(arguments = '-f SConstructFoo', status=2, stderr='''\
@@ -274,9 +273,9 @@ main(int argc, char *argv[])
# Make sure there is (at most) one mention each of the
# appropriate .def and .lib files per line.
- for line in string.split(test.stdout(), '\n'):
- test.fail_test(string.count(line, 'foo4.def') > 1)
- test.fail_test(string.count(line, 'foo4.lib') > 1)
+ for line in test.stdout().split('\n'):
+ test.fail_test(line.count('foo4.def') > 1)
+ test.fail_test(line.count('foo4.lib') > 1)
test.run(program = test.workpath('progbar'),
stdout = "f4.c\nprogbar.c\n")
diff --git a/test/Libs/SharedLibraryIxes.py b/test/Libs/SharedLibraryIxes.py
index fb0bc22..c60165a 100644
--- a/test/Libs/SharedLibraryIxes.py
+++ b/test/Libs/SharedLibraryIxes.py
@@ -46,7 +46,7 @@ env.Append(LIBPATH=['.'])
# We first bake the LIBSUFFIXES, so that it will not change as a
# side-effect of changing SHLIBSUFFIX.
-env['LIBSUFFIXES'] = map( env.subst, env.get('LIBSUFFIXES', []))
+env['LIBSUFFIXES'] = list(map( env.subst, env.get('LIBSUFFIXES', [])))
weird_prefixes = ['libXX', 'libYY']
@@ -76,13 +76,13 @@ def nodeInSrc(source, lib, libname):
return (source+lib, '')
def pathInSrc(source, lib, libname):
- return (source+map(str,lib), '')
+ return (source+list(map(str,lib)), '')
def nodeInLib(source, lib, libname):
return (source, lib)
def pathInLib(source, lib, libname):
- return (source, map(str,lib))
+ return (source, list(map(str,lib)))
def nameInLib(source, lib, libname):
# NOTE: libname must contain both the proper prefix and suffix.
@@ -116,7 +116,7 @@ def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw):
kw['target'] = target
kw['source'] = source
kw['LIBS'] = LIBS
- build = apply(builder, (), kw)
+ build = builder(**kw)
# Check that the build target depends on at least one of the
# library target.
@@ -128,7 +128,7 @@ def buildAndlinkAgainst(builder, target, source, method, lib, libname, **kw):
break;
assert found_dep, \
"One of %s not found in %s, method=%s, libname=%s, shlibsuffix=%s" % \
- (map(str,lib), map(str, build[0].children()), method.__name__, libname, shlibsuffix)
+ (list(map(str,lib)), list(map(str, build[0].children())), method.__name__, libname, shlibsuffix)
return build
def prog(i,
@@ -194,7 +194,7 @@ except AttributeError:
pass
for i in range(200):
- apply(prog, tests[i])
+ prog(*tests[i])
""")
diff --git a/test/LoadableModule.py b/test/LoadableModule.py
index 4c69dc0..6109359 100644
--- a/test/LoadableModule.py
+++ b/test/LoadableModule.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestCmd
@@ -97,13 +96,13 @@ main(int argc, char *argv[])
foo1_name = {'darwin' : 'foo1'}.get(sys.platform[:6], dll_+'foo1'+_dll)
test.write('dlopenprog.c',
- string.replace(dlopenprog, '__foo1_name__', foo1_name))
+ dlopenprog.replace('__foo1_name__', foo1_name))
test.run(arguments = '.',
stderr=TestSCons.noisy_ar,
match=TestSCons.match_re_dotall)
-if string.find(sys.platform, 'darwin') != -1:
+if sys.platform.find('darwin') != -1:
test.run(program='/usr/bin/file',
arguments = "foo1",
match = TestCmd.match_re,
diff --git a/test/M4/M4.py b/test/M4/M4.py
index 44cda7c..6c2de9c 100644
--- a/test/M4/M4.py
+++ b/test/M4/M4.py
@@ -29,7 +29,6 @@ Test that $M4 and $M4FLAGS work as expected.
"""
import os
-import string
import TestSCons
@@ -40,10 +39,9 @@ test = TestSCons.TestSCons()
test.write('mym4.py', """
-import string
import sys
contents = sys.stdin.read()
-sys.stdout.write(string.replace(contents, 'M4', 'mym4.py'))
+sys.stdout.write(contents.replace('M4', 'mym4.py'))
sys.exit(0)
""")
@@ -71,11 +69,10 @@ if m4:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(tools=['default', 'm4'],
diff --git a/test/M4/M4COM.py b/test/M4/M4COM.py
index 9299645..ad15172 100644
--- a/test/M4/M4COM.py
+++ b/test/M4/M4COM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*m4*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*m4*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/M4/M4COMSTR.py b/test/M4/M4COMSTR.py
index 1425f5c..1b5bd35 100644
--- a/test/M4/M4COMSTR.py
+++ b/test/M4/M4COMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*m4*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*m4*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/MSVC/PCHCOM.py b/test/MSVC/PCHCOM.py
index 56718ef..ff27e10 100644
--- a/test/MSVC/PCHCOM.py
+++ b/test/MSVC/PCHCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*pch*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*pch*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/MSVC/PCHCOMSTR.py b/test/MSVC/PCHCOMSTR.py
index a3ee99e..51f56fb 100644
--- a/test/MSVC/PCHCOMSTR.py
+++ b/test/MSVC/PCHCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*pch*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*pch*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/MSVC/RCCOM.py b/test/MSVC/RCCOM.py
index babc4c7..05382b8 100644
--- a/test/MSVC/RCCOM.py
+++ b/test/MSVC/RCCOM.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*rc*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/MSVC/RCCOMSTR.py b/test/MSVC/RCCOMSTR.py
index b346f48..8425d73 100644
--- a/test/MSVC/RCCOMSTR.py
+++ b/test/MSVC/RCCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*rc*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/MSVC/batch.py b/test/MSVC/batch.py
index 0ab116c..f089b60 100644
--- a/test/MSVC/batch.py
+++ b/test/MSVC/batch.py
@@ -40,7 +40,6 @@ _python_ = TestSCons._python_
test.write('fake_cl.py', """\
import os
-import string
import sys
input_files = sys.argv[2:]
if sys.argv[1][-1] in (os.sep, '\\\\'):
@@ -56,17 +55,16 @@ 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(string.join(sys.argv[1:]) + '\\n')
+open('fake_cl.log', 'ab').write(" ".join(sys.argv[1:]) + '\\n')
for infile in input_files:
if dir:
- outfile = os.path.join(dir, string.replace(infile, '.c', '.obj'))
+ outfile = os.path.join(dir, infile.replace('.c', '.obj'))
else:
outfile = output
open(outfile, 'wb').write(open(infile, 'rb').read())
""")
test.write('fake_link.py', """\
-import string
import sys
ofp = open(sys.argv[1], 'wb')
for infile in sys.argv[2:]:
diff --git a/test/MSVS/vs-8.0-x64-files.py b/test/MSVS/vs-8.0-x64-files.py
index b2a310d..53f8d15 100644
--- a/test/MSVS/vs-8.0-x64-files.py
+++ b/test/MSVS/vs-8.0-x64-files.py
@@ -30,7 +30,6 @@ solution (.sln) files that look correct.
"""
import os
-import string
import TestSConsMSVS
@@ -48,9 +47,9 @@ SConscript_contents = TestSConsMSVS.SConscript_contents_8_0
# We didn't create an API for putting parameters like this into
# the common generated and expected files. Until we do, just patch
# in the values.
-expected_slnfile = string.replace(expected_slnfile, 'Win32', 'x64')
-expected_vcprojfile = string.replace(expected_vcprojfile, 'Win32', 'x64')
-SConscript_contents = string.replace(SConscript_contents, '\'Release\'', '\'Release|x64\'')
+expected_slnfile = expected_slnfile.replace('Win32', 'x64')
+expected_vcprojfile = expected_vcprojfile.replace('Win32', 'x64')
+SConscript_contents = SConscript_contents.replace('\'Release\'', '\'Release|x64\'')
diff --git a/test/MinGW/RCCOM.py b/test/MinGW/RCCOM.py
index 45683dd..dadfea5 100644
--- a/test/MinGW/RCCOM.py
+++ b/test/MinGW/RCCOM.py
@@ -44,7 +44,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*rc*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/MinGW/RCCOMSTR.py b/test/MinGW/RCCOMSTR.py
index 6795795..501a57d 100644
--- a/test/MinGW/RCCOMSTR.py
+++ b/test/MinGW/RCCOMSTR.py
@@ -44,7 +44,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*rc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*rc*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/Mkdir.py b/test/Mkdir.py
index f79a32a..094e6ed 100644
--- a/test/Mkdir.py
+++ b/test/Mkdir.py
@@ -41,10 +41,9 @@ Execute(Mkdir('d1'))
Execute(Mkdir(Dir('#d1-Dir')))
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
@@ -127,13 +126,13 @@ test.write(['work2', 'SConstruct'], """\
import os
def catdir(env, source, target):
target = str(target[0])
- source = map(str, source)
outfp = open(target, "wb")
for src in source:
- l = os.listdir(src)
+ s = str(src)
+ l = os.listdir(s)
l.sort()
for f in l:
- f = os.path.join(src, f)
+ f = os.path.join(s, f)
if os.path.isfile(f):
outfp.write(open(f, "rb").read())
outfp.close()
diff --git a/test/Move.py b/test/Move.py
index d83a5cd..b58fa34 100644
--- a/test/Move.py
+++ b/test/Move.py
@@ -37,10 +37,9 @@ Execute(Move('f1.out', 'f1.in'))
Execute(Move('File-f1.out', File('f1.in-File')))
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
diff --git a/test/NodeOps.py b/test/NodeOps.py
index 96e9f12..e4a403f 100644
--- a/test/NodeOps.py
+++ b/test/NodeOps.py
@@ -36,7 +36,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import sys
import TestSCons
import os
-import string
_exe = TestSCons._exe
lib_ = TestSCons.lib_
@@ -47,7 +46,7 @@ _dll = TestSCons._dll
if os.name == 'posix':
os.environ['LD_LIBRARY_PATH'] = '.'
-if string.find(sys.platform, 'irix') > -1:
+if sys.platform.find('irix') > -1:
os.environ['LD_LIBRARYN32_PATH'] = '.'
test = TestSCons.TestSCons()
@@ -67,10 +66,10 @@ Nodes.extend(bar.SharedObject(target = 'bar%(_obj)s', source = 'prog.cpp'))
SConscript('bld/SConscript', ['Nodes'])
if %(_E)s:
import os
- derived = map(lambda N: N.is_derived(), Nodes)
- real1 = map(lambda N: os.path.exists(str(N)), Nodes)
- exists = map(lambda N: N.exists(), Nodes)
- real2 = map(lambda N: os.path.exists(str(N)), Nodes)
+ derived = [N.is_derived() for N in Nodes]
+ real1 = [os.path.exists(str(N)) for N in Nodes]
+ exists = [N.exists() for N in Nodes]
+ real2 = [os.path.exists(str(N)) for N in Nodes]
for N,D,R,E,F in map(None, Nodes, derived, real1, exists, real2):
print '%%s: %%s %%s %%s %%s'%%(N,D,R,E,F)
foo.SharedLibrary(target = 'foo', source = 'foo%(_obj)s')
diff --git a/test/Parallel/ref_count.py b/test/Parallel/ref_count.py
index 1eab173..ce59668 100644
--- a/test/Parallel/ref_count.py
+++ b/test/Parallel/ref_count.py
@@ -59,7 +59,6 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
test.write('build.py', """\
-import string
import sys
import time
args = sys.argv[1:]
@@ -78,7 +77,7 @@ for ifile in args:
contents = contents + open(ifile, 'rb').read()
for ofile in outputs:
ofp = open(ofile, 'wb')
- ofp.write('%s: building from %s\\n' % (ofile, string.join(args)))
+ ofp.write('%s: building from %s\\n' % (ofile, " ".join(args)))
ofp.write(contents)
ofp.close()
""")
diff --git a/test/ParseConfig.py b/test/ParseConfig.py
index 6473458..9bcc440 100644
--- a/test/ParseConfig.py
+++ b/test/ParseConfig.py
@@ -58,7 +58,7 @@ env.ParseConfig([r'%(_python_)s', r"%(test_config1)s", "--libs --cflags"])
env.ParseConfig([r'%(_python_)s', r"%(test_config2)s", "--libs --cflags"])
print env['CPPPATH']
print env['LIBPATH']
-print map(lambda x: str(x), env['LIBS'])
+print [str(x) for x in env['LIBS']]
print env['CCFLAGS']
""" % locals())
@@ -70,7 +70,7 @@ env.ParseConfig(r"$PYTHON %(test_config1)s --libs --cflags")
env.ParseConfig(r"$PYTHON %(test_config2)s --libs --cflags")
print env['CPPPATH']
print env['LIBPATH']
-print map(lambda x: str(x), env['LIBS'])
+print [str(x) for x in env['LIBS']]
print env['CCFLAGS']
""" % locals())
@@ -81,7 +81,7 @@ env = Environment(CPPPATH = [], LIBPATH = [], LIBS = [],
env.ParseConfig(r"$PYTHON %(test_config3)s --libs --cflags")
print env['CPPPATH']
print env['LIBPATH']
-print map(lambda x: str(x), env['LIBS'])
+print [str(x) for x in env['LIBS']]
print env['CCFLAGS']
""" % locals())
diff --git a/test/Perforce/P4COM.py b/test/Perforce/P4COM.py
index 5a90775..5fd5fd2 100644
--- a/test/Perforce/P4COM.py
+++ b/test/Perforce/P4COM.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'Perforce'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/Perforce/P4COMSTR.py b/test/Perforce/P4COMSTR.py
index a8675f2..accf6d5 100644
--- a/test/Perforce/P4COMSTR.py
+++ b/test/Perforce/P4COMSTR.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'Perforce'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/Perforce/Perforce.py b/test/Perforce/Perforce.py
index ee4b0b5..32154db 100644
--- a/test/Perforce/Perforce.py
+++ b/test/Perforce/Perforce.py
@@ -32,13 +32,12 @@ on port 1666, as well as that of course a client must be present.
"""
import os
-import string
import TestSCons
class TestPerforce(TestSCons.TestSCons):
def __init__(self, *args, **kw):
- apply(TestSCons.TestSCons.__init__, (self,)+args, kw)
+ TestSCons.TestSCons.__init__(self, *args, **kw)
self.p4d = None
@@ -66,11 +65,11 @@ class TestPerforce(TestSCons.TestSCons):
if ' ' in a:
a = '"%s"' % a
return a
- args = map(quote_space, [self.p4d, '-q', '-d'] + \
+ args = list(map(quote_space, [self.p4d, '-q', '-d'] + \
self.p4portflags + \
['-J', 'Journal',
'-L', 'Log',
- '-r', self.workpath('depot')])
+ '-r', self.workpath('depot')]))
# We don't use self.run() because the TestCmd logic will hang
# waiting for the daemon to exit, even when we pass it
@@ -78,7 +77,7 @@ class TestPerforce(TestSCons.TestSCons):
try:
spawnv = os.spawnv
except AttributeError:
- os.system(string.join(args))
+ os.system(' '.join(args))
else:
spawnv(os.P_NOWAIT, self.p4d, args)
self.sleep(2)
@@ -102,7 +101,7 @@ class TestPerforce(TestSCons.TestSCons):
# is already clear.
pass
- self.portflag = string.join(self.p4portflags)
+ self.portflag = ' '.join(self.p4portflags)
def p4(self, *args, **kw):
try:
@@ -110,9 +109,9 @@ class TestPerforce(TestSCons.TestSCons):
except KeyError:
arguments = args[0]
args = args[1:]
- kw['arguments'] = string.join(self.p4portflags + [arguments])
+ kw['arguments'] = ' '.join(self.p4portflags + [arguments])
kw['program'] = self.p4path
- return apply(self.run, args, kw)
+ return self.run(*args, **kw)
def substitute(self, s, **kw):
kw = kw.copy()
@@ -208,8 +207,8 @@ test.write(['import', 'sub', 'fff.in'], "import/sub/fff.in\n")
os.environ["PWD"] = test.workpath('import')
paths = [ 'aaa.in', 'bbb.in', 'ccc.in',
'sub/ddd.in', 'sub/eee.in', 'sub/fff.in', 'sub/SConscript' ]
-paths = map(os.path.normpath, paths)
-args = '-c testclient1 add -t binary %s' % string.join(paths)
+paths = list(map(os.path.normpath, paths))
+args = '-c testclient1 add -t binary %s' % ' '.join(paths)
test.p4(args, chdir='import')
changespec = test.substitute("""
@@ -240,10 +239,9 @@ test.p4('-c testclient1 submit -i', stdin=changespec)
SConstruct_contents = test.substitute("""
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(tools = ['default', 'Perforce'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/Progress/TARGET.py b/test/Progress/TARGET.py
index c2b4213..d7ff3c9 100644
--- a/test/Progress/TARGET.py
+++ b/test/Progress/TARGET.py
@@ -30,7 +30,6 @@ overwriting it by setting the overwrite= keyword argument.
"""
import os
-import string
import TestSCons
@@ -59,7 +58,7 @@ S1.in\r \rS1.out\rCopy("S1.out", "S1.in")
\rSConstruct\r \r.\r"""
if os.linesep != '\n':
- expect = string.replace(expect, '\n', os.linesep)
+ expect = expect.replace('\n', os.linesep)
test.run(arguments = '-Q .', stdout=expect)
diff --git a/test/Progress/file.py b/test/Progress/file.py
index 6095fb0..3184a5b 100644
--- a/test/Progress/file.py
+++ b/test/Progress/file.py
@@ -30,7 +30,6 @@ progress output.
"""
import os
-import string
import TestSCons
@@ -74,7 +73,7 @@ stderr: .
"""
if os.linesep != '\n':
- expect = string.replace(expect, '\n', os.linesep)
+ expect = expect.replace('\n', os.linesep)
test.must_match('progress.out', expect)
diff --git a/test/Progress/spinner.py b/test/Progress/spinner.py
index 0919b44..85ca32f 100644
--- a/test/Progress/spinner.py
+++ b/test/Progress/spinner.py
@@ -30,7 +30,6 @@ that represents a canonical "spinner" on the output.
"""
import os
-import string
import TestSCons
@@ -59,7 +58,7 @@ expect = """\
\\\r|\r"""
if os.linesep != '\n':
- expect = string.replace(expect, '\n', os.linesep)
+ expect = expect.replace('\n', os.linesep)
test.run(arguments = '-Q .', stdout=expect)
diff --git a/test/QT/QTFLAGS.py b/test/QT/QTFLAGS.py
index 62155fd..008397a 100644
--- a/test/QT/QTFLAGS.py
+++ b/test/QT/QTFLAGS.py
@@ -147,9 +147,8 @@ test.must_exist(['work1', 'mmmmocFromH.cxx'],
['work1', 'mmmanother_ui_file.cxx'])
def _flagTest(test,fileToContentsStart):
- import string
for f,c in fileToContentsStart.items():
- if string.find(test.read(test.workpath('work1', f)), c) != 0:
+ if test.read(test.workpath('work1', f)).find(c) != 0:
return 1
return 0
diff --git a/test/QT/Tool.py b/test/QT/Tool.py
index 86eb4ca..63fb113 100644
--- a/test/QT/Tool.py
+++ b/test/QT/Tool.py
@@ -90,7 +90,7 @@ def CheckForQt(context):
"/usr/pkg/qt3" # pkgsrc (NetBSD)
]
- if os.environ.has_key('QTDIR'):
+ if 'QTDIR' in os.environ:
potential_qt_dirs.insert(0, os.environ[ 'QTDIR' ])
if env[ 'qt_directory' ] != "/":
@@ -125,10 +125,8 @@ def CheckForQt(context):
return 0
def AttemptLinkWithVariables(context, variables, code, extension, prefix):
- return DoWithVariables(variables,
- prefix,
- lambda c=context, code=code, e=extension:
- c.TryLink(code, e))
+ return DoWithVariables(variables, prefix,
+ lambda: context.TryLink(code, extension))
env = Environment(CPPPATH=['.'], LIBPATH=['.'], LIBS=[])
diff --git a/test/QT/copied-env.py b/test/QT/copied-env.py
index f68e1db..63083da 100644
--- a/test/QT/copied-env.py
+++ b/test/QT/copied-env.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -28,8 +29,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test Qt with a copied construction environment.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -68,10 +67,9 @@ void aaa(void)
test.run()
-moc_MyForm = filter(lambda x: string.find(x, 'moc_MyForm') != -1,
- string.split(test.stdout(), '\n'))
+moc_MyForm = [x for x in test.stdout().split('\n') if x.find('moc_MyForm') != -1]
-MYLIB_IMPL = filter(lambda x: string.find(x, 'MYLIB_IMPL') != -1, moc_MyForm)
+MYLIB_IMPL = [x for x in moc_MyForm if x.find('MYLIB_IMPL') != -1]
if not MYLIB_IMPL:
print "Did not find MYLIB_IMPL on moc_MyForm compilation line:"
diff --git a/test/QT/generated-ui.py b/test/QT/generated-ui.py
index e01a633..e4632b1 100644
--- a/test/QT/generated-ui.py
+++ b/test/QT/generated-ui.py
@@ -47,7 +47,7 @@ import os
aa=os.getcwd()
env=Environment(tools=['default','expheaders','qt'],toolpath=[aa])
-if os.environ.has_key('HOME'):
+if 'HOME' in os.environ:
env['ENV']['HOME'] = os.environ['HOME']
env["EXP_HEADER_ABS"]=os.path.join(os.getcwd(),'include')
if not os.access(env["EXP_HEADER_ABS"],os.F_OK):
diff --git a/test/QT/installed.py b/test/QT/installed.py
index c79f958..2661377 100644
--- a/test/QT/installed.py
+++ b/test/QT/installed.py
@@ -29,7 +29,6 @@ Look if qt is installed, and try out all builders.
"""
import os
-import string
import sys
import TestSCons
@@ -51,7 +50,7 @@ dummy_env = Environment()
ENV = dummy_env['ENV']
try:
PATH=ARGUMENTS['PATH']
- if ENV.has_key('PATH'):
+ if 'PATH' in ENV:
ENV_PATH = PATH + os.pathsep + ENV['PATH']
else:
Exit(0) # this is certainly a weird system :-)
@@ -191,7 +190,7 @@ if test.stdout() != "Hello World\n" or test.stderr() != '' or test.status:
# an indication that it built correctly) but don't fail the test.
expect = 'cannot connect to X server'
test.fail_test(test.stdout())
- test.fail_test(string.find(test.stderr(), expect) == -1)
+ test.fail_test(test.stderr().find(expect) == -1)
if test.status != 1 and (test.status>>8) != 1:
sys.stdout.write('test_realqt returned status %s\n' % test.status)
test.fail_test()
@@ -206,8 +205,8 @@ test.run(stderr=None, arguments="-c bld/test_realqt" + TestSCons._exe)
expect1 = "scons: warning: Could not detect qt, using empty QTDIR"
expect2 = "scons: warning: Could not detect qt, using moc executable as a hint"
-test.fail_test(string.find(test.stderr(), expect1) == -1 and
- string.find(test.stderr(), expect2) == -1)
+test.fail_test(test.stderr().find(expect1) == -1 and
+ test.stderr().find(expect2) == -1)
test.pass_test()
diff --git a/test/QT/manual.py b/test/QT/manual.py
index dcab3aa..ff38f32 100644
--- a/test/QT/manual.py
+++ b/test/QT/manual.py
@@ -56,7 +56,7 @@ env.Moc('moc_eee.cpp', 'eee.cpp')
sources.extend(env.Uic(['include/uic_fff.hpp', 'fff.cpp', 'fff.moc.cpp'],
'ui/fff.ui')[1:])
-print map(str,sources)
+print list(map(str,sources))
env.Program(target='aaa',
source=sources,
CPPPATH=['$CPPPATH', './include'],
diff --git a/test/QT/source-from-ui.py b/test/QT/source-from-ui.py
index 6cffecc..38cc8c8 100644
--- a/test/QT/source-from-ui.py
+++ b/test/QT/source-from-ui.py
@@ -29,7 +29,6 @@ Create .cpp, .h, moc_....cpp from a .ui file.
"""
import os.path
-import string
import TestSCons
@@ -126,7 +125,7 @@ test.must_not_exist(test.workpath(cpp))
test.must_not_exist(test.workpath(h))
cppContents = test.read(test.workpath('build', cpp))
-test.fail_test(string.find(cppContents, '#include "aaa.ui.h"') == -1)
+test.fail_test(cppContents.find('#include "aaa.ui.h"') == -1)
test.run(arguments = "variant_dir=1 chdir=1 " +
test.workpath('build', aaa_dll) )
diff --git a/test/QT/up-to-date.py b/test/QT/up-to-date.py
index fbbcac0..21c758e 100644
--- a/test/QT/up-to-date.py
+++ b/test/QT/up-to-date.py
@@ -34,7 +34,6 @@ ca. September 2005.)
"""
import os
-import string
import TestSCons
@@ -133,7 +132,7 @@ my_obj = 'layer/aclock/qt_bug/my'+_obj
test.run(arguments = my_obj, stderr=None)
-expect = string.replace( my_obj, '/', os.sep )
+expect = my_obj.replace( '/', os.sep )
test.up_to_date(options = '--debug=explain',
arguments = (expect),
stderr=None)
diff --git a/test/QT/warnings.py b/test/QT/warnings.py
index 975091b..a861b24 100644
--- a/test/QT/warnings.py
+++ b/test/QT/warnings.py
@@ -30,7 +30,6 @@ Test the Qt tool warnings.
import os
import re
-import string
import TestSCons
@@ -82,7 +81,7 @@ moc = test.where_is('moc')
if moc:
import os.path
qtdir = os.path.dirname(os.path.dirname(moc))
- qtdir = string.replace(qtdir, '\\', '\\\\' )
+ qtdir = qtdir.replace('\\', '\\\\' )
expect = """
scons: warning: Could not detect qt, using moc executable as a hint \(QTDIR=%s\)
diff --git a/test/RANLIB/RANLIB.py b/test/RANLIB/RANLIB.py
index ecc6482..c9fc10f 100644
--- a/test/RANLIB/RANLIB.py
+++ b/test/RANLIB/RANLIB.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -42,11 +41,10 @@ if not ranlib:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(LIBS = ['foo'], LIBPATH = ['.'])
diff --git a/test/RANLIB/RANLIBCOM.py b/test/RANLIB/RANLIBCOM.py
index 94f1997..486a91f 100644
--- a/test/RANLIB/RANLIBCOM.py
+++ b/test/RANLIB/RANLIBCOM.py
@@ -46,7 +46,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*ar*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*ar*/\\n']:
outfile.write(l)
sys.exit(0)
""")
@@ -55,7 +55,7 @@ test.write('myranlib.py', """
import sys
lines = open(sys.argv[1], 'rb').readlines()
outfile = open(sys.argv[1], 'wb')
-for l in filter(lambda l: l != '/*ranlib*/\\n', lines):
+for l in [l for l in lines if l != '/*ranlib*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/RANLIB/RANLIBCOMSTR.py b/test/RANLIB/RANLIBCOMSTR.py
index b59d133..6e76cbf 100644
--- a/test/RANLIB/RANLIBCOMSTR.py
+++ b/test/RANLIB/RANLIBCOMSTR.py
@@ -47,7 +47,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*ar*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*ar*/\\n']:
outfile.write(l)
sys.exit(0)
""")
@@ -56,7 +56,7 @@ test.write('myranlib.py', """
import sys
lines = open(sys.argv[1], 'rb').readlines()
outfile = open(sys.argv[1], 'wb')
-for l in filter(lambda l: l != '/*ranlib*/\\n', lines):
+for l in [l for l in lines if l != '/*ranlib*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/RANLIB/RANLIBFLAGS.py b/test/RANLIB/RANLIBFLAGS.py
index 123d403..636059b 100644
--- a/test/RANLIB/RANLIBFLAGS.py
+++ b/test/RANLIB/RANLIBFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -41,11 +40,10 @@ if not ranlib:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(LIBS = ['foo'], LIBPATH = ['.'])
diff --git a/test/RCS/RCS_COCOM.py b/test/RCS/RCS_COCOM.py
index 8bbeb59..a1c18e5 100644
--- a/test/RCS/RCS_COCOM.py
+++ b/test/RCS/RCS_COCOM.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'RCS'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/RCS/RCS_COCOMSTR.py b/test/RCS/RCS_COCOMSTR.py
index 576afc1..ee3ba15 100644
--- a/test/RCS/RCS_COCOMSTR.py
+++ b/test/RCS/RCS_COCOMSTR.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'RCS'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/RCS/diskcheck.py b/test/RCS/diskcheck.py
index 264822a..4e7dd24 100644
--- a/test/RCS/diskcheck.py
+++ b/test/RCS/diskcheck.py
@@ -95,10 +95,9 @@ ENV = {'PATH' : os.environ['PATH'],
'LOGNAME' : logname}
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
SetOption('diskcheck', None)
DefaultEnvironment()['ENV'] = ENV
@@ -116,7 +115,7 @@ test.write('bbb.in', "checked-out bbb.in\n")
test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
sub_SConscript = os.path.join('sub', 'SConscript')
-SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 23)[:-1]
+SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 22)[:-1]
expect = """\
diff --git a/test/RCS/explicit.py b/test/RCS/explicit.py
index 3e19a67..75eb189 100644
--- a/test/RCS/explicit.py
+++ b/test/RCS/explicit.py
@@ -95,10 +95,9 @@ ENV = {'PATH' : os.environ['PATH'],
'LOGNAME' : logname}
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(ENV=ENV,
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/RCS/transparent.py b/test/RCS/transparent.py
index 397017c..2ebde9a 100644
--- a/test/RCS/transparent.py
+++ b/test/RCS/transparent.py
@@ -95,10 +95,9 @@ ENV = {'PATH' : os.environ['PATH'],
'LOGNAME' : logname}
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
DefaultEnvironment()['ENV'] = ENV
DefaultEnvironment()['RCS_COFLAGS'] = '-l'
diff --git a/test/Repository/LIBPATH.py b/test/Repository/LIBPATH.py
index 0eb2da2..c95d29a 100644
--- a/test/Repository/LIBPATH.py
+++ b/test/Repository/LIBPATH.py
@@ -24,7 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
import TestSCons
test = TestSCons.TestSCons()
@@ -40,7 +39,6 @@ workpath_bar_zzz = test.workpath('bar', 'zzz')
workpath_work = test.workpath('work')
test.write(['work', 'SConstruct'], r"""
-import string
env_zzz = Environment(LIBPATH = ['.', 'zzz'])
env_yyy = Environment(LIBPATH = ['yyy', '.'])
aaa_exe = env_zzz.Program('aaa', 'aaa.c')
@@ -49,7 +47,7 @@ def write_LIBDIRFLAGS(env, target, source):
pre = env.subst('$LIBDIRPREFIX')
suf = env.subst('$LIBDIRSUFFIX')
f = open(str(target[0]), 'wb')
- for arg in string.split(env.subst('$_LIBDIRFLAGS', target=target)):
+ for arg in env.subst('$_LIBDIRFLAGS', target=target).split():
if arg[:len(pre)] == pre:
arg = arg[len(pre):]
if arg[-len(suf):] == suf:
@@ -100,13 +98,13 @@ test.run(chdir = 'work', options = opts, arguments = ".")
dirs = ['.', workpath_foo, workpath_bar,
'zzz', workpath_foo_zzz, workpath_bar_zzz]
test.fail_test(test.read(['work', 'zzz.out']) !=
- string.join(dirs, '\n') + '\n')
+ '\n'.join(dirs) + '\n')
#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']) !=
- string.join(dirs, '\n') + '\n')
+ '\n'.join(dirs) + '\n')
#
test.run(chdir = 'work', options = '-c', arguments = ".")
@@ -120,13 +118,13 @@ test.run(chdir = 'work', options = opts, arguments = ".")
dirs = ['.', workpath_foo, workpath_bar,
'zzz', workpath_foo_zzz, workpath_bar_zzz]
test.fail_test(test.read(['work', 'zzz.out']) !=
- string.join(dirs, '\n') + '\n')
+ '\n'.join(dirs) + '\n')
#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']) !=
- string.join(dirs, '\n') + '\n')
+ '\n'.join(dirs) + '\n')
#
test.pass_test()
diff --git a/test/Repository/M4.py b/test/Repository/M4.py
index b3ed755..fe1eb7b 100644
--- a/test/Repository/M4.py
+++ b/test/Repository/M4.py
@@ -39,10 +39,9 @@ test = TestSCons.TestSCons()
test.subdir('work', 'repository', ['repository', 'src'])
test.write('mym4.py', """
-import string
import sys
contents = sys.stdin.read()
-sys.stdout.write(string.replace(contents, 'M4', 'mym4.py'))
+sys.stdout.write(contents.replace('M4', 'mym4.py'))
sys.exit(0)
""")
diff --git a/test/Repository/RMIC.py b/test/Repository/RMIC.py
index e00bb43..b214b4b 100644
--- a/test/Repository/RMIC.py
+++ b/test/Repository/RMIC.py
@@ -60,13 +60,12 @@ opts = '-Y ' + test.workpath('rep1')
#
test.write(['rep1', 'SConstruct'], """
-import string
env = Environment(tools = ['javac', 'rmic'],
JAVAC = r'%s',
RMIC = r'%s')
classes = env.Java(target = 'classes', source = 'src')
# Brute-force removal of the "Hello" class.
-classes = filter(lambda c: string.find(str(c), 'Hello') == -1, classes)
+classes = [c for c in classes if str(c).find('Hello') == -1]
env.RMIC(target = 'outdir', source = classes)
""" % (javac, rmic))
@@ -329,13 +328,12 @@ test.up_to_date(chdir = 'work2', options = opts, arguments = ".")
#
test.write(['work3', 'SConstruct'], """
-import string
env = Environment(tools = ['javac', 'rmic'],
JAVAC = r'%s',
RMIC = r'%s')
classes = env.Java(target = 'classes', source = 'src')
# Brute-force removal of the "Hello" class.
-classes = filter(lambda c: string.find(str(c), 'Hello') == -1, classes)
+classes = [c for c in classes if str(c).find('Hello') == -1]
rmi_classes = env.RMIC(target = 'outdir', source = classes)
Local(rmi_classes)
""" % (javac, rmic))
diff --git a/test/Repository/SConscript.py b/test/Repository/SConscript.py
index fb4ef08..22956ac 100644
--- a/test/Repository/SConscript.py
+++ b/test/Repository/SConscript.py
@@ -61,10 +61,9 @@ SConscript('src/SConscript')
test.write(['rep1', 'src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in'])
@@ -98,10 +97,9 @@ SConscript('src/SConscript')
test.write(['rep2', 'src', 'SConscript'], """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat(target = 'foo', source = ['aaa.in', 'bbb.in', 'ccc.in'])
diff --git a/test/Repository/SharedLibrary.py b/test/Repository/SharedLibrary.py
index fbd135e..51142aa 100644
--- a/test/Repository/SharedLibrary.py
+++ b/test/Repository/SharedLibrary.py
@@ -30,7 +30,6 @@ object files built in a repository.
"""
import os
-import string
import sys
import TestSCons
@@ -115,7 +114,7 @@ if os.name == 'posix':
os.environ['DYLD_LIBRARY_PATH'] = test.workpath('work')
else:
os.environ['LD_LIBRARY_PATH'] = test.workpath('work')
-if string.find(sys.platform, 'irix') != -1:
+if sys.platform.find('irix') != -1:
os.environ['LD_LIBRARYN32_PATH'] = test.workpath('work')
test.run(program = test.workpath('work', 'prog'),
diff --git a/test/Repository/VariantDir.py b/test/Repository/VariantDir.py
index 0abda0b..ec723c8 100644
--- a/test/Repository/VariantDir.py
+++ b/test/Repository/VariantDir.py
@@ -47,7 +47,7 @@ SConscript('build1/SConscript')
test.write(['repository', 'src', 'SConscript'], r"""
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
+ source = list(map(str, source))
print 'cat(%s) > %s' % (source, target)
f = open(target, "wb")
for src in source:
diff --git a/test/Repository/option-f.py b/test/Repository/option-f.py
index aec9418..8511f6a 100644
--- a/test/Repository/option-f.py
+++ b/test/Repository/option-f.py
@@ -43,10 +43,9 @@ test.write(['repository', 'SConstruct'], """\
Repository(r'%s')
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Build':Builder(action=cat)})
diff --git a/test/Repository/targets.py b/test/Repository/targets.py
index d395047..62f4785 100644
--- a/test/Repository/targets.py
+++ b/test/Repository/targets.py
@@ -42,7 +42,7 @@ opts = "-Y " + test.workpath('repository')
test.write(['repository', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
+ source = list(map(str, source))
print 'cat(%s) > %s' % (source, target)
f = open(target, "wb")
for src in source:
diff --git a/test/Requires/basic.py b/test/Requires/basic.py
index 548e6b2..edce13b 100644
--- a/test/Requires/basic.py
+++ b/test/Requires/basic.py
@@ -36,8 +36,8 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def append_prereq_func(target, source, env):
fp = open(str(target[0]), 'wb')
- for s in map(str, source):
- fp.write(open(s, 'rb').read())
+ for s in source:
+ fp.write(open(str(s), 'rb').read())
fp.write(open('prereq.out', 'rb').read())
fp.close()
return None
diff --git a/test/Requires/eval-order.py b/test/Requires/eval-order.py
index 9c1f25b..51539a2 100644
--- a/test/Requires/eval-order.py
+++ b/test/Requires/eval-order.py
@@ -35,8 +35,8 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def copy_and_create_func(target, source, env):
fp = open(str(target[0]), 'wb')
- for s in map(str, source):
- fp.write(open(s, 'rb').read())
+ for s in source:
+ fp.write(open(str(s), 'rb').read())
fp.close()
open('file.in', 'wb').write("file.in 1\\n")
return None
diff --git a/test/Rpcgen/RPCGEN.py b/test/Rpcgen/RPCGEN.py
index 5fde5df..dd3669b 100644
--- a/test/Rpcgen/RPCGEN.py
+++ b/test/Rpcgen/RPCGEN.py
@@ -35,15 +35,14 @@ test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:', [])
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
-output.write(string.join(sys.argv) + "\\n")
+output.write(" ".join(sys.argv) + "\\n")
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'RPCGEN', 'myrpcgen.py'))
+ output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/Rpcgen/RPCGENCLIENTFLAGS.py b/test/Rpcgen/RPCGENCLIENTFLAGS.py
index 4b0d24f..7cf0144 100644
--- a/test/Rpcgen/RPCGENCLIENTFLAGS.py
+++ b/test/Rpcgen/RPCGENCLIENTFLAGS.py
@@ -35,15 +35,14 @@ test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:x', [])
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
-output.write(string.join(sys.argv) + "\\n")
+output.write(" ".join(sys.argv) + "\\n")
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'RPCGEN', 'myrpcgen.py'))
+ output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/Rpcgen/RPCGENFLAGS.py b/test/Rpcgen/RPCGENFLAGS.py
index ddbc745..4af5da8 100644
--- a/test/Rpcgen/RPCGENFLAGS.py
+++ b/test/Rpcgen/RPCGENFLAGS.py
@@ -35,15 +35,14 @@ test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:x', [])
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
-output.write(string.join(sys.argv) + "\\n")
+output.write(" ".join(sys.argv) + "\\n")
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'RPCGEN', 'myrpcgen.py'))
+ output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/Rpcgen/RPCGENHEADERFLAGS.py b/test/Rpcgen/RPCGENHEADERFLAGS.py
index 3eac78f..0c93fe7 100644
--- a/test/Rpcgen/RPCGENHEADERFLAGS.py
+++ b/test/Rpcgen/RPCGENHEADERFLAGS.py
@@ -35,15 +35,14 @@ test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:x', [])
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
-output.write(string.join(sys.argv) + "\\n")
+output.write(" ".join(sys.argv) + "\\n")
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'RPCGEN', 'myrpcgen.py'))
+ output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/Rpcgen/RPCGENSERVICEFLAGS.py b/test/Rpcgen/RPCGENSERVICEFLAGS.py
index eee4505..9b8962f 100644
--- a/test/Rpcgen/RPCGENSERVICEFLAGS.py
+++ b/test/Rpcgen/RPCGENSERVICEFLAGS.py
@@ -35,15 +35,14 @@ test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:x', [])
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
-output.write(string.join(sys.argv) + "\\n")
+output.write(" ".join(sys.argv) + "\\n")
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'RPCGEN', 'myrpcgen.py'))
+ output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/Rpcgen/RPCGENXDRFLAGS.py b/test/Rpcgen/RPCGENXDRFLAGS.py
index c9a911a..8f90d5a 100644
--- a/test/Rpcgen/RPCGENXDRFLAGS.py
+++ b/test/Rpcgen/RPCGENXDRFLAGS.py
@@ -35,15 +35,14 @@ test = TestSCons.TestSCons()
test.write('myrpcgen.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'chlmo:x', [])
for opt, arg in cmd_opts:
if opt == '-o': output = open(arg, 'wb')
-output.write(string.join(sys.argv) + "\\n")
+output.write(" ".join(sys.argv) + "\\n")
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'RPCGEN', 'myrpcgen.py'))
+ output.write(contents.replace('RPCGEN', 'myrpcgen.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/SCCS/SCCSCOM.py b/test/SCCS/SCCSCOM.py
index 771b773..9d1b649 100644
--- a/test/SCCS/SCCSCOM.py
+++ b/test/SCCS/SCCSCOM.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'SCCS'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/SCCS/SCCSCOMSTR.py b/test/SCCS/SCCSCOMSTR.py
index 162fe3c..d0da2e4 100644
--- a/test/SCCS/SCCSCOMSTR.py
+++ b/test/SCCS/SCCSCOMSTR.py
@@ -58,10 +58,9 @@ for f in sys.argv[1:]:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(TOOLS = ['default', 'SCCS'],
BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/SCCS/diskcheck.py b/test/SCCS/diskcheck.py
index 8d30d33..a8660bc 100644
--- a/test/SCCS/diskcheck.py
+++ b/test/SCCS/diskcheck.py
@@ -29,7 +29,6 @@ Test transparent checkouts from SCCS files in an SCCS subdirectory.
"""
import os.path
-import string
import TestSCons
@@ -74,10 +73,9 @@ test.write(['SConstruct'], """
DefaultEnvironment()['SCCSCOM'] = 'cd ${TARGET.dir} && $SCCS get ${TARGET.file}'
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
SetOption('diskcheck', ['match', 'rcs'])
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
@@ -94,7 +92,7 @@ test.write(['bbb.in'], "checked-out bbb.in\n")
test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
sub_SConscript = os.path.join('sub', 'SConscript')
-SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 17)[:-1]
+SConstruct_file_line = test.python_file_line(test.workpath('SConstruct'), 16)[:-1]
expect = """\
@@ -107,7 +105,7 @@ test.run(status=2, stderr=expect)
test.run(arguments = '--diskcheck=sccs', stderr = None)
-lines = string.split("""
+lines = """
sccs get SConscript
sccs get aaa.in
cat(["aaa.out"], ["aaa.in"])
@@ -121,7 +119,7 @@ cat(["sub/eee.out"], ["sub/eee.in"])
sccs get fff.in
cat(["sub/fff.out"], ["sub/fff.in"])
cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-""", '\n')
+""".split('\n')
test.must_contain_all_lines(test.stdout(), lines)
diff --git a/test/SCCS/explicit.py b/test/SCCS/explicit.py
index f716dd0..252e901 100644
--- a/test/SCCS/explicit.py
+++ b/test/SCCS/explicit.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test explicit checkouts from local SCCS files.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -71,10 +69,9 @@ for f in ['ddd.in', 'eee.in', 'fff.in']:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
SCCSCOM = 'cd ${TARGET.dir} && $SCCS get $SCCSGETFLAGS ${TARGET.file}',
@@ -93,7 +90,7 @@ test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
test.run(arguments = '.', stderr = None)
-lines = string.split("""
+lines = """
sccs get -e SConscript
sccs get -e aaa.in
cat(["aaa.out"], ["aaa.in"])
@@ -107,7 +104,7 @@ cat(["sub/eee.out"], ["sub/eee.in"])
sccs get -e fff.in
cat(["sub/fff.out"], ["sub/fff.in"])
cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-""", '\n')
+""".split('\n')
test.must_contain_all_lines(test.stdout(), lines)
diff --git a/test/SCCS/implicit.py b/test/SCCS/implicit.py
index 79eaf06..3f86841 100644
--- a/test/SCCS/implicit.py
+++ b/test/SCCS/implicit.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test transparent SCCS checkouts of implicit dependencies.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -70,10 +68,10 @@ env.Program('foo.c')
test.run(stderr = None)
-lines = string.split("""
+lines = """
sccs get foo.c
sccs get foo.h
-""", '\n')
+""".split('\n')
test.must_contain_all_lines(test.stdout(), lines)
diff --git a/test/SCCS/transparent.py b/test/SCCS/transparent.py
index adc0fe1..a8105a2 100644
--- a/test/SCCS/transparent.py
+++ b/test/SCCS/transparent.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test transparent checkouts from SCCS files in an SCCS subdirectory.
"""
-import string
-
import TestSCons
test = TestSCons.TestSCons()
@@ -73,10 +71,9 @@ test.write(['SConstruct'], """
DefaultEnvironment()['SCCSCOM'] = 'cd ${TARGET.dir} && $SCCS get ${TARGET.file}'
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
SCCSFLAGS='-k')
@@ -93,7 +90,7 @@ test.write(['sub', 'eee.in'], "checked-out sub/eee.in\n")
test.run(arguments = '.', stderr = None)
-lines = string.split("""
+lines = """
sccs get SConscript
sccs get aaa.in
cat(["aaa.out"], ["aaa.in"])
@@ -107,7 +104,7 @@ cat(["sub/eee.out"], ["sub/eee.in"])
sccs get fff.in
cat(["sub/fff.out"], ["sub/fff.in"])
cat(["sub/all"], ["sub/ddd.out", "sub/eee.out", "sub/fff.out"])
-""", '\n')
+""".split('\n')
test.must_contain_all_lines(test.stdout(), lines)
diff --git a/test/SConscript/SConscript.py b/test/SConscript/SConscript.py
index fa7e914..5bd49f3 100644
--- a/test/SConscript/SConscript.py
+++ b/test/SConscript/SConscript.py
@@ -83,7 +83,7 @@ SConscript('SConscript7')
test.write('SConscript', """\
# os should not be automajically imported:
-assert not globals().has_key("os")
+assert "os" not in globals()
import os
print "SConscript " + os.getcwd()
diff --git a/test/SConscript/src_dir.py b/test/SConscript/src_dir.py
index 1a3a3df..967e391 100644
--- a/test/SConscript/src_dir.py
+++ b/test/SConscript/src_dir.py
@@ -57,7 +57,7 @@ from os.path import join
from os.path import basename
Import('env')
-sources = map(basename, glob(join(str(env.Dir('.').srcnode()),'*.c')))
+sources = list(map(basename, glob(join(str(env.Dir('.').srcnode()),'*.c'))))
# Trivial example; really I read the configuration file
# their build system uses to generate the vcproj files
diff --git a/test/SHELL.py b/test/SHELL.py
index fa1ae78..93ed0b1 100644
--- a/test/SHELL.py
+++ b/test/SHELL.py
@@ -48,7 +48,6 @@ my_shell = test.workpath('my_shell.py')
test.write(my_shell, """\
#!%(python)s
import os
-import string
import sys
cmd = sys.argv[2]
def stripquote(s):
@@ -56,8 +55,8 @@ def stripquote(s):
s[0] == "'" and s[-1] == "'":
s = s[1:-1]
return s
-args = string.split(stripquote(sys.argv[2]))
-args = map(stripquote, args)
+args = stripquote(sys.argv[2]).split()
+args = list(map(stripquote, args))
ofp = open(args[2], 'wb')
for f in args[3:] + ['extra.txt']:
ofp.write(open(f, 'rb').read())
diff --git a/test/SPAWN.py b/test/SPAWN.py
index c7cd4e4..6802524 100644
--- a/test/SPAWN.py
+++ b/test/SPAWN.py
@@ -44,15 +44,14 @@ ofp.close()
test.write('SConstruct', """
import os
-import string
import sys
def my_spawn1(sh, escape, cmd, args, env):
- s = string.join(args + ['extra1.txt'])
+ s = " ".join(args + ['extra1.txt'])
if sys.platform in ['win32']:
s = '"' + s + '"'
os.system(s)
def my_spawn2(sh, escape, cmd, args, env):
- s = string.join(args + ['extra2.txt'])
+ s = " ".join(args + ['extra2.txt'])
if sys.platform in ['win32']:
s = '"' + s + '"'
os.system(s)
diff --git a/test/SWIG/SWIGCOM.py b/test/SWIG/SWIGCOM.py
index d1d7776..44602fd 100644
--- a/test/SWIG/SWIGCOM.py
+++ b/test/SWIG/SWIGCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*swig*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*swig*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/SWIG/SWIGCOMSTR.py b/test/SWIG/SWIGCOMSTR.py
index 739c781..1df3499 100644
--- a/test/SWIG/SWIGCOMSTR.py
+++ b/test/SWIG/SWIGCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*swig*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*swig*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/SWIG/live.py b/test/SWIG/live.py
index 0a4c905..8f580c9 100644
--- a/test/SWIG/live.py
+++ b/test/SWIG/live.py
@@ -29,7 +29,6 @@ Test SWIG behavior with a live, installed SWIG.
"""
import os.path
-import string
import sys
import TestSCons
@@ -58,11 +57,10 @@ ldmodule_prefix = '_'
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """\
foo = Environment(SWIGFLAGS='-python',
diff --git a/test/Scanner/FindPathDirs.py b/test/Scanner/FindPathDirs.py
index 9f0e535..ef3ea46 100644
--- a/test/Scanner/FindPathDirs.py
+++ b/test/Scanner/FindPathDirs.py
@@ -39,9 +39,8 @@ test.subdir('inc1', 'inc2')
test.write('build.py', r"""
import os.path
-import string
import sys
-path = string.split(sys.argv[1])
+path = sys.argv[1].split()
input = open(sys.argv[2], 'rb')
output = open(sys.argv[3], 'wb')
diff --git a/test/Scanner/Scanner.py b/test/Scanner/Scanner.py
index 4c84069..8d48b73 100644
--- a/test/Scanner/Scanner.py
+++ b/test/Scanner/Scanner.py
@@ -113,11 +113,9 @@ bar = env.BarBld(target='bar', source='bar.in')
# Test specifying a source scanner for a Builder that gets
# automatically applied to targets generated from that Builder
-import string
-
def blork(env, target, source):
open(str(target[0]), 'wb').write(
- string.replace(source[0].get_text_contents(), 'getfile', 'MISSEDME'))
+ source[0].get_text_contents().replace('getfile', 'MISSEDME'))
kbld = Builder(action=r'%(_python_)s build.py $SOURCES $TARGET',
src_suffix='.lork',
diff --git a/test/Scanner/exception.py b/test/Scanner/exception.py
index 4e62f8f..1e22931 100644
--- a/test/Scanner/exception.py
+++ b/test/Scanner/exception.py
@@ -67,11 +67,9 @@ def process(outf, inf):
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
-
outf = open(target, 'wb')
for src in source:
- process(outf, open(src, 'rb'))
+ process(outf, open(str(src), 'rb'))
outf.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
diff --git a/test/Scanner/generated.py b/test/Scanner/generated.py
index 5a69510..8c90df4 100644
--- a/test/Scanner/generated.py
+++ b/test/Scanner/generated.py
@@ -84,7 +84,6 @@ Mylib.Subdirs(env, "src")
test.write('Mylib.py', """\
import os
-import string
import re
def Subdirs(env, dirlist):
@@ -92,10 +91,10 @@ def Subdirs(env, dirlist):
env.SConscript(file, "env")
def _subconf_list(dirlist):
- return map(lambda x: os.path.join(x, "SConscript"), string.split(dirlist))
+ return [os.path.join(x, "SConscript") for x in dirlist.split()]
def StaticLibMergeMembers(local_env, libname, hackpath, files):
- for file in string.split(files):
+ for file in files.split():
# QQQ Fix limits in grok'ed regexp
tmp = re.sub(".c$", ".o", file)
objname = re.sub(".cpp", ".o", tmp)
@@ -121,22 +120,22 @@ def Gen_StaticLibMerge(source, target, env, for_signature):
return [["ar", "cq"] + target + srclist, ["ranlib"] + target]
def StaticLibrary(env, target, source):
- env.StaticLibrary(target, string.split(source))
+ env.StaticLibrary(target, source.split())
def SharedLibrary(env, target, source):
- env.SharedLibrary(target, string.split(source))
+ env.SharedLibrary(target, source.split())
def ExportHeader(env, headers):
- env.Install(dir = env["EXPORT_INCLUDE"], source = string.split(headers))
+ env.Install(dir = env["EXPORT_INCLUDE"], source = headers.split())
def ExportLib(env, libs):
- env.Install(dir = env["EXPORT_LIB"], source = string.split(libs))
+ env.Install(dir = env["EXPORT_LIB"], source = libs.split())
def InstallBin(env, bins):
- env.Install(dir = env["INSTALL_BIN"], source = string.split(bins))
+ env.Install(dir = env["INSTALL_BIN"], source = bins.split())
def Program(env, target, source):
- env.Program(target, string.split(source))
+ env.Program(target, source.split())
def AddCFlags(env, str):
env.Append(CPPFLAGS = " " + str)
@@ -146,13 +145,13 @@ def AddCFlags(env, str):
# AddCFlags(env, str)
def AddIncludeDirs(env, str):
- env.Append(CPPPATH = string.split(str))
+ env.Append(CPPPATH = str.split())
def AddLibs(env, str):
- env.Append(LIBS = string.split(str))
+ env.Append(LIBS = str.split())
def AddLibDirs(env, str):
- env.Append(LIBPATH = string.split(str))
+ env.Append(LIBPATH = str.split())
""")
@@ -189,7 +188,6 @@ env = env.Clone() # Yes, clobber intentionally
test.write(['src', 'lib_geng', 'SConscript'], """\
# --- Begin SConscript boilerplate ---
-import string
import sys
import Mylib
Import("env")
@@ -233,8 +231,8 @@ for k in fromdict.keys():
except SCons.Errors.UserError:
pass
todict["CFLAGS"] = fromdict["CPPFLAGS"] + " " + \
- string.join(map(lambda x: "-I" + x, env["CPPPATH"])) + " " + \
- string.join(map(lambda x: "-L" + x, env["LIBPATH"]))
+ ' '.join(["-I" + x for x in env["CPPPATH"]]) + " " + \
+ ' '.join(["-L" + x for x in env["LIBPATH"]])
todict["CXXFLAGS"] = todict["CFLAGS"]
generated_hdrs = "libg_gx.h libg_gy.h libg_gz.h"
@@ -243,9 +241,9 @@ static_hdrs = "libg_w.h"
exported_hdrs = static_hdrs
lib_name = "g"
lib_fullname = env.subst("${LIBPREFIX}g${LIBSUFFIX}")
-lib_srcs = string.split("libg_1.c libg_2.c libg_3.c")
+lib_srcs = "libg_1.c libg_2.c libg_3.c".split()
import re
-lib_objs = map(lambda x: re.sub("\.c$", ".o", x), lib_srcs)
+lib_objs = [re.sub("\.c$", ".o", x) for x in lib_srcs]
Mylib.ExportHeader(env, exported_hdrs)
Mylib.ExportLib(env, lib_fullname)
@@ -275,11 +273,11 @@ cmd_justlib = "%s %s -C ${SOURCES[0].dir}" % (escape(sys.executable),
#
# SCons bug??
-env.Command(string.split(generated_hdrs),
+env.Command(generated_hdrs.split(),
["MAKE-HEADER.py"],
cmd_generated)
recurse_env.Command([lib_fullname] + lib_objs,
- lib_srcs + string.split(generated_hdrs + " " + static_hdrs),
+ lib_srcs + (generated_hdrs + " " + static_hdrs).split(),
cmd_justlib)
""")
diff --git a/test/Scanner/no-Dir-node.py b/test/Scanner/no-Dir-node.py
index a780de1..9a47c01 100644
--- a/test/Scanner/no-Dir-node.py
+++ b/test/Scanner/no-Dir-node.py
@@ -52,9 +52,8 @@ inc2_include_h = test.workpath('inc2', 'include.h')
test.write('build.py', r"""
import os.path
-import string
import sys
-path = string.split(sys.argv[1])
+path = sys.argv[1].split()
input = open(sys.argv[2], 'rb')
output = open(sys.argv[3], 'wb')
diff --git a/test/SourceCode.py b/test/SourceCode.py
index 0f8a5c1..91af7da 100644
--- a/test/SourceCode.py
+++ b/test/SourceCode.py
@@ -41,10 +41,9 @@ import os
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
def sc_cat(env, source, target):
diff --git a/test/Subversion.py b/test/Subversion.py
index b164d8e..01a12f6 100644
--- a/test/Subversion.py
+++ b/test/Subversion.py
@@ -75,10 +75,9 @@ test.run(chdir = 'import',
test.write(['work1', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'foo/aaa.in')
@@ -123,10 +122,9 @@ test.fail_test(test.read(['work1', 'foo', 'sub', 'all']) != "import/sub/ddd.in\n
test.write(['work2', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/TAR/TAR.py b/test/TAR/TAR.py
index 80dea7a..ac8d791 100644
--- a/test/TAR/TAR.py
+++ b/test/TAR/TAR.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -88,11 +87,10 @@ tar = test.detect('TAR', 'tar')
if tar:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/TAR/TARCOM.py b/test/TAR/TARCOM.py
index 2a98d06..d1b3662 100644
--- a/test/TAR/TARCOM.py
+++ b/test/TAR/TARCOM.py
@@ -40,7 +40,7 @@ test.write('mytar.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*tar*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*tar*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TAR/TARCOMSTR.py b/test/TAR/TARCOMSTR.py
index 70b6c69..339f0ca 100644
--- a/test/TAR/TARCOMSTR.py
+++ b/test/TAR/TARCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*tar*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*tar*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TAR/TARFLAGS.py b/test/TAR/TARFLAGS.py
index e9940a8..f349b3a 100644
--- a/test/TAR/TARFLAGS.py
+++ b/test/TAR/TARFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -39,7 +38,6 @@ test.write('mytar.py', """
import getopt
import os
import os.path
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'cf:x', [])
opt_string = ''
@@ -95,11 +93,10 @@ tar = test.detect('TAR', 'tar')
if tar:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment()
diff --git a/test/TARGET-dir.py b/test/TARGET-dir.py
index d56127d..9e99087 100644
--- a/test/TARGET-dir.py
+++ b/test/TARGET-dir.py
@@ -43,10 +43,9 @@ test.subdir('src', 'build1', 'build2')
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(CPPPATH='${TARGET.dir}')
env.Append(BUILDERS = {'Cat' : Builder(action=cat)})
diff --git a/test/TARGETS.py b/test/TARGETS.py
index bf278aa..5b36c49 100644
--- a/test/TARGETS.py
+++ b/test/TARGETS.py
@@ -36,10 +36,10 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
print COMMAND_LINE_TARGETS
-print map(str, BUILD_TARGETS)
+print list(map(str, BUILD_TARGETS))
Default('.')
print COMMAND_LINE_TARGETS
-print map(str, BUILD_TARGETS)
+print list(map(str, BUILD_TARGETS))
""")
test.write('aaa', 'aaa\n')
@@ -68,17 +68,17 @@ test.run(arguments = 'bbb ccc=xyz -n aaa', stdout = expect)
test.write('SConstruct', """
env = Environment()
-print map(str, DEFAULT_TARGETS)
-print map(str, BUILD_TARGETS)
+print list(map(str, DEFAULT_TARGETS))
+print list(map(str, BUILD_TARGETS))
Default('aaa')
-print map(str, DEFAULT_TARGETS)
-print map(str, BUILD_TARGETS)
+print list(map(str, DEFAULT_TARGETS))
+print list(map(str, BUILD_TARGETS))
env.Default('bbb')
-print map(str, DEFAULT_TARGETS)
-print map(str, BUILD_TARGETS)
+print list(map(str, DEFAULT_TARGETS))
+print list(map(str, BUILD_TARGETS))
env.Default(None)
-print map(str, DEFAULT_TARGETS)
-print map(str, BUILD_TARGETS)
+print list(map(str, DEFAULT_TARGETS))
+print list(map(str, BUILD_TARGETS))
env.Default('ccc')
""")
@@ -113,9 +113,9 @@ test.run(arguments = '.', stdout = expect)
test.write('SConstruct', """\
-print map(str, BUILD_TARGETS)
+print list(map(str, BUILD_TARGETS))
SConscript('SConscript')
-print map(str, BUILD_TARGETS)
+print list(map(str, BUILD_TARGETS))
""")
test.write('SConscript', """\
diff --git a/test/TEX/LATEX.py b/test/TEX/LATEX.py
index 2316770..03d3a00 100644
--- a/test/TEX/LATEX.py
+++ b/test/TEX/LATEX.py
@@ -30,8 +30,6 @@ the produced .dvi, .aux and .log files get removed by the -c option,
and that we can use this to wrap calls to the real latex utility.
"""
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -99,11 +97,10 @@ latex = test.where_is('latex')
if latex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/TEX/LATEXCOM.py b/test/TEX/LATEXCOM.py
index 9d65134..2c63864 100644
--- a/test/TEX/LATEXCOM.py
+++ b/test/TEX/LATEXCOM.py
@@ -41,7 +41,7 @@ test.write('mylatex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*latex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/LATEXCOMSTR.py b/test/TEX/LATEXCOMSTR.py
index 9383e87..4e1b93c 100644
--- a/test/TEX/LATEXCOMSTR.py
+++ b/test/TEX/LATEXCOMSTR.py
@@ -42,7 +42,7 @@ test.write('mylatex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*latex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/LATEXFLAGS.py b/test/TEX/LATEXFLAGS.py
index 8c4e707..f693970 100644
--- a/test/TEX/LATEXFLAGS.py
+++ b/test/TEX/LATEXFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -82,11 +81,10 @@ latex = test.where_is('latex')
if latex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/TEX/PDFLATEX.py b/test/TEX/PDFLATEX.py
index a7320a1..dbae623 100644
--- a/test/TEX/PDFLATEX.py
+++ b/test/TEX/PDFLATEX.py
@@ -30,8 +30,6 @@ the produced .dvi, .aux and .log files get removed by the -c option,
and that we can use this to wrap calls to the real latex utility.
"""
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -99,11 +97,10 @@ pdflatex = test.where_is('pdflatex')
if pdflatex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/TEX/PDFLATEXCOM.py b/test/TEX/PDFLATEXCOM.py
index 36372a8..09283f3 100644
--- a/test/TEX/PDFLATEXCOM.py
+++ b/test/TEX/PDFLATEXCOM.py
@@ -41,7 +41,7 @@ test.write('mypdflatex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*latex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/PDFLATEXCOMSTR.py b/test/TEX/PDFLATEXCOMSTR.py
index e91ba87..c751e8e 100644
--- a/test/TEX/PDFLATEXCOMSTR.py
+++ b/test/TEX/PDFLATEXCOMSTR.py
@@ -43,7 +43,7 @@ test.write('mypdflatex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*latex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*latex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/PDFLATEXFLAGS.py b/test/TEX/PDFLATEXFLAGS.py
index 19c7e5a..deee9ed 100644
--- a/test/TEX/PDFLATEXFLAGS.py
+++ b/test/TEX/PDFLATEXFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -82,11 +81,10 @@ pdflatex = test.where_is('pdflatex')
if pdflatex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/TEX/PDFTEX.py b/test/TEX/PDFTEX.py
index e9b547d..321a58a 100644
--- a/test/TEX/PDFTEX.py
+++ b/test/TEX/PDFTEX.py
@@ -30,8 +30,6 @@ the produced .dvi, .aux and .log files get removed by the -c option,
and that we can use this to wrap calls to the real latex utility.
"""
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -86,11 +84,10 @@ pdftex = test.where_is('pdftex')
if pdftex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/TEX/PDFTEXCOM.py b/test/TEX/PDFTEXCOM.py
index 6d57f2c..8c31da3 100644
--- a/test/TEX/PDFTEXCOM.py
+++ b/test/TEX/PDFTEXCOM.py
@@ -41,7 +41,7 @@ test.write('mypdftex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*tex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/PDFTEXCOMSTR.py b/test/TEX/PDFTEXCOMSTR.py
index 8caa4e3..13abe7a 100644
--- a/test/TEX/PDFTEXCOMSTR.py
+++ b/test/TEX/PDFTEXCOMSTR.py
@@ -43,7 +43,7 @@ test.write('mypdftex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*tex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/PDFTEXFLAGS.py b/test/TEX/PDFTEXFLAGS.py
index d1b82fe..ce27e82 100644
--- a/test/TEX/PDFTEXFLAGS.py
+++ b/test/TEX/PDFTEXFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -75,11 +74,10 @@ pdftex = test.where_is('pdftex')
if pdftex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/TEX/TEX.py b/test/TEX/TEX.py
index 58ec40d..0de3458 100644
--- a/test/TEX/TEX.py
+++ b/test/TEX/TEX.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -30,8 +31,6 @@ the produced .dvi, .aux and .log files get removed by the -c option,
and that we can use this to wrap calls to the real latex utility.
"""
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -86,11 +85,10 @@ tex = test.where_is('tex')
if tex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
@@ -173,18 +171,18 @@ Run \texttt{latex}, then \texttt{bibtex}, then \texttt{latex} twice again \cite{
test.must_exist('bar-latex.dvi')
test.run(stderr = None)
- output_lines = string.split(test.stdout(), '\n')
+ output_lines = test.stdout().split('\n')
- reruns = filter(lambda x: string.find(x, 'latex -interaction=nonstopmode -recorder rerun.tex') != -1, output_lines)
+ reruns = [x for x in output_lines if x.find('latex -interaction=nonstopmode -recorder rerun.tex') != -1]
if len(reruns) != 2:
print "Expected 2 latex calls, got %s:" % len(reruns)
- print string.join(reruns, '\n')
+ print '\n'.join(reruns)
test.fail_test()
- bibtex = filter(lambda x: string.find(x, 'bibtex bibtex-test') != -1, output_lines)
+ bibtex = [x for x in output_lines if x.find('bibtex bibtex-test') != -1]
if len(bibtex) != 1:
print "Expected 1 bibtex call, got %s:" % len(bibtex)
- print string.join(bibtex, '\n')
+ print '\n'.join(bibtex)
test.fail_test()
test.pass_test()
diff --git a/test/TEX/TEXCOM.py b/test/TEX/TEXCOM.py
index 6336730..1cadd63 100644
--- a/test/TEX/TEXCOM.py
+++ b/test/TEX/TEXCOM.py
@@ -41,7 +41,7 @@ test.write('mytex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*tex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/TEXCOMSTR.py b/test/TEX/TEXCOMSTR.py
index d4ebe57..f1ead7f 100644
--- a/test/TEX/TEXCOMSTR.py
+++ b/test/TEX/TEXCOMSTR.py
@@ -42,7 +42,7 @@ test.write('mytex.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*tex*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*tex*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/TEX/TEXFLAGS.py b/test/TEX/TEXFLAGS.py
index efb6606..7ae86ff 100644
--- a/test/TEX/TEXFLAGS.py
+++ b/test/TEX/TEXFLAGS.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import TestSCons
@@ -75,11 +74,10 @@ tex = test.where_is('tex')
if tex:
test.write("wrapper.py", """import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
import os
diff --git a/test/ToolSurrogate.py b/test/ToolSurrogate.py
index 82e0371..a343d62 100644
--- a/test/ToolSurrogate.py
+++ b/test/ToolSurrogate.py
@@ -34,7 +34,6 @@ import TestSCons
test = TestSCons.TestSCons()
test.write('SConstruct', """\
-import string
class Curry:
def __init__(self, fun, *args, **kwargs):
self.fun = fun
@@ -48,13 +47,13 @@ class Curry:
else:
kw = kwargs or self.kwargs
- return apply(self.fun, self.pending + args, kw)
+ return self.fun(*self.pending + args, **kw)
def Str(target, source, env, cmd=""):
result = []
for cmd in env.subst_list(cmd, target=target, source=source):
- result.append(string.join(map(str, cmd)))
- return string.join(result, '\\n')
+ result.append(" ".join(map(str, cmd)))
+ return '\\n'.join(result)
class ToolSurrogate:
def __init__(self, tool, variable, func):
@@ -82,7 +81,7 @@ ToolList = {
}
platform = ARGUMENTS['platform']
-tools = map(lambda t: apply(ToolSurrogate, t), ToolList[platform])
+tools = [ToolSurrogate(*t) for t in ToolList[platform]]
env = Environment(tools=tools, PROGSUFFIX='.exe', OBJSUFFIX='.obj')
env.Program('foo.c')
diff --git a/test/Touch.py b/test/Touch.py
index bf85dcb..7c1817a 100644
--- a/test/Touch.py
+++ b/test/Touch.py
@@ -39,10 +39,9 @@ Execute(Touch('f1'))
Execute(Touch(File('f1-File')))
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Action(cat)
env = Environment()
diff --git a/test/Value.py b/test/Value.py
index 9f0645e..72a43fa 100644
--- a/test/Value.py
+++ b/test/Value.py
@@ -73,9 +73,8 @@ env.B3('f5.out', V)
test.write('put.py', """\
import os
-import string
import sys
-open(sys.argv[-1],'wb').write(string.join(sys.argv[1:-2]))
+open(sys.argv[-1],'wb').write(" ".join(sys.argv[1:-2]))
""")
# Run all of the tests with both types of source signature
diff --git a/test/Variables/BoolVariable.py b/test/Variables/BoolVariable.py
index 3630fc8..37130c0 100644
--- a/test/Variables/BoolVariable.py
+++ b/test/Variables/BoolVariable.py
@@ -29,7 +29,6 @@ Test the BoolVariable canned Variable type.
"""
import os.path
-import string
try:
True, False
@@ -44,7 +43,7 @@ test = TestSCons.TestSCons()
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
diff --git a/test/Variables/EnumVariable.py b/test/Variables/EnumVariable.py
index 241a9b9..bb85f4c 100644
--- a/test/Variables/EnumVariable.py
+++ b/test/Variables/EnumVariable.py
@@ -29,7 +29,6 @@ Test the EnumVariable canned Variable type.
"""
import os.path
-import string
import TestSCons
@@ -38,7 +37,7 @@ test = TestSCons.TestSCons()
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
diff --git a/test/Variables/ListVariable.py b/test/Variables/ListVariable.py
index 2dc7d4b..e5be625 100644
--- a/test/Variables/ListVariable.py
+++ b/test/Variables/ListVariable.py
@@ -29,7 +29,6 @@ Test the ListVariable canned Variable type.
"""
import os
-import string
import TestSCons
@@ -38,7 +37,7 @@ test = TestSCons.TestSCons()
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
r = result[1:len(expect)+1]
assert r == expect, (r, expect)
diff --git a/test/Variables/PackageVariable.py b/test/Variables/PackageVariable.py
index d626055..6ad7fc1 100644
--- a/test/Variables/PackageVariable.py
+++ b/test/Variables/PackageVariable.py
@@ -29,7 +29,6 @@ Test the PackageVariable canned Variable type.
"""
import os.path
-import string
try:
True, False
@@ -44,7 +43,7 @@ test = TestSCons.TestSCons()
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
diff --git a/test/Variables/PathVariable.py b/test/Variables/PathVariable.py
index 447d369..bfe82ba 100644
--- a/test/Variables/PathVariable.py
+++ b/test/Variables/PathVariable.py
@@ -30,7 +30,6 @@ various canned validators.
"""
import os.path
-import string
import TestSCons
@@ -39,7 +38,7 @@ test = TestSCons.TestSCons()
SConstruct_path = test.workpath('SConstruct')
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
#### test PathVariable ####
diff --git a/test/Variables/Variables.py b/test/Variables/Variables.py
index a6ed74f..454e32e 100644
--- a/test/Variables/Variables.py
+++ b/test/Variables/Variables.py
@@ -25,23 +25,19 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
-import string
test = TestSCons.TestSCons()
test.write('SConstruct', """
-import string
env = Environment()
print env['CC']
-print string.join(env['CCFLAGS'])
+print " ".join(env['CCFLAGS'])
Default(env.Alias('dummy', None))
""")
test.run()
-cc, ccflags = string.split(test.stdout(), '\n')[1:3]
+cc, ccflags = test.stdout().split('\n')[1:3]
test.write('SConstruct', """
-import string
-
# test validator. Change a key and add a new one to the environment
def validator(key, value, environ):
environ[key] = "v"
@@ -106,15 +102,15 @@ Help('Variables settable in custom.py or on the command line:\\n' + opts.Generat
print env['RELEASE_BUILD']
print env['DEBUG_BUILD']
print env['CC']
-print string.join(env['CCFLAGS'])
+print " ".join(env['CCFLAGS'])
print env['VALIDATE']
print env['valid_key']
# unspecified variables should not be set:
-assert not env.has_key('UNSPECIFIED')
+assert 'UNSPECIFIED' not in env
# undeclared variables should be ignored:
-assert not env.has_key('UNDECLARED')
+assert 'UNDECLARED' not in env
# calling Update() should not effect variables that
# are not declared on the variables object:
@@ -128,26 +124,26 @@ Default(env.Alias('dummy', None))
""")
def check(expect):
- result = string.split(test.stdout(), '\n')
+ result = test.stdout().split('\n')
assert result[1:len(expect)+1] == expect, (result[1:len(expect)+1], expect)
test.run()
-check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v'])
test.run(arguments='RELEASE_BUILD=1')
-check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
+check(['1', '1', cc, (ccflags + ' -O -g').strip(), 'v', 'v'])
test.run(arguments='RELEASE_BUILD=1 DEBUG_BUILD=0')
-check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
+check(['1', '0', cc, (ccflags + ' -O').strip(), 'v', 'v'])
test.run(arguments='CC=not_a_c_compiler')
-check(['0', '1', 'not_a_c_compiler', string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', 'not_a_c_compiler', (ccflags + ' -g').strip(), 'v', 'v'])
test.run(arguments='UNDECLARED=foo')
-check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v'])
test.run(arguments='CCFLAGS=--taco')
-check(['0', '1', cc, string.strip(ccflags + ' -g'), 'v', 'v'])
+check(['0', '1', cc, (ccflags + ' -g').strip(), 'v', 'v'])
test.write('custom.py', """
DEBUG_BUILD=0
@@ -155,10 +151,10 @@ RELEASE_BUILD=1
""")
test.run()
-check(['1', '0', cc, string.strip(ccflags + ' -O'), 'v', 'v'])
+check(['1', '0', cc, (ccflags + ' -O').strip(), 'v', 'v'])
test.run(arguments='DEBUG_BUILD=1')
-check(['1', '1', cc, string.strip(ccflags + ' -O -g'), 'v', 'v'])
+check(['1', '1', cc, (ccflags + ' -O -g').strip(), 'v', 'v'])
test.run(arguments='-h',
stdout = """\
diff --git a/test/VariantDir/SConscript-variant_dir.py b/test/VariantDir/SConscript-variant_dir.py
index 088ead2..068c312 100644
--- a/test/VariantDir/SConscript-variant_dir.py
+++ b/test/VariantDir/SConscript-variant_dir.py
@@ -59,10 +59,9 @@ var9 = Dir('../build/var9')
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)},
diff --git a/test/VariantDir/VariantDir.py b/test/VariantDir/VariantDir.py
index 396f6a9..7b89db4 100644
--- a/test/VariantDir/VariantDir.py
+++ b/test/VariantDir/VariantDir.py
@@ -21,11 +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.
#
+from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_exe = TestSCons._exe
@@ -229,10 +228,9 @@ test.write(['work1', 'src', 'b2.for'], r"""
def blank_output(err):
if not err:
return 1
- stderrlines = filter(lambda l: l, string.split(err, '\n'))
+ stderrlines = [l for l in err.split('\n') if l]
msg = "warning: tempnam() possibly used unsafely"
- stderrlines = filter(lambda l, msg=msg: string.find(l, msg) == -1,
- stderrlines)
+ stderrlines = [l for l in stderrlines if l.find(msg) == -1]
return len(stderrlines) == 0
test.run(chdir='work1', arguments = '. ../build', stderr=None)
diff --git a/test/VariantDir/errors.py b/test/VariantDir/errors.py
index f31cd71..d1490d4 100644
--- a/test/VariantDir/errors.py
+++ b/test/VariantDir/errors.py
@@ -57,10 +57,9 @@ def fake_scan(node, env, target):
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Build':Builder(action=cat)},
diff --git a/test/WhereIs.py b/test/WhereIs.py
index 7a93af4..dc127b6 100644
--- a/test/WhereIs.py
+++ b/test/WhereIs.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -57,13 +56,13 @@ pathdirs_1234 = [ test.workpath('sub1'),
test.workpath('sub2'),
test.workpath('sub3'),
test.workpath('sub4'),
- ] + string.split(env_path, os.pathsep)
+ ] + env_path.split(os.pathsep)
pathdirs_1243 = [ test.workpath('sub1'),
test.workpath('sub2'),
test.workpath('sub4'),
test.workpath('sub3'),
- ] + string.split(env_path, os.pathsep)
+ ] + env_path.split(os.pathsep)
test.write('SConstruct', """
SConscript('%s')
@@ -77,13 +76,13 @@ print WhereIs('xxx.exe', %s, reject=%s)
env.Replace( XXXNAME='xxx.exe' )
print env.WhereIs( '$XXXNAME', %s )
""" % (subdir_SConscript,
- repr(string.join(pathdirs_1234, os.pathsep)),
- repr(string.join(pathdirs_1243, os.pathsep)),
+ repr(os.pathsep.join(pathdirs_1234)),
+ repr(os.pathsep.join(pathdirs_1243)),
repr(pathdirs_1234),
repr(pathdirs_1243),
repr(pathdirs_1243),
repr(sub4_xxx_exe),
- repr(string.join(pathdirs_1243, os.pathsep)),
+ repr(os.pathsep.join(pathdirs_1243)),
))
test.write(subdir_SConscript, """
@@ -93,13 +92,13 @@ print WhereIs('xxx.exe', %s)
print env.WhereIs('xxx.exe', %s)
print WhereIs('xxx.exe', %s)
print WhereIs('xxx.exe', %s)
-""" % (repr(string.join(pathdirs_1234, os.pathsep)),
- repr(string.join(pathdirs_1243, os.pathsep)),
+""" % (repr(os.pathsep.join(pathdirs_1234)),
+ repr(os.pathsep.join(pathdirs_1243)),
repr(pathdirs_1234),
repr(pathdirs_1243),
))
-os.environ['PATH'] = string.join(pathdirs_1234, os.pathsep)
+os.environ['PATH'] = os.pathsep.join(pathdirs_1234)
expect = [ test.workpath(sub3_xxx_exe),
test.workpath(sub3_xxx_exe),
@@ -116,10 +115,10 @@ expect = [ test.workpath(sub3_xxx_exe),
]
test.run(arguments = ".",
- stdout = test.wrap_stdout(read_str = string.join(expect, "\n") + "\n",
+ stdout = test.wrap_stdout(read_str = "\n".join(expect) + "\n",
build_str = "scons: `.' is up to date.\n"))
-os.environ['PATH'] = string.join(pathdirs_1243, os.pathsep)
+os.environ['PATH'] = os.pathsep.join(pathdirs_1243)
expect = [ test.workpath(sub4_xxx_exe),
test.workpath(sub3_xxx_exe),
@@ -136,7 +135,7 @@ expect = [ test.workpath(sub4_xxx_exe),
]
test.run(arguments = ".",
- stdout = test.wrap_stdout(read_str = string.join(expect, "\n") + "\n",
+ stdout = test.wrap_stdout(read_str = "\n".join(expect) + "\n",
build_str = "scons: `.' is up to date.\n"))
diff --git a/test/Win32/bad-drive.py b/test/Win32/bad-drive.py
index ffa5aad..f2a55b8 100644
--- a/test/Win32/bad-drive.py
+++ b/test/Win32/bad-drive.py
@@ -31,8 +31,8 @@ with an invalid drive letter.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
+from string import uppercase
import TestSCons
@@ -43,8 +43,8 @@ if sys.platform != 'win32':
test.skip_test(msg)
bad_drive = None
-for i in range(len(string.uppercase)-1, -1, -1):
- d = string.uppercase[i]
+for i in range(len(uppercase)-1, -1, -1):
+ d = uppercase[i]
if not os.path.isdir(d + ':' + os.sep):
bad_drive = d + ':'
break
@@ -57,7 +57,7 @@ if bad_drive is None:
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
+ source = list(map(str, source))
print 'cat(%%s) > %%s' %% (source, target)
f = open(target, "wb")
for src in source:
diff --git a/test/Win32/default-drive.py b/test/Win32/default-drive.py
index 84e6389..f427a20 100644
--- a/test/Win32/default-drive.py
+++ b/test/Win32/default-drive.py
@@ -46,10 +46,9 @@ test.subdir('src')
test.write(['src', 'SConstruct'], """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Build':Builder(action=cat)})
diff --git a/test/Win32/mingw.py b/test/Win32/mingw.py
index 969ccfb..3385422 100644
--- a/test/Win32/mingw.py
+++ b/test/Win32/mingw.py
@@ -29,7 +29,6 @@ This tests the MinGW C/C++ compiler support.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import sys
import TestSCons
@@ -53,7 +52,7 @@ sys.exit(0)
""")
test.run()
-if string.find(test.stdout(), 'mingw exists') == -1:
+if test.stdout().find('mingw exists') == -1:
test.skip_test("No MinGW on this system, skipping test.\n")
test.subdir('header')
@@ -149,8 +148,8 @@ test.write('header/resource2.h', '''
# that comes out of stderr:
test.run(arguments='test.exe', stderr='.*')
# ensure the source def for cshared.def got used, and there wasn't a target def for chshared.dll:
-test.fail_test(string.find(test.stdout(), 'cshared.def') == -1)
-test.fail_test(string.find(test.stdout(), '-Wl,--output-def,cshared.def') != -1)
+test.fail_test(test.stdout().find('cshared.def') == -1)
+test.fail_test(test.stdout().find('-Wl,--output-def,cshared.def') != -1)
# ensure the target def got generated for the shared.dll:
test.fail_test(not os.path.exists(test.workpath('shared.def')))
test.run(program=test.workpath('test.exe'), stdout='test.cpp\nshared.cpp\nstatic.cpp\ncshared.c\n2001 resource.rc\n')
diff --git a/test/Win32/win32pathmadness.py b/test/Win32/win32pathmadness.py
index 875d959..dd04ec4 100644
--- a/test/Win32/win32pathmadness.py
+++ b/test/Win32/win32pathmadness.py
@@ -33,7 +33,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
import sys
import TestCmd
-import string
import os.path
test = TestSCons.TestSCons(match=TestCmd.match_re)
@@ -89,10 +88,10 @@ int bar(void);
drive, rest = os.path.splitdrive(test.workpath('src'))
-drive_upper = string.upper(drive)
-drive_lower = string.lower(drive)
-rest_upper = rest[0] + string.upper(rest[1]) + rest[2:]
-rest_lower = rest[0] + string.lower(rest[1]) + rest[2:]
+drive_upper = drive.upper()
+drive_lower = drive.lower()
+rest_upper = rest[0] + rest[1].upper() + rest[2:]
+rest_lower = rest[0] + rest[1].lower() + rest[2:]
combinations = [
os.path.join(drive_upper, rest_upper),
diff --git a/test/YACC/YACC.py b/test/YACC/YACC.py
index a9ef57c..59067f3 100644
--- a/test/YACC/YACC.py
+++ b/test/YACC/YACC.py
@@ -45,7 +45,6 @@ test = TestSCons.TestSCons()
test.write('myyacc.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:', [])
output = None
@@ -55,7 +54,7 @@ for opt, arg in cmd_opts:
else: opt_string = opt_string + ' ' + opt
for a in args:
contents = open(a, 'rb').read()
- output.write(string.replace(contents, 'YACC', 'myyacc.py'))
+ output.write(contents.replace('YACC', 'myyacc.py'))
output.close()
sys.exit(0)
""")
diff --git a/test/YACC/YACCCOM.py b/test/YACC/YACCCOM.py
index 14c4f01..4e43676 100644
--- a/test/YACC/YACCCOM.py
+++ b/test/YACC/YACCCOM.py
@@ -41,7 +41,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*yacc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/YACC/YACCCOMSTR.py b/test/YACC/YACCCOMSTR.py
index f920440..eaf3fde 100644
--- a/test/YACC/YACCCOMSTR.py
+++ b/test/YACC/YACCCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*yacc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/YACC/YACCFLAGS.py b/test/YACC/YACCFLAGS.py
index f36cb94..f0b698b 100644
--- a/test/YACC/YACCFLAGS.py
+++ b/test/YACC/YACCFLAGS.py
@@ -47,7 +47,6 @@ test.subdir('in')
test.write('myyacc.py', """
import getopt
-import string
import sys
cmd_opts, args = getopt.getopt(sys.argv[1:], 'o:I:x', [])
output = None
@@ -59,8 +58,8 @@ for opt, arg in cmd_opts:
else: opt_string = opt_string + ' ' + opt
for a in args:
contents = open(a, 'rb').read()
- contents = string.replace(contents, 'YACCFLAGS', opt_string)
- contents = string.replace(contents, 'I_ARGS', i_arguments)
+ contents = contents.replace('YACCFLAGS', opt_string)
+ contents = contents.replace('I_ARGS', i_arguments)
output.write(contents)
output.close()
sys.exit(0)
diff --git a/test/YACC/YACCHFILESUFFIX.py b/test/YACC/YACCHFILESUFFIX.py
index ee554b6..8801aea 100644
--- a/test/YACC/YACCHFILESUFFIX.py
+++ b/test/YACC/YACCHFILESUFFIX.py
@@ -40,7 +40,6 @@ test = TestSCons.TestSCons()
test.write('myyacc.py', """\
import getopt
import os.path
-import string
import sys
opts, args = getopt.getopt(sys.argv[1:], 'do:')
for o, a in opts:
@@ -48,11 +47,11 @@ for o, a in opts:
outfile = open(a, 'wb')
for f in args:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*yacc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
outfile.write(l)
outfile.close()
base, ext = os.path.splitext(args[0])
-open(base+'.hsuffix', 'wb').write(string.join(sys.argv)+'\\n')
+open(base+'.hsuffix', 'wb').write(" ".join(sys.argv)+'\\n')
sys.exit(0)
""")
diff --git a/test/YACC/YACCHXXFILESUFFIX.py b/test/YACC/YACCHXXFILESUFFIX.py
index 933fbc5..6664356 100644
--- a/test/YACC/YACCHXXFILESUFFIX.py
+++ b/test/YACC/YACCHXXFILESUFFIX.py
@@ -40,7 +40,6 @@ test = TestSCons.TestSCons()
test.write('myyacc.py', """\
import getopt
import os.path
-import string
import sys
opts, args = getopt.getopt(sys.argv[1:], 'do:')
for o, a in opts:
@@ -48,11 +47,11 @@ for o, a in opts:
outfile = open(a, 'wb')
for f in args:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*yacc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
outfile.write(l)
outfile.close()
base, ext = os.path.splitext(args[0])
-open(base+'.hxxsuffix', 'wb').write(string.join(sys.argv)+'\\n')
+open(base+'.hxxsuffix', 'wb').write(" ".join(sys.argv)+'\\n')
sys.exit(0)
""")
diff --git a/test/YACC/YACCVCGFILESUFFIX.py b/test/YACC/YACCVCGFILESUFFIX.py
index 655cc44..0327d8a 100644
--- a/test/YACC/YACCVCGFILESUFFIX.py
+++ b/test/YACC/YACCVCGFILESUFFIX.py
@@ -39,7 +39,6 @@ test = TestSCons.TestSCons()
test.write('myyacc.py', """\
import getopt
import os.path
-import string
import sys
vcg = None
opts, args = getopt.getopt(sys.argv[1:], 'go:')
@@ -50,12 +49,12 @@ for o, a in opts:
outfile = open(a, 'wb')
for f in args:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*yacc*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*yacc*/\\n']:
outfile.write(l)
outfile.close()
if vcg:
base, ext = os.path.splitext(args[0])
- open(base+'.vcgsuffix', 'wb').write(string.join(sys.argv)+'\\n')
+ open(base+'.vcgsuffix', 'wb').write(" ".join(sys.argv)+'\\n')
sys.exit(0)
""")
diff --git a/test/YACC/live.py b/test/YACC/live.py
index 4922c6a..28e2186 100644
--- a/test/YACC/live.py
+++ b/test/YACC/live.py
@@ -28,8 +28,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test YACC and YACCFLAGS with a live yacc compiler.
"""
-import string
-
import TestSCons
_exe = TestSCons._exe
@@ -44,11 +42,10 @@ if not yacc:
test.write("wrapper.py",
"""import os
-import string
import sys
open('%s', 'wb').write("wrapper.py\\n")
-os.system(string.join(sys.argv[1:], " "))
-""" % string.replace(test.workpath('wrapper.out'), '\\', '\\\\'))
+os.system(" ".join(sys.argv[1:]))
+""" % test.workpath('wrapper.out').replace('\\', '\\\\'))
test.write('SConstruct', """
foo = Environment(YACCFLAGS='-d')
diff --git a/test/ZIP/ZIP.py b/test/ZIP/ZIP.py
index 60f3dad..73e7810 100644
--- a/test/ZIP/ZIP.py
+++ b/test/ZIP/ZIP.py
@@ -26,7 +26,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import stat
-import string
import TestSCons
@@ -95,7 +94,7 @@ try:
def files(fname):
zf = zipfile.ZipFile(fname, 'r')
- return map(lambda x: x.filename, zf.infolist())
+ return [x.filename for x in zf.infolist()]
except ImportError:
internal_zip = 0
@@ -104,14 +103,14 @@ except ImportError:
def files(fname, test=test, unzip=unzip):
test.run(program = unzip, arguments = "-l -qq %s" % fname)
- lines = string.split(test.stdout(), "\n")[:-1]
+ lines = test.stdout().split("\n")[:-1]
def lastword(line):
- return string.split(line)[-1]
- return map(lastword, lines)
+ return line.split()[-1]
+ return list(map(lastword, lines))
if zip:
- marker_out = string.replace(test.workpath('marker.out'), '\\', '\\\\')
+ marker_out = test.workpath('marker.out').replace('\\', '\\\\')
test.write('SConstruct', """\
def marker(target, source, env):
diff --git a/test/ZIP/ZIPCOM.py b/test/ZIP/ZIPCOM.py
index 6c78824..e982c58 100644
--- a/test/ZIP/ZIPCOM.py
+++ b/test/ZIP/ZIPCOM.py
@@ -40,7 +40,7 @@ test.write('myzip.py', r"""
import sys
outfile = open(sys.argv[1], 'wb')
infile = open(sys.argv[2], 'rb')
-for l in filter(lambda l: l != '/*zip*/\n', infile.readlines()):
+for l in [l for l in infile.readlines() if l != '/*zip*/\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/ZIP/ZIPCOMSTR.py b/test/ZIP/ZIPCOMSTR.py
index acc77c7..d91a48d 100644
--- a/test/ZIP/ZIPCOMSTR.py
+++ b/test/ZIP/ZIPCOMSTR.py
@@ -42,7 +42,7 @@ import sys
outfile = open(sys.argv[1], 'wb')
for f in sys.argv[2:]:
infile = open(f, 'rb')
- for l in filter(lambda l: l != '/*zip*/\\n', infile.readlines()):
+ for l in [l for l in infile.readlines() if l != '/*zip*/\\n']:
outfile.write(l)
sys.exit(0)
""")
diff --git a/test/custom-concat.py b/test/custom-concat.py
index 9d0e64b..56c7f64 100644
--- a/test/custom-concat.py
+++ b/test/custom-concat.py
@@ -37,7 +37,7 @@ test.write('SConstruct', """
def my_concat1(pref, list, suff, env, f=None):
if f:
list = f(list)
- list = map(lambda x, p=pref, s=suff: 'my'+p+x+s+'1', list)
+ list = ['my'+pref+x+suff+'1' for x in list]
return list
myflags = '${_stripixes(MYPREFIX, LIST, MYSUFFIX, STRIPPREFIX, STRIPSUFFIX, __env__)}'
env1 = Environment(MYFLAGS=myflags, _concat = my_concat1,
diff --git a/test/explain/basic.py b/test/explain/basic.py
index fec7b93..7b3e512 100644
--- a/test/explain/basic.py
+++ b/test/explain/basic.py
@@ -29,7 +29,6 @@ Verify a lot of the basic operation of the --debug=explain option.
"""
import os
-import string
import TestSCons
@@ -317,7 +316,7 @@ Import("env")
env.Cat('file3', ['zzz', 'yyy', 'xxx'])
""")
-python_sep = string.replace(python, '\\', '\\\\')
+python_sep = python.replace('\\', '\\\\')
expect = test.wrap_stdout("""\
scons: rebuilding `file3' because the dependency order changed:
diff --git a/test/gnutools.py b/test/gnutools.py
index ee082e3..e1b7e42 100644
--- a/test/gnutools.py
+++ b/test/gnutools.py
@@ -29,7 +29,6 @@ Testing the gnu tool chain, i.e. the tools 'gcc', 'g++' and 'gnulink'.
"""
import TestSCons
-import string
import sys
_python_ = TestSCons._python_
@@ -116,8 +115,8 @@ test.run(chdir='work1')
def testObject(test, obj, expect):
contents = test.read(test.workpath('work1', obj))
- line1 = string.split(contents,'\n')[0]
- actual = string.join(string.split(line1))
+ line1 = contents.split('\n')[0]
+ actual = ' '.join(line1.split())
if not expect == actual:
print "%s: %s != %s\n" % (obj, repr(expect), repr(actual))
test.fail_test()
diff --git a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py
index 8e391c1..3365688 100644
--- a/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py
+++ b/test/implicit/IMPLICIT_COMMAND_DEPENDENCIES.py
@@ -45,11 +45,10 @@ import sys
open(sys.argv[1], 'w').write('''\
#!/usr/bin/env %(python)s
import os
-import string
import sys
fp = open(sys.argv[1], 'wb')
args = [os.path.split(sys.argv[0])[1]] + sys.argv[1:]
-fp.write(string.join(args) + '\\\\n' + '%(extra)s')
+fp.write(" ".join(args) + '\\\\n' + '%(extra)s')
for infile in sys.argv[2:]:
fp.write(open(infile, 'rb').read())
fp.close()
diff --git a/test/long-lines/signature.py b/test/long-lines/signature.py
index a8bd058..bc5d11a 100644
--- a/test/long-lines/signature.py
+++ b/test/long-lines/signature.py
@@ -39,11 +39,10 @@ build_py = test.workpath('build.py')
test.write(build_py, """\
#!/usr/bin/env python
-import string
import sys
if sys.argv[1][0] == '@':
args = open(sys.argv[1][1:], 'rb').read()
- args = string.split(args)
+ args = args.split()
else:
args = sys.argv[1:]
fp = open(args[0], 'wb')
diff --git a/test/no-arguments.py b/test/no-arguments.py
index 0fa0d8a..e447ff6 100644
--- a/test/no-arguments.py
+++ b/test/no-arguments.py
@@ -39,7 +39,7 @@ test = TestSCons.TestSCons()
test.write('SConstruct', r"""
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
+ source = list(map(str, source))
print 'cat(%s) > %s' % (source, target)
f = open(target, "wb")
for src in source:
diff --git a/test/no-target.py b/test/no-target.py
index 6c91013..be2cd51 100644
--- a/test/no-target.py
+++ b/test/no-target.py
@@ -42,10 +42,9 @@ SConscript(r'%s')
test.write(subdir_SConscript, r"""
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
b = Builder(action=cat, suffix='.out', src_suffix='.in')
diff --git a/test/option--C.py b/test/option--C.py
index 3d93d2f..1a9a72b 100644
--- a/test/option--C.py
+++ b/test/option--C.py
@@ -25,16 +25,15 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
-import string
import types
import TestSCons
def match_normcase(lines, matches):
if not type(lines) is types.ListType:
- lines = string.split(lines, "\n")
+ lines = lines.split("\n")
if not type(matches) is types.ListType:
- matches = string.split(matches, "\n")
+ matches = matches.split("\n")
if len(lines) != len(matches):
return
for i in range(len(lines)):
diff --git a/test/option--random.py b/test/option--random.py
index 0e5cc66..a9b9b9d 100644
--- a/test/option--random.py
+++ b/test/option--random.py
@@ -37,10 +37,9 @@ test = TestSCons.TestSCons()
test.write('SConscript', """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
env = Environment(BUILDERS={'Cat':Builder(action=cat)})
env.Cat('aaa.out', 'aaa.in')
diff --git a/test/option-j.py b/test/option-j.py
index 83597ca..3eb7bd3 100644
--- a/test/option-j.py
+++ b/test/option-j.py
@@ -30,7 +30,6 @@ SConscript settable option.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os.path
-import string
import TestSCons
@@ -91,10 +90,10 @@ def RunTest(args, extra):
test.run(arguments = args)
str = test.read("f1")
- start1,finish1 = map(float, string.split(str, "\n"))
+ start1,finish1 = list(map(float, str.split("\n")))
str = test.read("f2")
- start2,finish2 = map(float, string.split(str, "\n"))
+ start2,finish2 = list(map(float, str.split("\n")))
return start2, finish1
@@ -149,10 +148,10 @@ warn = \
test.must_contain_all_lines(test.stderr(), [warn])
str = test.read("f1")
-start1,finish1 = map(float, string.split(str, "\n"))
+start1,finish1 = list(map(float, str.split("\n")))
str = test.read("f2")
-start2,finish2 = map(float, string.split(str, "\n"))
+start2,finish2 = list(map(float, str.split("\n")))
test.fail_test(start2 < finish1)
diff --git a/test/option/debug-count.py b/test/option/debug-count.py
index a52e201..c233bf5 100644
--- a/test/option/debug-count.py
+++ b/test/option/debug-count.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -28,7 +29,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
Test that the --debug=count option works.
"""
-import string
import re
import TestSCons
@@ -73,11 +73,11 @@ for args in ['-h --debug=count', '--debug=count']:
test.run(arguments = args)
stdout = test.stdout()
- missing = filter(lambda o: find_object_count(o, stdout) is None, objects)
+ missing = [o for o in objects if find_object_count(o, stdout) is None]
if missing:
print "Missing the following object lines from '%s' output:" % args
- print "\t", string.join(missing)
+ print "\t", ' '.join(missing)
print "STDOUT =========="
print stdout
test.fail_test(1)
diff --git a/test/option/debug-memory.py b/test/option/debug-memory.py
index 0838501..c9165ed 100644
--- a/test/option/debug-memory.py
+++ b/test/option/debug-memory.py
@@ -29,7 +29,6 @@ Test that the --debug=memory option works.
"""
import re
-import string
import TestSCons
@@ -60,7 +59,7 @@ test.write('file.in', "file.in\n")
test.run(arguments = '--debug=memory')
-lines = string.split(test.stdout(), '\n')
+lines = test.stdout().split('\n')
test.fail_test(re.match(r'Memory before reading SConscript files: +\d+', lines[-5]) is None)
test.fail_test(re.match(r'Memory after reading SConscript files: +\d+', lines[-4]) is None)
@@ -71,7 +70,7 @@ test.fail_test(re.match(r'Memory after building targets: +\d+', lines[-2]) is No
test.run(arguments = '-h --debug=memory')
-lines = string.split(test.stdout(), '\n')
+lines = test.stdout().split('\n')
test.fail_test(re.match(r'Memory before reading SConscript files: +\d+', lines[-3]) is None)
test.fail_test(re.match(r'Memory after reading SConscript files: +\d+', lines[-2]) is None)
diff --git a/test/option/debug-presub.py b/test/option/debug-presub.py
index b503821..28eeb83 100644
--- a/test/option/debug-presub.py
+++ b/test/option/debug-presub.py
@@ -39,10 +39,9 @@ sys.exit(0)
test.write('SConstruct', """\
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
FILE = Builder(action="$FILECOM")
TEMP = Builder(action="$TEMPCOM")
diff --git a/test/option/debug-time.py b/test/option/debug-time.py
index d9ca237..a1e0254 100644
--- a/test/option/debug-time.py
+++ b/test/option/debug-time.py
@@ -25,7 +25,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
-import string
import re
import time
@@ -110,7 +109,7 @@ complete_time = time.time() - start_time
expected_total_time = complete_time - overhead
pattern = r'Command execution time: (\d+\.\d+) seconds'
-times = map(float, re.findall(pattern, test.stdout()))
+times = list(map(float, re.findall(pattern, test.stdout())))
expected_command_time = reduce(lambda x, y: x + y, times, 0.0)
@@ -153,7 +152,7 @@ outside of the 15%% tolerance.
""" % locals())
if failures or warnings:
- print string.join([test.stdout()] + failures + warnings, '\n')
+ print '\n'.join([test.stdout()] + failures + warnings)
if failures:
test.fail_test(1)
@@ -190,7 +189,7 @@ outside of the 1%% tolerance.
""" % locals())
if failures:
- print string.join([test.stdout()] + failures, '\n')
+ print '\n'.join([test.stdout()] + failures)
test.fail_test(1)
test.run(arguments = "-j4 --debug=time . SLEEP=1")
diff --git a/test/option/help-options.py b/test/option/help-options.py
index 9a87306..0f4dd4d 100644
--- a/test/option/help-options.py
+++ b/test/option/help-options.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -29,7 +30,6 @@ Verify behavior of the -H and --help-options options.
"""
import re
-import string
import TestSCons
@@ -53,13 +53,13 @@ test.must_contain_all_lines(test.stdout(), expect)
ignored_re = re.compile('.*Ignored for compatibility\\.\n', re.S)
stdout = ignored_re.sub('', test.stdout())
-lines = string.split(stdout, '\n')
-lines = filter(lambda x: x[:3] == ' -', lines)
-lines = map(lambda x: x[3:], lines)
-lines = map(lambda x: x[0] == '-' and x[1:] or x, lines)
-options = map(lambda x: string.split(x)[0], lines)
-options = map(lambda x: x[-1] == ',' and x[:-1] or x, options)
-lowered = map(lambda x: string.lower(x), options)
+lines = stdout.split('\n')
+lines = [x for x in lines if x[:3] == ' -']
+lines = [x[3:] for x in lines]
+lines = [x[0] == '-' and x[1:] or x for x in lines]
+options = [x.split()[0] for x in lines]
+options = [x[-1] == ',' and x[:-1] or x for x in options]
+lowered = [x.lower() for x in options]
sorted = lowered[:]
sorted.sort()
if lowered != sorted:
diff --git a/test/option/md5-chunksize.py b/test/option/md5-chunksize.py
index 9d15e84..acd3492 100644
--- a/test/option/md5-chunksize.py
+++ b/test/option/md5-chunksize.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -90,7 +88,7 @@ test.pass_test()
#
test2 = TestSCons.TestSCons()
-if string.find(sys.platform, 'linux') == -1:
+if sys.platform.find('linux') == -1:
test2.skip_test("skipping test on non-Linux platform '%s'\n" % sys.platform)
dd = test2.where_is('dd')
diff --git a/test/option/profile.py b/test/option/profile.py
index ed5bc0a..ab99dab 100644
--- a/test/option/profile.py
+++ b/test/option/profile.py
@@ -21,10 +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.
#
+from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
import StringIO
import sys
@@ -96,8 +96,8 @@ expect = [
test.must_contain_all_lines(test.stdout(), expect)
expect = 'Memory before reading SConscript files'
-lines = string.split(test.stdout(), '\n')
-memory_lines = filter(lambda l, e=expect: string.find(l, e) != -1, lines)
+lines = test.stdout().split('\n')
+memory_lines = [l for l in lines if l.find(expect) != -1]
test.fail_test(len(memory_lines) != 1)
diff --git a/test/option/stack-size.py b/test/option/stack-size.py
index 9458356..3d7a715 100644
--- a/test/option/stack-size.py
+++ b/test/option/stack-size.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -81,7 +79,7 @@ expected_stdout = test.wrap_stdout("""\
%(_python_)s ../build.py f2.out f2.in
""" % locals())
-re_expected_stdout = string.replace(expected_stdout, '\\', '\\\\')
+re_expected_stdout = expected_stdout.replace('\\', '\\\\')
expect_unsupported = """
scons: warning: Setting stack size is unsupported by this version of Python:
diff --git a/test/option/tree-all.py b/test/option/tree-all.py
index 0bd1717..fc0f689 100644
--- a/test/option/tree-all.py
+++ b/test/option/tree-all.py
@@ -31,7 +31,6 @@ complete dependencies of a target.
import TestSCons
import sys
-import string
test = TestSCons.TestSCons()
@@ -95,7 +94,7 @@ tree1 = """
""" % locals()
test.run(arguments = "--tree=all Foo.xxx")
-if string.count(test.stdout(), tree1) != 1:
+if test.stdout().count(tree1) != 1:
sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
@@ -158,13 +157,13 @@ tree3 = """
""" % locals()
test.run(arguments = "--tree=all,prune .")
-if string.count(test.stdout(), tree3) != 1:
+if test.stdout().count(tree3) != 1:
sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
test.run(arguments = "--tree=prune .")
-if string.count(test.stdout(), tree3) != 1:
+if test.stdout().count(tree3) != 1:
sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
@@ -198,13 +197,13 @@ tree4 = """
test.run(arguments = '-c Foo.xxx')
test.run(arguments = "--no-exec --tree=all,status Foo.xxx")
-if string.count(test.stdout(), tree4) != 1:
+if test.stdout().count(tree4) != 1:
sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
test.run(arguments = "--no-exec --tree=status Foo.xxx")
-if string.count(test.stdout(), tree4) != 1:
+if test.stdout().count(tree4) != 1:
sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
@@ -221,7 +220,7 @@ THIS SHOULD CAUSE A BUILD FAILURE
test.run(arguments = "--tree=all Foo.xxx",
status = 2,
stderr = None)
-if string.count(test.stdout(), tree1) != 1:
+if test.stdout().count(tree1) != 1:
sys.stdout.write('Did not find expected tree (or found duplicate) in the following output:\n')
sys.stdout.write(test.stdout())
test.fail_test()
diff --git a/test/packaging/convenience-functions.py b/test/packaging/convenience-functions.py
index 9554383..66374e3 100644
--- a/test/packaging/convenience-functions.py
+++ b/test/packaging/convenience-functions.py
@@ -29,7 +29,6 @@ Test the FindInstalledFiles() and the FindSourceFiles() functions.
"""
import os.path
-import string
import TestSCons
python = TestSCons.python
@@ -44,8 +43,8 @@ env = Environment(tools=['default', 'packaging'])
prog = env.Install( 'bin/', ["f1", "f2"] )
env.File( "f3" )
-src_files = map(str, env.FindSourceFiles())
-oth_files = map(str, env.FindInstalledFiles())
+src_files = list(map(str, env.FindSourceFiles()))
+oth_files = list(map(str, env.FindInstalledFiles()))
src_files.sort()
oth_files.sort()
@@ -56,8 +55,8 @@ print oth_files
bin_f1 = os.path.join('bin', 'f1')
bin_f2 = os.path.join('bin', 'f2')
-bin__f1 = string.replace(bin_f1, '\\', '\\\\')
-bin__f2 = string.replace(bin_f2, '\\', '\\\\')
+bin__f1 = bin_f1.replace('\\', '\\\\')
+bin__f2 = bin_f2.replace('\\', '\\\\')
expect_read = """\
['SConstruct', 'f1', 'f2', 'f3']
diff --git a/test/preserve-source.py b/test/preserve-source.py
index cd0b3a3..6e09073 100644
--- a/test/preserve-source.py
+++ b/test/preserve-source.py
@@ -34,7 +34,7 @@ test = TestSCons.TestSCons()
test.write('SConstruct', r"""
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
+ source = list(map(str, source))
print 'cat(%s) > %s' % (source, target)
f = open(target, "wb")
for src in source:
diff --git a/test/python-version.py b/test/python-version.py
index 8230fd3..3cc3395 100644
--- a/test/python-version.py
+++ b/test/python-version.py
@@ -31,7 +31,6 @@ of Python.
import os
import re
-import string
import TestCmd
import TestSCons
diff --git a/test/runtest/fallback.py b/test/runtest/fallback.py
index 6a971f8..027d79d 100644
--- a/test/runtest/fallback.py
+++ b/test/runtest/fallback.py
@@ -30,7 +30,6 @@ if it can't find qmtest on the $PATH.
"""
import os
-import string
import TestRuntest
@@ -42,9 +41,9 @@ test = TestRuntest.TestRuntest(noqmtest=1)
while test.where_is('qmtest'):
qmtest=test.where_is('qmtest')
dir = os.path.split(qmtest)[0]
- path = string.split(os.environ['PATH'], os.pathsep)
+ path = os.environ['PATH'].split(os.pathsep)
path.remove(dir)
- os.environ['PATH'] = string.join(path, os.pathsep)
+ os.environ['PATH'] = os.pathsep.join(path)
test.subdir('test')
@@ -83,7 +82,7 @@ testlist = [
test_pass_py,
]
-test.run(arguments = string.join(testlist),
+test.run(arguments = ' '.join(testlist),
status = 1,
stdout = expect_stdout,
stderr = expect_stderr)
diff --git a/test/runtest/noqmtest.py b/test/runtest/noqmtest.py
index 78b021d..99352a1 100644
--- a/test/runtest/noqmtest.py
+++ b/test/runtest/noqmtest.py
@@ -30,7 +30,6 @@ using qmtest.
"""
import os
-import string
import TestRuntest
@@ -75,7 +74,7 @@ testlist = [
test_pass_py,
]
-test.run(arguments = '--noqmtest %s' % string.join(testlist),
+test.run(arguments = '--noqmtest %s' % ' '.join(testlist),
status = 1,
stdout = expect_stdout,
stderr = expect_stderr)
diff --git a/test/runtest/python.py b/test/runtest/python.py
index 9579746..5c2f737 100644
--- a/test/runtest/python.py
+++ b/test/runtest/python.py
@@ -30,7 +30,6 @@ Test that the -P option lets us specify a Python version to use.
import os
import re
-import string
if not hasattr(os.path, 'pardir'):
os.path.pardir = '..'
@@ -47,7 +46,7 @@ head, dir = os.path.split(head)
mypython = os.path.join(head, dir, os.path.pardir, dir, python)
def escape(s):
- return string.replace(s, '\\', '\\\\')
+ return s.replace('\\', '\\\\')
if re.search('\s', mypython):
mypythonstring = '"%s"' % escape(mypython)
diff --git a/test/runtest/qmtest.py b/test/runtest/qmtest.py
index 9f9274e..de04c3f 100644
--- a/test/runtest/qmtest.py
+++ b/test/runtest/qmtest.py
@@ -30,7 +30,6 @@ not directly via Python.
"""
import os.path
-import string
import TestRuntest
@@ -92,7 +91,7 @@ testlist = [
test_pass_py,
]
-test.run(arguments='--qmtest %s' % string.join(testlist),
+test.run(arguments='--qmtest %s' % ' '.join(testlist),
status=1,
stdout=expect_stdout)
diff --git a/test/runtest/xml/output.py b/test/runtest/xml/output.py
index c024f37..7bf6b2d 100644
--- a/test/runtest/xml/output.py
+++ b/test/runtest/xml/output.py
@@ -30,7 +30,6 @@ Test writing XML output to a file.
import os
import re
-import string
import TestCmd
import TestRuntest
diff --git a/test/scons-time/help/all-subcommands.py b/test/scons-time/help/all-subcommands.py
index 7de7fc6..8641d71 100644
--- a/test/scons-time/help/all-subcommands.py
+++ b/test/scons-time/help/all-subcommands.py
@@ -21,6 +21,7 @@
# 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 generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
@@ -45,11 +46,11 @@ except: pass
# Extract all subcommands from the the do_*() functions.
functions = globals['SConsTimer'].__dict__.keys()
-do_funcs = filter(lambda x: x[:3] == 'do_', functions)
+do_funcs = [x for x in functions if x[:3] == 'do_']
-subcommands = map(lambda x: x[3:], do_funcs)
+subcommands = [x[3:] for x in do_funcs]
-expect = map(lambda x: ' %s ' % x, subcommands)
+expect = [' %s ' % x for x in subcommands]
test.run(arguments = 'help')
diff --git a/test/sconsign/ghost-entries.py b/test/sconsign/ghost-entries.py
index 2f8ee73..46916ca 100644
--- a/test/sconsign/ghost-entries.py
+++ b/test/sconsign/ghost-entries.py
@@ -89,7 +89,7 @@ test.run(arguments="-Q go case=2")
test.write('SConstruct', """\
Command("d/current.txt", [], [Touch("$TARGET")])
-if ARGUMENTS.has_key('pass') and ARGUMENTS['pass'] == '1':
+if 'pass' in ARGUMENTS and ARGUMENTS['pass'] == '1':
Command("d/obsolete.txt", [], [Touch("$TARGET")])
Command("installer.exe", ['d'], [Touch("$TARGET")])
""")
diff --git a/test/sconsign/script/SConsignFile.py b/test/sconsign/script/SConsignFile.py
index e974c67..fc65829 100644
--- a/test/sconsign/script/SConsignFile.py
+++ b/test/sconsign/script/SConsignFile.py
@@ -44,10 +44,9 @@ fake_link_py = test.workpath('fake_link.py')
test.write(fake_cc_py, r"""#!/usr/bin/env python
import os
import re
-import string
import sys
-path = string.split(sys.argv[1])
+path = sys.argv[1].split()
output = open(sys.argv[2], 'wb')
input = open(sys.argv[3], 'rb')
diff --git a/test/sconsign/script/Signatures.py b/test/sconsign/script/Signatures.py
index 5a7b5cf..cfd2a7f 100644
--- a/test/sconsign/script/Signatures.py
+++ b/test/sconsign/script/Signatures.py
@@ -63,10 +63,9 @@ fake_link_py = test.workpath('fake_link.py')
test.write(fake_cc_py, r"""#!/usr/bin/env python
import os
import re
-import string
import sys
-path = string.split(sys.argv[1])
+path = sys.argv[1].split()
output = open(sys.argv[2], 'wb')
input = open(sys.argv[3], 'rb')
diff --git a/test/sconsign/script/no-SConsignFile.py b/test/sconsign/script/no-SConsignFile.py
index 8924329..fe68f91 100644
--- a/test/sconsign/script/no-SConsignFile.py
+++ b/test/sconsign/script/no-SConsignFile.py
@@ -52,10 +52,9 @@ fake_link_py = test.workpath('fake_link.py')
test.write(fake_cc_py, r"""#!/usr/bin/env python
import os
import re
-import string
import sys
-path = string.split(sys.argv[1])
+path = sys.argv[1].split()
output = open(sys.argv[2], 'wb')
input = open(sys.argv[3], 'rb')
diff --git a/test/special-filenames.py b/test/special-filenames.py
index 86a6e59..00e4a3d 100644
--- a/test/special-filenames.py
+++ b/test/special-filenames.py
@@ -24,8 +24,6 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-import string
-
import TestSCons
_python_ = TestSCons._python_
@@ -57,7 +55,7 @@ open(sys.argv[1], 'wb').write(open(sys.argv[2], 'rb').read())
file_names = []
for fn in attempt_file_names:
try:
- in_name = string.replace(fn, '$$', '$') + '.in'
+ in_name = fn.replace('$$', '$') + '.in'
test.write(in_name, fn + '\n')
file_names.append(fn)
except IOError:
@@ -68,7 +66,7 @@ for fn in attempt_file_names:
def buildFileStr(fn):
return "env.Build(source=r\"\"\"%s.in\"\"\", target=r\"\"\"%s.out\"\"\")" % ( fn, fn )
-xxx = string.join(map(buildFileStr, file_names), '\n')
+xxx = '\n'.join(map(buildFileStr, file_names))
test.write("SConstruct", """
env=Environment(BUILDERS = {'Build' : Builder(action = '%(_python_)s cat.py $TARGET $SOURCE')})
@@ -79,7 +77,7 @@ env=Environment(BUILDERS = {'Build' : Builder(action = '%(_python_)s cat.py $TAR
test.run(arguments='.')
for fn in file_names:
- out_name = string.replace(fn, '$$', '$') + '.out'
+ out_name = fn.replace('$$', '$') + '.out'
test.fail_test(test.read(out_name) != fn + '\n')
test.pass_test()
diff --git a/test/srcchange.py b/test/srcchange.py
index 27921a9..d181297 100644
--- a/test/srcchange.py
+++ b/test/srcchange.py
@@ -44,18 +44,16 @@ test = TestSCons.TestSCons()
test.write('getrevision', """
#!/usr/bin/env python
-import string
-print string.strip(open('revnum.in','rb').read())
+print open('revnum.in','rb').read().strip()
""")
test.write('SConstruct', """
import re
-import string
def subrevision(target, source ,env):
orig = target[0].get_text_contents()
new = re.sub('\$REV.*?\$',
- '$REV: %%s$'%%string.strip(source[0].get_text_contents()),
+ '$REV: %%s$'%%source[0].get_text_contents().strip(),
target[0].get_text_contents())
outf = open(str(target[0]),'wb')
outf.write(new)
diff --git a/test/subdivide.py b/test/subdivide.py
index a80bc46..2978e08 100644
--- a/test/subdivide.py
+++ b/test/subdivide.py
@@ -132,8 +132,7 @@ src/sub/bar.c
""" % locals()
if os.sep == '\\':
- import string
- expect = string.replace(expect, '\\', '\\\\')
+ expect = expect.replace('\\', '\\\\')
test.must_match(['src', 'prog.exe'], expect)
diff --git a/test/suffixes.py b/test/suffixes.py
index c6ca1d0..74655ec 100644
--- a/test/suffixes.py
+++ b/test/suffixes.py
@@ -35,10 +35,9 @@ test = TestSCons.TestSCons()
test.write('SConstruct', """
def cat(env, source, target):
target = str(target[0])
- source = map(str, source)
f = open(target, "wb")
for src in source:
- f.write(open(src, "rb").read())
+ f.write(open(str(src), "rb").read())
f.close()
Cat = Builder(action=cat, suffix='.out')
env = Environment(BUILDERS = {'Cat':Cat})
diff --git a/test/textfile.py b/test/textfile.py
index 27b6b40..64f8605 100644
--- a/test/textfile.py
+++ b/test/textfile.py
@@ -27,7 +27,6 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import TestSCons
import os
-import string
test = TestSCons.TestSCons()
@@ -47,8 +46,8 @@ env.Textfile('foo1a.txt', data + [''])
env.Textfile('foo2a.txt', data + [''], LINESEPARATOR='|*')
# recreate the list with the data wrapped in Value()
-data0 = map(Value, data0)
-data = map(Value, data)
+data0 = list(map(Value, data0))
+data = list(map(Value, data))
data[2] = data0
env.Substfile('bar1', data)
@@ -63,25 +62,25 @@ test.run(arguments = '.')
textparts = ['lalala', '42',
'Goethe', 'Schiller',
'tanteratei']
-foo1Text = string.join(textparts, os.linesep)
-foo2Text = string.join(textparts, '|*')
+foo1Text = os.linesep.join(textparts)
+foo2Text = '|*'.join(textparts)
foo1aText = foo1Text + os.linesep
foo2aText = foo2Text + '|*'
test.up_to_date(arguments = '.')
-files = map(test.workpath, (
+files = list(map(test.workpath, (
'foo1.txt', 'foo2.txt', 'foo1a.txt', 'foo2a.txt',
'bar1', 'bar2', 'bar1a.txt', 'bar2a.txt',
- ))
+ )))
def check_times():
# make sure the files didn't get rewritten, because nothing changed:
- before = map(os.path.getmtime, files)
+ before = list(map(os.path.getmtime, files))
# introduce a small delay, to make the test valid
test.sleep()
# should still be up-to-date
test.up_to_date(arguments = '.')
- after = map(os.path.getmtime, files)
+ after = list(map(os.path.getmtime, files))
test.fail_test(before != after)
# make sure that the file content is as expected
@@ -142,7 +141,7 @@ line3a = 'This line has %subst% substitutions'
line3b = 'This line has many substitutions'
def matchem(file, lines):
- lines = string.join(lines, os.linesep)
+ lines = os.linesep.join(lines)
test.must_match(file, lines)
matchem('text.txt', [line1, line2a, line3a])