diff options
author | Mats Wichmann <mats@linux.com> | 2020-02-18 15:24:13 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-02-20 14:27:02 (GMT) |
commit | 71389d9642877ffcb191b16f7b08ba3bf78da530 (patch) | |
tree | 239c29d2ac66c5fc32640431329b11ae97c75832 | |
parent | 6975fa52a3424d995aadeabd31f57d491456a3e4 (diff) | |
download | SCons-71389d9642877ffcb191b16f7b08ba3bf78da530.zip SCons-71389d9642877ffcb191b16f7b08ba3bf78da530.tar.gz SCons-71389d9642877ffcb191b16f7b08ba3bf78da530.tar.bz2 |
rm-py2: Remove "from __future__" from more places
A couple of minor reformats along the way, most prominently, in tests,
if being edited anyway, make sure the docstring most tests have is
actually the docstring (sometimes the __revision__ line came before,
which makes the string not be the docstring).
Snuck in some minor framework changes that were orphaned when another
draft PR was not needed: this almost all docstring changes, the
functional part is using casefold instead of lower in a match func -
a slightly better approach which is now possible that Py2 compatibility
is not needed.
Signed-off-by: Mats Wichmann <mats@linux.com>
57 files changed, 116 insertions, 226 deletions
@@ -3,8 +3,6 @@ # # See the README.rst file for an overview of how SCons is built and tested. -from __future__ import print_function - copyright_years = '2001 - 2019' # This gets inserted into the man pages to reflect the month of release. diff --git a/bootstrap.py b/bootstrap.py index 4ade361..d47c966 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -20,18 +20,8 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -import os -import os.path -import sys -import glob -import subprocess -import filecmp -import shutil -__doc__ = """bootstrap.py +"""bootstrap.py Execute SCons from this source tree. It copies Python scripts and modules from src/ subdirectory into a subdirectory named "bootstrap/" (by default), @@ -75,6 +65,14 @@ the following SCons options: "eaten" by the bootstrap.py script. """ +import os +import os.path +import sys +import glob +import subprocess +import filecmp +import shutil + def parseManifestLines(basedir, manifest): """ Scans a MANIFEST file, and returns the list of source files. diff --git a/doc/SConscript b/doc/SConscript index e43a27b..8f6d1cd 100644 --- a/doc/SConscript +++ b/doc/SConscript @@ -24,8 +24,6 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - import os.path import re import sys diff --git a/doc/user/parseflags.xml b/doc/user/parseflags.xml index 836b7f2..35c336e 100644 --- a/doc/user/parseflags.xml +++ b/doc/user/parseflags.xml @@ -80,14 +80,13 @@ <scons_example name="parseflags_ex1"> <file name="SConstruct" printme="1"> -from __future__ import print_function env = Environment() d = env.ParseFlags("-I/opt/include -L/opt/lib -lfoo") -for k,v in sorted(d.items()): +for k, v in sorted(d.items()): if v: print(k, v) env.MergeFlags(d) -env.Program('f1.c') +env.Program("f1.c") </file> <file name="f1.c"> int main() { return 0; } @@ -120,14 +119,13 @@ int main() { return 0; } <scons_example name="parseflags_ex2"> <file name="SConstruct" printme="1"> -from __future__ import print_function env = Environment() d = env.ParseFlags("-whatever") -for k,v in sorted(d.items()): +for k, v in sorted(d.items()): if v: print(k, v) env.MergeFlags(d) -env.Program('f1.c') +env.Program("f1.c") </file> <file name="f1.c"> int main() { return 0; } @@ -147,14 +145,13 @@ env.Program('f1.c') <scons_example name="parseflags_ex3"> <file name="SConstruct" printme="1"> -from __future__ import print_function env = Environment() d = env.ParseFlags(["-I/opt/include", ["-L/opt/lib", "-lfoo"]]) -for k,v in sorted(d.items()): +for k, v in sorted(d.items()): if v: print(k, v) env.MergeFlags(d) -env.Program('f1.c') +env.Program("f1.c") </file> <file name="f1.c"> int main() { return 0; } @@ -175,14 +172,13 @@ int main() { return 0; } <scons_example name="parseflags_ex4"> <file name="SConstruct" printme="1"> -from __future__ import print_function env = Environment() d = env.ParseFlags(["!echo -I/opt/include", "!echo -L/opt/lib", "-lfoo"]) -for k,v in sorted(d.items()): +for k, v in sorted(d.items()): if v: print(k, v) env.MergeFlags(d) -env.Program('f1.c') +env.Program("f1.c") </file> <file name="f1.c"> int main() { return 0; } @@ -69,8 +69,6 @@ Environment Variables: TESTCMD_VERBOSE: turn on verbosity in TestCommand\ """ -from __future__ import print_function - import getopt import glob import os diff --git a/src/script/scons-time.py b/src/script/scons-time.py index 0fcd1c4..e4dd863 100644 --- a/src/script/scons-time.py +++ b/src/script/scons-time.py @@ -29,7 +29,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # 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 division __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/test/AddOption/help.py b/test/AddOption/help.py index 7b886cb..23e5bd1 100644 --- a/test/AddOption/help.py +++ b/test/AddOption/help.py @@ -20,15 +20,14 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify the help text when the AddOption() function is used (and when it's not). """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons test = TestSCons.TestSCons() diff --git a/test/Command.py b/test/Command.py index d8ca86d..5abdf16 100644 --- a/test/Command.py +++ b/test/Command.py @@ -20,7 +20,7 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# + __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons @@ -42,7 +42,6 @@ test.write('build.py', build_py) test.write(['expand_chdir_sub', 'subbuild.py'], build_py) test.write('SConstruct', """ -from __future__ import print_function import os import sys diff --git a/test/Configure/ConfigureDryRunError.py b/test/Configure/ConfigureDryRunError.py index ad40ea4..3648518 100644 --- a/test/Configure/ConfigureDryRunError.py +++ b/test/Configure/ConfigureDryRunError.py @@ -20,15 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify the ConfigureDryRunError. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import TestSCons diff --git a/test/Configure/config-h.py b/test/Configure/config-h.py index 405f259..0331b24 100644 --- a/test/Configure/config-h.py +++ b/test/Configure/config-h.py @@ -20,15 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify creation of a config.h file from a Configure context. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import re diff --git a/test/Configure/custom-tests.py b/test/Configure/custom-tests.py index 1c6eac8..47b344a 100644 --- a/test/Configure/custom-tests.py +++ b/test/Configure/custom-tests.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify execution of custom test cases. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons _exe = TestSCons._exe @@ -49,8 +48,6 @@ runOK = compileOK runFAIL = "int main(void) { return 1; }" test.write('pyAct.py', """\ -from __future__ import print_function - import sys print(sys.argv[1]) sys.exit(int(sys.argv[1])) diff --git a/test/Configure/implicit-cache.py b/test/Configure/implicit-cache.py index 20bdebb..f4f3e94 100644 --- a/test/Configure/implicit-cache.py +++ b/test/Configure/implicit-cache.py @@ -20,10 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that use of --implicit-cache with the Python Value Nodes @@ -56,6 +52,8 @@ something else changed in the .sconf_temp directory), the string would get longer and longer until it blew out the users's memory. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSConsign test = TestSConsign.TestSConsign() diff --git a/test/ENV.py b/test/ENV.py index 0866cf5..0fc3f09 100644 --- a/test/ENV.py +++ b/test/ENV.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -70,9 +69,7 @@ env['ENV']['LIST'] = [foo, 'bar'] env['ENV']['FOO'] = foo """ % locals()) -test.write('build.py', -r""" -from __future__ import print_function +test.write('build.py', r""" import os print('LIST:', os.environ['LIST']) print('FOO:', os.environ['FOO']) diff --git a/test/GetBuildFailures/parallel.py b/test/GetBuildFailures/parallel.py index 63125ad..9b162d8 100644 --- a/test/GetBuildFailures/parallel.py +++ b/test/GetBuildFailures/parallel.py @@ -20,8 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function """ Verify that a failed build action with -j works as expected. diff --git a/test/Glob/glob-libpath.py b/test/Glob/glob-libpath.py index 0878090..b688b7e 100644 --- a/test/Glob/glob-libpath.py +++ b/test/Glob/glob-libpath.py @@ -20,10 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that Glob() in a subdir doesn't corrupt LIBPATH. @@ -31,6 +27,8 @@ See bug #2184, "Glob pollutes LIBPATH" from Ian P. Cardenas. Test output should not contain -Lsrc/util. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons test = TestSCons.TestSCons() diff --git a/test/Interactive/shell.py b/test/Interactive/shell.py index dd13504..e839d6d 100644 --- a/test/Interactive/shell.py +++ b/test/Interactive/shell.py @@ -20,14 +20,14 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify the ability of the "shell" command (and its "sh" and "!" aliases) to shell out of interactive mode. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import sys import TestSCons @@ -40,8 +40,6 @@ shell_command_py = test.workpath('shell_command.py') _shell_command_py_ = '"%s"' % shell_command_py.replace('\\', '\\\\') test.write(shell_command_py, """\ -from __future__ import print_function - print('hello from shell_command.py') """) diff --git a/test/Interactive/version.py b/test/Interactive/version.py index 88416ad..6609ad7 100644 --- a/test/Interactive/version.py +++ b/test/Interactive/version.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify the behavior of the "version" subcommand. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestCmd import TestSCons diff --git a/test/Java/multi-step.py b/test/Java/multi-step.py index f5ee257..d0b3450 100644 --- a/test/Java/multi-step.py +++ b/test/Java/multi-step.py @@ -20,16 +20,14 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Real-world test (courtesy Leanid Nazdrynau) of the multi-step capabilities of the various Java Builders. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import TestSCons diff --git a/test/LINK/VersionedLib.py b/test/LINK/VersionedLib.py index 64f9b90..104f696 100644 --- a/test/LINK/VersionedLib.py +++ b/test/LINK/VersionedLib.py @@ -20,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -from __future__ import print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/test/MSVC/mssdk.py b/test/MSVC/mssdk.py index ba45346..8d1bb5c 100644 --- a/test/MSVC/mssdk.py +++ b/test/MSVC/mssdk.py @@ -20,15 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Simple test to make sure mssdk works. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import time import TestSCons diff --git a/test/MSVC/msvc.py b/test/MSVC/msvc.py index 838922c..b92cf3a 100644 --- a/test/MSVC/msvc.py +++ b/test/MSVC/msvc.py @@ -20,16 +20,14 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify basic invocation of Microsoft Visual C/C++, including use of a precompiled header with the $CCFLAGS variable. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import time import TestSCons diff --git a/test/QT/Tool.py b/test/QT/Tool.py index 9e4a277..f684e91 100644 --- a/test/QT/Tool.py +++ b/test/QT/Tool.py @@ -20,11 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that applying env.Tool('qt') after running Configure checks @@ -36,6 +31,8 @@ not completely minimal, but we're leaving it as-is since it represents a good real-world sanity check on the interaction of some key subsystems. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import TestSCons diff --git a/test/QT/copied-env.py b/test/QT/copied-env.py index 3989143..be9f599 100644 --- a/test/QT/copied-env.py +++ b/test/QT/copied-env.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test Qt with a copied construction environment. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons test = TestSCons.TestSCons() diff --git a/test/QT/qt_warnings.py b/test/QT/qt_warnings.py index 020333e..2aa7940 100644 --- a/test/QT/qt_warnings.py +++ b/test/QT/qt_warnings.py @@ -20,15 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test the Qt tool warnings. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import re diff --git a/test/SCONS_LIB_DIR.py b/test/SCONS_LIB_DIR.py index 65ec3de..5691f61 100644 --- a/test/SCONS_LIB_DIR.py +++ b/test/SCONS_LIB_DIR.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -31,8 +30,6 @@ test = TestSCons.TestSCons() test.subdir('SCons') test.write(['SCons','Script.py'], """ -from __future__ import print_function - def main (): print("SCons.Script") """) diff --git a/test/SWIG/build-dir.py b/test/SWIG/build-dir.py index f70e6e1..372b052 100644 --- a/test/SWIG/build-dir.py +++ b/test/SWIG/build-dir.py @@ -21,14 +21,14 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - """ Make sure SWIG works when a VariantDir (or variant_dir) is used. Test case courtesy Joe Maruszewski. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import sys import TestSCons @@ -143,8 +143,6 @@ public: ## XXX: @ptomulik: looks like it was unused? ## test.write(['source', 'test.py'], """\ ## #!%(_python_)s -## from __future__ import print_function -## ## import linalg ## ## diff --git a/test/SWIG/live.py b/test/SWIG/live.py index e01597d..e7b2602 100644 --- a/test/SWIG/live.py +++ b/test/SWIG/live.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test SWIG behavior with a live, installed SWIG. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import sys @@ -134,7 +133,6 @@ test.run(arguments = ldmodule_prefix+'foo' + _dll) test.must_not_exist(test.workpath('wrapper.out')) test.run(program = python, stdin = """\ -from __future__ import print_function import foo print(foo.foo_string()) """, stdout="""\ @@ -148,7 +146,6 @@ test.run(arguments = ldmodule_prefix+'bar' + _dll) test.must_match('wrapper.out', "wrapper.py\n") test.run(program = python, stdin = """\ -from __future__ import print_function import foo import bar print(foo.foo_string()) diff --git a/test/TEMPFILEPREFIX.py b/test/TEMPFILEPREFIX.py index f5093e1..4ccfd7d 100644 --- a/test/TEMPFILEPREFIX.py +++ b/test/TEMPFILEPREFIX.py @@ -20,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that setting the $TEMPFILEPREFIX variable will cause @@ -30,6 +27,8 @@ it to appear at the front of name of the generated tempfile used for long command lines. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import stat @@ -38,7 +37,6 @@ import TestSCons test = TestSCons.TestSCons(match = TestSCons.match_re) test.write('echo.py', """\ -from __future__ import print_function import sys print(sys.argv) """) diff --git a/test/TEMPFILESUFFIX.py b/test/TEMPFILESUFFIX.py index aee1e2d..df546ac 100644 --- a/test/TEMPFILESUFFIX.py +++ b/test/TEMPFILESUFFIX.py @@ -20,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that setting the $TEMPFILESUFFIX variable will cause @@ -30,6 +27,8 @@ it to appear at the end of name of the generated tempfile used for long command lines. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import stat @@ -38,7 +37,6 @@ import TestSCons test = TestSCons.TestSCons(match=TestSCons.match_re) test.write('echo.py', """\ -from __future__ import print_function import sys print(sys.argv) """) diff --git a/test/TEX/TEX.py b/test/TEX/TEX.py index f0d4043..4c4bd87 100644 --- a/test/TEX/TEX.py +++ b/test/TEX/TEX.py @@ -20,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" r""" Validate that we can set the TEX string to our own utility, that @@ -30,6 +27,8 @@ 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. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons _python_ = TestSCons._python_ diff --git a/test/Value.py b/test/Value.py index 8f6c7fe..eb04eb0 100644 --- a/test/Value.py +++ b/test/Value.py @@ -20,8 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/test/VariantDir/reflect.py b/test/VariantDir/reflect.py index 72f3af7..56b0c18 100644 --- a/test/VariantDir/reflect.py +++ b/test/VariantDir/reflect.py @@ -20,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ This test validates the correct operation of a VariantDir specification @@ -33,6 +30,8 @@ in the variant_dir as sources for that same build dir. Test based on bug #1055521 filed by Gary Oberbrunner. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os.path import re @@ -44,14 +43,11 @@ _python_ = TestSCons._python_ re_python = re.escape(TestSCons._python_) test.write("mycc.py", """ -from __future__ import print_function print('Compile') """) test.write("mylink.py", """ -from __future__ import print_function - print('Link') """) diff --git a/test/Win32/bad-drive.py b/test/Win32/bad-drive.py index 28d926b..cca5462 100644 --- a/test/Win32/bad-drive.py +++ b/test/Win32/bad-drive.py @@ -20,8 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function """ This test verifies (on Windows systems) that we fail gracefully and diff --git a/test/Win32/default-drive.py b/test/Win32/default-drive.py index 78db4be..7d19c57 100644 --- a/test/Win32/default-drive.py +++ b/test/Win32/default-drive.py @@ -20,8 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function """ This test verifies (on Windows systems) that specifying an diff --git a/test/builderrors.py b/test/builderrors.py index f5cbccf..635f448 100644 --- a/test/builderrors.py +++ b/test/builderrors.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" @@ -169,7 +168,6 @@ test.must_not_contain_any_line(test.stderr(), ['Exception', 'Traceback']) # Should not give traceback; the task error should get converted # to a BuildError. test.write('SConstruct', """ -from __future__ import print_function import atexit env = Environment() diff --git a/test/explain/basic.py b/test/explain/basic.py index 46ce6bc..6d41496 100644 --- a/test/explain/basic.py +++ b/test/explain/basic.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify a lot of the basic operation of the --debug=explain option. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import TestSCons @@ -52,7 +51,6 @@ inc_bbb_k = test.workpath('inc', 'bbb.k') test.write(cat_py, r""" -from __future__ import print_function import sys diff --git a/test/explain/save-info.py b/test/explain/save-info.py index 24ebb88..500bb55 100644 --- a/test/explain/save-info.py +++ b/test/explain/save-info.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that the --debug=explain information gets saved by default. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons _python_ = TestSCons._python_ @@ -42,8 +41,6 @@ inc_ddd = test.workpath('inc', 'ddd') inc_eee = test.workpath('inc', 'eee') test.write(cat_py, r""" -from __future__ import print_function - import sys def process(outfp, infp): diff --git a/test/gnutools.py b/test/gnutools.py index 040de2a..eb0d847 100644 --- a/test/gnutools.py +++ b/test/gnutools.py @@ -20,15 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Testing the gnu tool chain, i.e. the tools 'gcc', 'g++' and 'gnulink'. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import TestSCons import sys diff --git a/test/option--random.py b/test/option--random.py index 2944ad8..c25ec12 100644 --- a/test/option--random.py +++ b/test/option--random.py @@ -20,15 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify that we build correctly using the --random option. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os.path import TestSCons diff --git a/test/option-v.py b/test/option-v.py index ed8c4e5..ec20b20 100644 --- a/test/option-v.py +++ b/test/option-v.py @@ -20,8 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -from __future__ import print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/test/option/debug-action-timestamps.py b/test/option/debug-action-timestamps.py index 059cfdf..747d880 100644 --- a/test/option/debug-action-timestamps.py +++ b/test/option/debug-action-timestamps.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # 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 division, print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/test/option/debug-count.py b/test/option/debug-count.py index 0234bfa..f2fceb4 100644 --- a/test/option/debug-count.py +++ b/test/option/debug-count.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test that the --debug=count option works. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import re import sys diff --git a/test/option/debug-multiple.py b/test/option/debug-multiple.py index 020aa85..124e033 100644 --- a/test/option/debug-multiple.py +++ b/test/option/debug-multiple.py @@ -21,14 +21,12 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - """ Test that --debug can take multiple options """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import re import TestSCons diff --git a/test/option/debug-time.py b/test/option/debug-time.py index 3ed7555..7e95af3 100644 --- a/test/option/debug-time.py +++ b/test/option/debug-time.py @@ -20,7 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # 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 division, print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/test/option/help-options.py b/test/option/help-options.py index 1835a62..2dac532 100644 --- a/test/option/help-options.py +++ b/test/option/help-options.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify behavior of the -H and --help-options options. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import re import TestSCons diff --git a/test/packaging/convenience-functions/image/SConstruct b/test/packaging/convenience-functions/image/SConstruct index f35c3e3..a424fd9 100644 --- a/test/packaging/convenience-functions/image/SConstruct +++ b/test/packaging/convenience-functions/image/SConstruct @@ -1,5 +1,3 @@ -from __future__ import print_function - env = Environment(tools=['default', 'packaging']) prog = env.Install( 'bin/', ["f1", "f2"] ) env.File( "f3" ) diff --git a/test/scons-time/run/config/python.py b/test/scons-time/run/config/python.py index c8842c1..bf873fa 100644 --- a/test/scons-time/run/config/python.py +++ b/test/scons-time/run/config/python.py @@ -20,14 +20,13 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify specifying an alternate Python executable in a config file. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os import TestSCons_time @@ -46,7 +45,6 @@ python = r'%(my_python_py)s' test.write(my_python_py, """\ #!%(_python_)s -from __future__ import print_function import sys profile = '' for arg in sys.argv[1:]: diff --git a/test/scons-time/run/config/scons.py b/test/scons-time/run/config/scons.py index b782e83..168ee7a 100644 --- a/test/scons-time/run/config/scons.py +++ b/test/scons-time/run/config/scons.py @@ -20,14 +20,12 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Verify specifying an alternate SCons through a config file. """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons_time @@ -42,7 +40,6 @@ scons = r'%(my_scons_py)s' """ % locals()) test.write(my_scons_py, """\ -from __future__ import print_function import sys profile = '' for arg in sys.argv[1:]: diff --git a/test/site_scons/sysdirs.py b/test/site_scons/sysdirs.py index 36a581e..61f9c02 100644 --- a/test/site_scons/sysdirs.py +++ b/test/site_scons/sysdirs.py @@ -20,13 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -from __future__ import print_function - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" - -import TestSCons """ Verify site_scons system dirs are getting loaded. @@ -37,6 +30,10 @@ files from the system dirs, but the test harness can't put files in those dirs (which may not even exist on a build system). """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + +import TestSCons + test = TestSCons.TestSCons() test.write('SConstruct', """ diff --git a/test/srcchange.py b/test/srcchange.py index 3c23737..30f6f20 100644 --- a/test/srcchange.py +++ b/test/srcchange.py @@ -20,9 +20,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" """ Test changing the C source files based on an always-executed revision @@ -33,6 +30,8 @@ expected. This relies on the default behavior being the equivalent of Decider('content'). """ +__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" + import os.path import TestSCons @@ -42,7 +41,6 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() test.write('getrevision', r""" -from __future__ import print_function with open('revnum.in', 'r') as f: print(f.read().strip(), end='') """) diff --git a/testing/framework/TestCmd.py b/testing/framework/TestCmd.py index f29449f..ed8b4b4 100644 --- a/testing/framework/TestCmd.py +++ b/testing/framework/TestCmd.py @@ -285,7 +285,6 @@ version. # PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, # AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -from __future__ import division, print_function __author__ = "Steven Knight <knight at baldmt dot com>" __revision__ = "TestCmd.py 1.3.D001 2010/06/03 12:58:27 knight" @@ -492,11 +491,9 @@ def match_caseinsensitive(lines=None, matches=None): """ Match function using case-insensitive matching. - Only a simplistic comparison is done, based on lowercasing the - strings. This has plenty of holes for unicode data using - non-English languages. - - TODO: casefold() is better than lower() if we don't need Py2 support. + Only a simplistic comparison is done, based on casefolding + the strings. This may still fail but is the suggestion of + the Unicode Standard. :param lines: data lines :type lines: str or list[str] @@ -512,7 +509,7 @@ def match_caseinsensitive(lines=None, matches=None): if len(lines) != len(matches): return None for line, match in zip(lines, matches): - if line.lower() != match.lower(): + if line.casefold() != match.casefold(): return None return 1 @@ -700,7 +697,7 @@ if sys.platform == 'win32': if is_String(pathext): pathext = pathext.split(os.pathsep) for ext in pathext: - if ext.lower() == file[-len(ext):].lower(): + if ext.casefold() == file[-len(ext):].casefold(): pathext = [''] break for dir in path: @@ -1504,13 +1501,13 @@ class TestCmd(object): @staticmethod def fix_binary_stream(stream): """ - Handle stdout/stderr from popen when we specify universal_newlines = False. + Handle stdout/stderr from popen when we specify not universal_newlines - This will read from the pipes in binary mode, not decode the output, - and not convert line endings to \n. + This will read from the pipes in binary mode, will not decode the + output, and will not convert line endings to \n. We do this because in py3 (3.5) with universal_newlines=True, it will choose the default system locale to decode the output, and this breaks unicode - output. Specifically breaking test/option--tree.py which outputs a unicode char. + output. Specifically test/option--tree.py which outputs a unicode char. py 3.6 allows us to pass an encoding param to popen thus not requiring the decode nor end of line handling, because we propagate universal_newlines as specified. @@ -1968,13 +1965,20 @@ class TestCmd(object): do_chmod(top) def write(self, file, content, mode='wb'): - """Writes the specified content text (second argument) to the - specified file name (first argument). The file name may be - a list, in which case the elements are concatenated with the - os.path.join() method. The file is created under the temporary - working directory. Any subdirectories in the path must already - exist. The I/O mode for the file may be specified; it must - begin with a 'w'. The default is 'wb' (binary write). + """Write data to file + + The file is created under the temporary working directory. + Any subdirectories in the path must already exist. The + write is converted to the required type rather than failing + if there is a str/bytes mistmatch. + + :param file: name of file to write to. If a list, treated + as components of a path and concatenated into a path. + :type file: str or list(str) + :param content: data to write. + :type content: str or bytes + :param mode: file mode, default is binary. + :type mode: str """ file = self.canonicalize(file) if mode[0] != 'w': @@ -1983,7 +1987,6 @@ class TestCmd(object): try: f.write(content) except TypeError as e: - # python 3 default strings are not bytes, but unicode f.write(bytes(content, 'utf-8')) # Local Variables: diff --git a/testing/framework/TestCmdTests.py b/testing/framework/TestCmdTests.py index 48eba1e..e8c2744 100644 --- a/testing/framework/TestCmdTests.py +++ b/testing/framework/TestCmdTests.py @@ -254,7 +254,7 @@ class cleanup_TestCase(TestCmdTestCase): def test_atexit(self): """Test cleanup() when atexit is used""" - self.popen_python("""from __future__ import print_function + self.popen_python("""\ import sys sys.path = ['%s'] + sys.path import atexit @@ -269,7 +269,7 @@ sys.exit(0) @unittest.skipIf(TestCmd.IS_PY3, "No sys.exitfunc in Python 3") def test_exitfunc(self): """Test cleanup() when sys.exitfunc is set""" - self.popen_python("""from __future__ import print_function + self.popen_python("""\ import sys sys.path = ['%s'] + sys.path def my_exitfunc(): @@ -609,7 +609,7 @@ sys.exit(0) def test_diff_stderr_not_affecting_diff_stdout(self): """Test diff_stderr() not affecting diff_stdout() behavior""" - self.popen_python(r"""from __future__ import print_function + self.popen_python(r""" import sys sys.path = ['%s'] + sys.path import TestCmd @@ -716,7 +716,7 @@ sys.exit(0) def test_diff_stdout_not_affecting_diff_stderr(self): """Test diff_stdout() not affecting diff_stderr() behavior""" - self.popen_python(r"""from __future__ import print_function + self.popen_python(r""" import sys sys.path = ['%s'] + sys.path import TestCmd @@ -2089,7 +2089,7 @@ sys.exit(0) def test_set_diff_function_stdout(self): """Test set_diff_function(): stdout""" - self.popen_python("""from __future__ import print_function + self.popen_python("""\ import sys sys.path = ['%s'] + sys.path import TestCmd @@ -2118,7 +2118,7 @@ diff_stdout: def test_set_diff_function_stderr(self): """Test set_diff_function(): stderr """ - self.popen_python("""from __future__ import print_function + self.popen_python("""\ import sys sys.path = ['%s'] + sys.path import TestCmd @@ -2693,7 +2693,7 @@ class stdin_TestCase(TestCmdTestCase): def test_stdin(self): """Test stdin()""" run_env = TestCmd.TestCmd(workdir = '') - run_env.write('run', """from __future__ import print_function + run_env.write('run', """\ import fileinput for line in fileinput.input(): print('Y'.join(line[:-1].split('X'))) @@ -3332,15 +3332,13 @@ class variables_TestCase(TestCmdTestCase): 'TestCmd', ] - script = "from __future__ import print_function\n" + \ - "import TestCmd\n" + \ + script = "import TestCmd\n" + \ '\n'.join([ "print(TestCmd.%s\n)" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() assert stderr == "", stderr - script = "from __future__ import print_function\n" + \ - "from TestCmd import *\n" + \ + script = "from TestCmd import *\n" + \ '\n'.join([ "print(%s)" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() diff --git a/testing/framework/TestCommon.py b/testing/framework/TestCommon.py index 8e6cc8e..1bd9f6b 100644 --- a/testing/framework/TestCommon.py +++ b/testing/framework/TestCommon.py @@ -93,8 +93,6 @@ The TestCommon module also provides the following variables # AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -from __future__ import print_function - __author__ = "Steven Knight <knight at baldmt dot com>" __revision__ = "TestCommon.py 1.3.D001 2010/06/03 12:58:27 knight" __version__ = "1.3" diff --git a/testing/framework/TestCommonTests.py b/testing/framework/TestCommonTests.py index 6377737..01e9fe1 100644 --- a/testing/framework/TestCommonTests.py +++ b/testing/framework/TestCommonTests.py @@ -167,7 +167,6 @@ class __init__TestCase(TestCommonTestCase): os.chdir(run_env.workdir) script = lstrip("""\ - from __future__ import print_function from TestCommon import TestCommon tc = TestCommon(workdir='') import os @@ -2340,15 +2339,13 @@ class variables_TestCase(TestCommonTestCase): 'dll_suffix', ] - script = "from __future__ import print_function\n" + \ - "import TestCommon\n" + \ + script = "import TestCommon\n" + \ '\n'.join([ "print(TestCommon.%s)\n" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() assert stderr == "", stderr - script = "from __future__ import print_function\n" + \ - "from TestCommon import *\n" + \ + script = "from TestCommon import *\n" + \ '\n'.join([ "print(%s)" % v for v in variables ]) run_env.run(program=sys.executable, stdin=script) stderr = run_env.stderr() diff --git a/testing/framework/TestSCons.py b/testing/framework/TestSCons.py index 2f20950..8800c1b 100644 --- a/testing/framework/TestSCons.py +++ b/testing/framework/TestSCons.py @@ -13,7 +13,6 @@ attributes defined in this subclass. """ # __COPYRIGHT__ -from __future__ import division, print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" diff --git a/testing/framework/TestSCons_time.py b/testing/framework/TestSCons_time.py index f27e0e3..6f46e26 100644 --- a/testing/framework/TestSCons_time.py +++ b/testing/framework/TestSCons_time.py @@ -27,7 +27,6 @@ from TestSCons import search_re, search_re_in_list __all__.extend(['TestSCons_time',]) SConstruct = """\ -from __future__ import print_function import os print("SConstruct file directory:", os.getcwd()) """ diff --git a/testing/framework/TestSConsign.py b/testing/framework/TestSConsign.py index a48b648..665059c 100644 --- a/testing/framework/TestSConsign.py +++ b/testing/framework/TestSConsign.py @@ -1,5 +1,4 @@ # __COPYRIGHT__ -from __future__ import print_function __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" |