diff options
124 files changed, 855 insertions, 1375 deletions
diff --git a/QMTest/TestSConsMSVS.py b/QMTest/TestSConsMSVS.py index 39dbb5e..fcca470 100644 --- a/QMTest/TestSConsMSVS.py +++ b/QMTest/TestSConsMSVS.py @@ -20,6 +20,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import sys import platform +import traceback +from xml.etree import ElementTree from TestSCons import * from TestSCons import __all__ @@ -1156,6 +1158,18 @@ print("self._msvs_versions =", str(SCons.Tool.MSCommon.query_versions())) return host + def validate_msvs_file(self, file): + try: + x = ElementTree.parse(file) + except: + print("--------------------------------------------------------------") + print("--------------------------------------------------------------") + print(traceback.format_exc()) + print("Failed to validate xml in MSVS file: ") + print(file) + print("--------------------------------------------------------------") + print("--------------------------------------------------------------") + self.fail_test() # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/ReleaseConfig b/ReleaseConfig index 7a68f89..517b5db 100644 --- a/ReleaseConfig +++ b/ReleaseConfig @@ -32,7 +32,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" # 'final', the patchlevel is set to the release date. This value is # mandatory and must be present in this file. #version_tuple = (2, 2, 0, 'final', 0) -version_tuple = (2, 6, 0, 'alpha', 0) +version_tuple = (2, 7, 0, 'alpha', 0) # Python versions prior to unsupported_python_version cause a fatal error # when that version is used. Python versions prior to deprecate_python_version @@ -8,7 +8,7 @@ from __future__ import print_function copyright_years = '2001 - 2016' # This gets inserted into the man pages to reflect the month of release. -month_year = 'April 2016' +month_year = 'November 2016' # # __COPYRIGHT__ @@ -45,7 +45,7 @@ import tempfile import bootstrap project = 'scons' -default_version = '2.5.0' +default_version = '2.5.1' copyright = "Copyright (c) %s The SCons Foundation" % copyright_years platform = distutils.util.get_platform() @@ -646,6 +646,7 @@ scons_script = { 'scons' : 'scons.py', 'sconsign' : 'sconsign.py', 'scons-time' : 'scons-time.py', + 'scons-configure-cache' : 'scons-configure-cache.py', }, 'buildermap' : {}, @@ -654,6 +655,7 @@ scons_script = { 'scons-' + version, 'sconsign-' + version, 'scons-time-' + version, + 'scons-configure-cache-' + version, ], 'explicit_deps' : { @@ -710,7 +712,7 @@ scons = { }, } -scripts = ['scons', 'sconsign', 'scons-time'] +scripts = ['scons', 'sconsign', 'scons-time', 'scons-configure-cache'] src_deps = [] src_files = [] diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 4ae9cb2..4a7576e 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -6,6 +6,30 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER + From John Doe: + + - Whatever John Doe did. + + +RELEASE VERSION/DATE TO BE FILLED IN LATER + + From William Blevins: + - Updated D language scanner support to latest: 2.071.1. (PR #1924) + https://dlang.org/spec/module.html accessed 11 August 2016 + - Enhancements: + - Added support for selective imports: "import A : B, C;" -> A + - Added support for renamed imports. "import B = A;" -> A + - Supports valid combinations: "import A, B, CCC = C, DDD = D : EEE = FFF;" -> A, B, C, D + - Notes: + - May find new (previously missed) Dlang dependencies. + - May cause rebuild after upgrade due to dependency changes. + - Updated Fortran-related tests to pass under GCC 5/6. + - Fixed SCons.Tool.Packaging.rpm.package source nondeterminism across builds. + + From Daniel Moody: + - Fixed msvs.py for Visual Studio generated projects which were + creating invalid xml for greater than and less than symbols. + From Daniel Holth: - Add basic support for PyPy (by deleting __slots__ from Node with a metaclass on PyPy); wrap most-used open() calls in 'with' statements to @@ -31,20 +55,22 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Added LoadableModule to the list of global functions (DefaultEnvironment builders). + From Rick Lupton: + - Update LaTeX scanner to understand \import and related commands + + From Richard Viney: + - Fixed PCHPDBFLAGS causing a deprecation warning on MSVC v8 and later when + using PCHs and PDBs together. - From William Blevins: - - Updated D language scanner support to latest: 2.071.1. (PR #1924) - https://dlang.org/spec/module.html accessed 11 August 2016 - - Enhancements: - - Added support for selective imports: "import A : B, C;" -> A - - Added support for renamed imports. "import B = A;" -> A - - Supports valid combinations: "import A, B, CCC = C, DDD = D : EEE = FFF;" -> A, B, C, D - - Notes: - - May find new (previously missed) Dlang dependencies. - - May cause rebuild after upgrade due to dependency changes. - - Updated Fortran-related tests to pass under GCC 5/6. - - Fixed SCons.Tool.Packaging.rpm.package source nondeterminism across builds. +RELEASE 2.5.1 - Mon, 03 Nov 2016 13:37:42 -0400 + + From William Deegan: + - Add scons-configure-cache.py to packaging. It was omitted + + From Alexey Klimkin: + - Use memoization to optimize PATH evaluation across all dependencies per + node. (PR #345) RELEASE 2.5.0 - Mon, 09 Apr 2016 11:27:42 -0700 diff --git a/src/RELEASE.txt b/src/RELEASE.txt index ac2b95a..d71619d 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -1,4 +1,4 @@ - A new SCons checkpoint release, 2.6.0.alpha.yyyymmdd, is now available + A new SCons checkpoint release, 2.7.0.alpha.yyyymmdd, is now available on the SCons download page: http://www.scons.org/download.php diff --git a/src/engine/SCons/ExecutorTests.py b/src/engine/SCons/ExecutorTests.py index 99c6226..dbfb7d1 100644 --- a/src/engine/SCons/ExecutorTests.py +++ b/src/engine/SCons/ExecutorTests.py @@ -53,7 +53,11 @@ class MyAction(object): def genstring(self, target, source, env): return ' '.join(['GENSTRING'] + list(map(str, self.actions)) + target + source) def get_contents(self, target, source, env): - return ' '.join(self.actions + target + source) + return b' '.join( + [SCons.Util.to_bytes(aa) for aa in self.actions] + + [SCons.Util.to_bytes(tt) for tt in target] + + [SCons.Util.to_bytes(ss) for ss in source] + ) def get_implicit_deps(self, target, source, env): return [] @@ -381,14 +385,14 @@ class ExecutorTestCase(unittest.TestCase): x = SCons.Executor.Executor(MyAction(), env, [], ['t'], ['s']) c = x.get_contents() - assert c == 'action1 action2 t s', c + assert c == b'action1 action2 t s', c x = SCons.Executor.Executor(MyAction(actions=['grow']), env, [], ['t'], ['s']) x.add_pre_action(MyAction(['pre'])) x.add_post_action(MyAction(['post'])) c = x.get_contents() - assert c == 'pre t sgrow t spost t s', c + assert c == b'pre t sgrow t spost t s', c def test_get_timestamp(self): """Test fetching the "timestamp" """ diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py index 1e0fea1..cb89cf0 100644 --- a/src/engine/SCons/Scanner/LaTeX.py +++ b/src/engine/SCons/Scanner/LaTeX.py @@ -166,6 +166,9 @@ class LaTeX(SCons.Scanner.Base): 'usepackage': 'TEXINPUTS', 'lstinputlisting': 'TEXINPUTS'} env_variables = SCons.Util.unique(list(keyword_paths.values())) + two_arg_commands = ['import', 'subimport', + 'includefrom', 'subincludefrom', + 'inputfrom', 'subinputfrom'] def __init__(self, name, suffixes, graphics_extensions, *args, **kw): @@ -175,8 +178,29 @@ class LaTeX(SCons.Scanner.Base): # line followed by one or more newline characters (i.e. blank # lines), interfering with a match on the next line. # add option for whitespace before the '[options]' or the '{filename}' - regex = r'^[^%\n]*\\(include|includegraphics(?:\s*\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|addbibresource|addglobalbib|addsectionbib|usepackage)\s*{([^}]*)}' - self.cre = re.compile(regex, re.M) + regex = r''' + ^[^%\n]* + \\( + include + | includegraphics(?:\s*\[[^\]]+\])? + | lstinputlisting(?:\[[^\]]+\])? + | input + | import + | subimport + | includefrom + | subincludefrom + | inputfrom + | subinputfrom + | bibliography + | addbibresource + | addglobalbib + | addsectionbib + | usepackage + ) + \s*{([^}]*)} # first arg + (?: \s*{([^}]*)} )? # maybe another arg + ''' + self.cre = re.compile(regex, re.M | re.X) self.comment_re = re.compile(r'^((?:(?:\\%)|[^%\n])*)(.*)$', re.M) self.graphics_extensions = graphics_extensions @@ -236,23 +260,26 @@ class LaTeX(SCons.Scanner.Base): SCons.Scanner.Base.__init__(self, *args, **kw) - def _latex_names(self, include): - filename = include[1] - if include[0] == 'input': + def _latex_names(self, include_type, filename): + if include_type == 'input': base, ext = os.path.splitext( filename ) if ext == "": return [filename + '.tex'] - if (include[0] == 'include'): - return [filename + '.tex'] - if include[0] == 'bibliography': + if include_type in ('include', 'import', 'subimport', + 'includefrom', 'subincludefrom', + 'inputfrom', 'subinputfrom'): + base, ext = os.path.splitext( filename ) + if ext == "": + return [filename + '.tex'] + if include_type == 'bibliography': base, ext = os.path.splitext( filename ) if ext == "": return [filename + '.bib'] - if include[0] == 'usepackage': + if include_type == 'usepackage': base, ext = os.path.splitext( filename ) if ext == "": return [filename + '.sty'] - if include[0] == 'includegraphics': + if include_type == 'includegraphics': base, ext = os.path.splitext( filename ) if ext == "": #return [filename+e for e in self.graphics_extensions + TexGraphics] @@ -267,21 +294,26 @@ class LaTeX(SCons.Scanner.Base): return SCons.Node.FS._my_normcase(str(include)) def find_include(self, include, source_dir, path): + inc_type, inc_subdir, inc_filename = include try: - sub_path = path[include[0]] + sub_paths = path[inc_type] except (IndexError, KeyError): - sub_path = () - try_names = self._latex_names(include) + sub_paths = ((), ()) + try_names = self._latex_names(inc_type, inc_filename) + + # There are three search paths to try: + # 1. current directory "source_dir" + # 2. env[var] + # 3. env['ENV'][var] + search_paths = [(source_dir,)] + list(sub_paths) + for n in try_names: - # see if we find it using the path in env[var] - i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[0]) - if i: - return i, include - # see if we find it using the path in env['ENV'][var] - i = SCons.Node.FS.find_file(n, (source_dir,) + sub_path[1]) - if i: - return i, include - return i, include + for search_path in search_paths: + paths = tuple([d.Dir(inc_subdir) for d in search_path]) + i = SCons.Node.FS.find_file(n, paths) + if i: + return i, include + return None, include def canonical_text(self, text): """Standardize an input TeX-file contents. @@ -300,7 +332,7 @@ class LaTeX(SCons.Scanner.Base): line_continues_a_comment = len(comment) > 0 return '\n'.join(out).rstrip()+'\n' - def scan(self, node): + def scan(self, node, subdir='.'): # Modify the default scan function to allow for the regular # expression to return a comma separated list of file names # as can be the case with the bibliography keyword. @@ -326,9 +358,14 @@ class LaTeX(SCons.Scanner.Base): split_includes = [] for include in includes: inc_type = noopt_cre.sub('', include[0]) - inc_list = include[1].split(',') + inc_subdir = subdir + if inc_type in self.two_arg_commands: + inc_subdir = os.path.join(subdir, include[1]) + inc_list = include[2].split(',') + else: + inc_list = include[1].split(',') for j in range(len(inc_list)): - split_includes.append( (inc_type, inc_list[j]) ) + split_includes.append( (inc_type, inc_subdir, inc_list[j]) ) # includes = split_includes node.includes = includes @@ -359,11 +396,12 @@ class LaTeX(SCons.Scanner.Base): while queue: include = queue.pop() + inc_type, inc_subdir, inc_filename = include try: - if seen[include[1]] == 1: + if seen[inc_filename] == 1: continue except KeyError: - seen[include[1]] = 1 + seen[inc_filename] = 1 # # Handle multiple filenames in include[1] @@ -372,14 +410,14 @@ class LaTeX(SCons.Scanner.Base): if n is None: # Do not bother with 'usepackage' warnings, as they most # likely refer to system-level files - if include[0] != 'usepackage': + if inc_type != 'usepackage': SCons.Warnings.warn(SCons.Warnings.DependencyWarning, "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node)) else: sortkey = self.sort_key(n) nodes.append((sortkey, n)) - # recurse down - queue.extend( self.scan(n) ) + # recurse down + queue.extend( self.scan(n, inc_subdir) ) return [pair[1] for pair in sorted(nodes)] diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py index 49553cf..213e89e 100644 --- a/src/engine/SCons/Scanner/LaTeXTests.py +++ b/src/engine/SCons/Scanner/LaTeXTests.py @@ -44,6 +44,12 @@ test.write('test1.latex',""" include{incNO} %\include{incNO} xyzzy \include{inc6} +\subimport{subdir}{inc3} +\import{subdir}{inc3a} +\includefrom{subdir}{inc3b} +\subincludefrom{subdir}{inc3c} +\inputfrom{subdir}{inc3d} +\subinputfrom{subdir}{inc3e} """) test.write('test2.latex',""" @@ -61,6 +67,10 @@ test.subdir('subdir') test.write('inc1.tex',"\n") test.write('inc2.tex',"\n") test.write(['subdir', 'inc3.tex'], "\n") +for suffix in 'abcde': + test.write(['subdir', 'inc3%s.tex' % suffix], "\n") +test.write(['subdir', 'inc3b.tex'], "\n") +test.write(['subdir', 'inc3c.tex'], "\n") test.write(['subdir', 'inc4.eps'], "\n") test.write('inc5.xyz', "\n") test.write('inc6.tex', "\n") @@ -122,7 +132,10 @@ class LaTeXScannerTestCase1(unittest.TestCase): s = SCons.Scanner.LaTeX.LaTeXScanner() path = s.path(env) deps = s(env.File('test1.latex'), env, path) - headers = ['inc1.tex', 'inc2.tex', 'inc6.tex'] + headers = ['inc1.tex', 'inc2.tex', 'inc6.tex', + 'subdir/inc3.tex', 'subdir/inc3a.tex', + 'subdir/inc3b.tex', 'subdir/inc3c.tex', + 'subdir/inc3d.tex', 'subdir/inc3e.tex'] deps_match(self, deps, headers) class LaTeXScannerTestCase2(unittest.TestCase): diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py index 5700fe9..28be642 100644 --- a/src/engine/SCons/Scanner/__init__.py +++ b/src/engine/SCons/Scanner/__init__.py @@ -324,7 +324,7 @@ class Classic(Current): def __init__(self, name, suffixes, path_variable, regex, *args, **kw): - self.cre = re.compile(SCons.Util.to_bytes(regex), re.M) + self.cre = re.compile(regex, re.M) def _scan(node, env, path=(), self=self): node = node.rfile() @@ -405,7 +405,7 @@ class ClassicCPP(Classic): return n, i def sort_key(self, include): - return SCons.Node.FS._my_normcase(b' '.join(include)) + return SCons.Node.FS._my_normcase(' '.join(include)) # Local Variables: # tab-width:4 diff --git a/src/engine/SCons/Taskmaster.py b/src/engine/SCons/Taskmaster.py index 461a556..a620ba1 100644 --- a/src/engine/SCons/Taskmaster.py +++ b/src/engine/SCons/Taskmaster.py @@ -545,7 +545,7 @@ class Task(object): if sys.version_info[0] == 2: exec("raise exc_type, exc_value, exc_traceback") else: # sys.version_info[0] == 3: - exec("raise exc_type(exc_value).with_traceback(exc_traceback)") + exec("raise exc_type(*exc_value.args).with_traceback(exc_traceback)") # raise e.__class__, e.__class__(e), sys.exc_info()[2] diff --git a/src/engine/SCons/Tool/MSCommon/__init__.py b/src/engine/SCons/Tool/MSCommon/__init__.py index fe4a7c6..c87bf71 100644 --- a/src/engine/SCons/Tool/MSCommon/__init__.py +++ b/src/engine/SCons/Tool/MSCommon/__init__.py @@ -41,7 +41,8 @@ from SCons.Tool.MSCommon.sdk import mssdk_exists, \ from SCons.Tool.MSCommon.vc import msvc_exists, \ msvc_setup_env, \ - msvc_setup_env_once + msvc_setup_env_once, \ + msvc_version_to_maj_min from SCons.Tool.MSCommon.vs import get_default_version, \ get_vs_by_version, \ diff --git a/src/engine/SCons/Tool/MSCommon/vc.py b/src/engine/SCons/Tool/MSCommon/vc.py index baa4025..588fe98 100644 --- a/src/engine/SCons/Tool/MSCommon/vc.py +++ b/src/engine/SCons/Tool/MSCommon/vc.py @@ -185,16 +185,17 @@ _VCVER_TO_PRODUCT_DIR = { } def msvc_version_to_maj_min(msvc_version): - msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.']) + + msvc_version_numeric = ''.join([x for x in msvc_version if x in string_digits + '.']) - t = msvc_version_numeric.split(".") - if not len(t) == 2: + t = msvc_version_numeric.split(".") + if not len(t) == 2: raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) - try: + try: maj = int(t[0]) min = int(t[1]) return maj, min - except ValueError as e: + except ValueError as e: raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) def is_host_target_supported(host_target, msvc_version): diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index f894562..20b5d28 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -47,7 +47,7 @@ import SCons.Util import SCons.Warnings import SCons.Scanner.RC -from .MSCommon import msvc_exists, msvc_setup_env_once +from .MSCommon import msvc_exists, msvc_setup_env_once, msvc_version_to_maj_min CSuffixes = ['.c', '.C'] CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] @@ -259,7 +259,17 @@ def generate(env): env['CFILESUFFIX'] = '.c' env['CXXFILESUFFIX'] = '.cc' - env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) + if env.get('MSVC_VERSION',False): + maj, min = msvc_version_to_maj_min(env['MSVC_VERSION']) + if maj < 8: + env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) + else: + env['PCHPDBFLAGS'] = '' + else: + # Default if we can't determine which version of MSVC we're using + env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}']) + + env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS' env['BUILDERS']['PCH'] = pch_builder diff --git a/src/engine/SCons/Tool/msvs.py b/src/engine/SCons/Tool/msvs.py index 50f6b27..939668e 100644 --- a/src/engine/SCons/Tool/msvs.py +++ b/src/engine/SCons/Tool/msvs.py @@ -65,6 +65,8 @@ def xmlify(s): s = s.replace("&", "&") # do this first s = s.replace("'", "'") s = s.replace('"', """) + s = s.replace('<', "<") + s = s.replace('>', ">") s = s.replace('\n', '
') return s diff --git a/src/script/MANIFEST.in b/src/script/MANIFEST.in index f324ed4..d10cc82 100644 --- a/src/script/MANIFEST.in +++ b/src/script/MANIFEST.in @@ -1,3 +1,4 @@ scons sconsign scons-time +scons-configure-cache diff --git a/src/setup.py b/src/setup.py index 9a02b25..41fc35a 100644 --- a/src/setup.py +++ b/src/setup.py @@ -388,6 +388,7 @@ scripts = [ 'script/scons', 'script/sconsign', 'script/scons-time', + 'script/scons-configure-cache', # We include scons.bat in the list of scripts, even on UNIX systems, # because we provide an option to allow it be installed explicitly, diff --git a/test/AR/ARCOM.py b/test/AR/ARCOM.py index bf2830e..f9d0038 100644 --- a/test/AR/ARCOM.py +++ b/test/AR/ARCOM.py @@ -34,39 +34,25 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) """ % locals()) -test.write('file.1', "file.1\n/*ar*/\n") -test.write('file.2', "file.2\n/*ar*/\n") +test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") +test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") test.run(arguments = '.') test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/AR/ARCOMSTR.py b/test/AR/ARCOMSTR.py index 1b1a9fb..3235f12 100644 --- a/test/AR/ARCOMSTR.py +++ b/test/AR/ARCOMSTR.py @@ -35,33 +35,21 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', ARCOMSTR = 'Archiving $TARGET from $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) """ % locals()) -test.write('file.1', "file.1\n/*ar*/\n") -test.write('file.2', "file.2\n/*ar*/\n") +test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") +test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") test.run() @@ -69,8 +57,6 @@ expect = 'Archiving output.lib from file.1 file.2' test.must_contain_all_lines(test.stdout(), [expect]) test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASCOM.py b/test/AS/ASCOM.py index 8f91404..ab77586 100644 --- a/test/AS/ASCOM.py +++ b/test/AS/ASCOM.py @@ -36,16 +36,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myas.py', r""" -import sys -infile = open(sys.argv[2], 'rb') -outfile = open(sys.argv[1], 'wb') -for l in [l for l in infile.readlines() if l != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if os.path.normcase('.s') == os.path.normcase('.S'): alt_s_suffix = '.S' @@ -55,7 +46,7 @@ else: alt_asm_suffix = '.asm' test.write('SConstruct', """ -env = Environment(ASCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', OBJSUFFIX = '.obj', SHOBJPREFIX = '', SHOBJSUFFIX = '.shobj') @@ -69,14 +60,14 @@ env.SharedObject(target = 'test7', source = 'test7.asm') env.SharedObject(target = 'test8', source = 'test8%(alt_asm_suffix)s') """ % locals()) -test.write('test1.s', "test1.s\n#as\n") -test.write('test2'+alt_s_suffix, "test2.S\n#as\n") -test.write('test3.asm', "test3.asm\n#as\n") -test.write('test4'+alt_asm_suffix, "test4.ASM\n#as\n") -test.write('test5.s', "test5.s\n#as\n") -test.write('test6'+alt_s_suffix, "test6.S\n#as\n") -test.write('test7.asm', "test7.asm\n#as\n") -test.write('test8'+alt_asm_suffix, "test8.ASM\n#as\n") +test.write('test1.s', "test1.s\n/*as*/\n") +test.write('test2'+alt_s_suffix, "test2.S\n/*as*/\n") +test.write('test3.asm', "test3.asm\n/*as*/\n") +test.write('test4'+alt_asm_suffix, "test4.ASM\n/*as*/\n") +test.write('test5.s', "test5.s\n/*as*/\n") +test.write('test6'+alt_s_suffix, "test6.S\n/*as*/\n") +test.write('test7.asm', "test7.asm\n/*as*/\n") +test.write('test8'+alt_asm_suffix, "test8.ASM\n/*as*/\n") test.run(arguments = '.') @@ -89,8 +80,6 @@ test.must_match('test6.shobj', "test6.S\n") test.must_match('test7.shobj', "test7.asm\n") test.must_match('test8.shobj', "test8.ASM\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASCOMSTR.py b/test/AS/ASCOMSTR.py index 39b963f..2aab94c 100644 --- a/test/AS/ASCOMSTR.py +++ b/test/AS/ASCOMSTR.py @@ -37,16 +37,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myas.py', r""" -import sys -infile = open(sys.argv[2], 'rb') -outfile = open(sys.argv[1], 'wb') -for l in [l for l in infile.readlines() if l != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if os.path.normcase('.s') == os.path.normcase('.S'): alt_s_suffix = '.S' @@ -56,7 +47,7 @@ else: alt_asm_suffix = '.asm' test.write('SConstruct', """ -env = Environment(ASCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', ASCOMSTR = 'Assembling $TARGET from $SOURCE', OBJSUFFIX = '.obj') env.Object(target = 'test1', source = 'test1.s') @@ -65,10 +56,10 @@ env.Object(target = 'test3', source = 'test3.asm') env.Object(target = 'test4', source = 'test4%(alt_asm_suffix)s') """ % locals()) -test.write('test1.s', "test1.s\n#as\n") -test.write('test2'+alt_s_suffix, "test2.S\n#as\n") -test.write('test3.asm', "test3.asm\n#as\n") -test.write('test4'+alt_asm_suffix, "test4.ASM\n#as\n") +test.write('test1.s', "test1.s\n/*as*/\n") +test.write('test2'+alt_s_suffix, "test2.S\n/*as*/\n") +test.write('test3.asm', "test3.asm\n/*as*/\n") +test.write('test4'+alt_asm_suffix, "test4.ASM\n/*as*/\n") test.run(stdout = test.wrap_stdout("""\ Assembling test1.obj from test1.s @@ -82,8 +73,6 @@ test.must_match('test2.obj', "test2.S\n") test.must_match('test3.obj', "test3.asm\n") test.must_match('test4.obj', "test4.ASM\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASPPCOM.py b/test/AS/ASPPCOM.py index 62f859a..ce938bb 100644 --- a/test/AS/ASPPCOM.py +++ b/test/AS/ASPPCOM.py @@ -34,19 +34,10 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myas.py', r""" -import sys -infile = open(sys.argv[2], 'rb') -outfile = open(sys.argv[1], 'wb') -for l in [l for l in infile.readlines() if l != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(ASPPCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASPPCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', OBJSUFFIX = '.obj', SHOBJPREFIX = '', SHOBJSUFFIX = '.shobj') @@ -56,10 +47,10 @@ env.SharedObject(target = 'test3', source = 'test3.spp') env.SharedObject(target = 'test4', source = 'test4.SPP') """ % locals()) -test.write('test1.spp', "test1.spp\n#as\n") -test.write('test2.SPP', "test2.SPP\n#as\n") -test.write('test3.spp', "test3.spp\n#as\n") -test.write('test4.SPP', "test4.SPP\n#as\n") +test.write('test1.spp', "test1.spp\n/*as*/\n") +test.write('test2.SPP', "test2.SPP\n/*as*/\n") +test.write('test3.spp', "test3.spp\n/*as*/\n") +test.write('test4.SPP', "test4.SPP\n/*as*/\n") test.run(arguments = '.') @@ -68,8 +59,6 @@ test.must_match('test2.obj', "test2.SPP\n") test.must_match('test3.shobj', "test3.spp\n") test.must_match('test4.shobj', "test4.SPP\n") - - test.pass_test() # Local Variables: diff --git a/test/AS/ASPPCOMSTR.py b/test/AS/ASPPCOMSTR.py index 0497470..0ee18f5 100644 --- a/test/AS/ASPPCOMSTR.py +++ b/test/AS/ASPPCOMSTR.py @@ -35,27 +35,18 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myas.py', r""" -import sys -infile = open(sys.argv[2], 'rb') -outfile = open(sys.argv[1], 'wb') -for l in [l for l in infile.readlines() if l != b"#as\n"]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(ASPPCOM = r'%(_python_)s myas.py $TARGET $SOURCE', +env = Environment(ASPPCOM = r'%(_python_)s mycompile.py as $TARGET $SOURCE', ASPPCOMSTR = 'Assembling $TARGET from $SOURCE', OBJSUFFIX = '.obj') env.Object(target = 'test1', source = 'test1.spp') env.Object(target = 'test2', source = 'test2.SPP') """ % locals()) -test.write('test1.spp', "test1.spp\n#as\n") -test.write('test2.SPP', "test2.SPP\n#as\n") +test.write('test1.spp', "test1.spp\n/*as*/\n") +test.write('test2.SPP', "test2.SPP\n/*as*/\n") test.run(stdout = test.wrap_stdout("""\ Assembling test1.obj from test1.spp @@ -65,8 +56,6 @@ Assembling test2.obj from test2.SPP test.must_match('test1.obj', "test1.spp\n") test.must_match('test2.obj', "test2.SPP\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/CCCOM.py b/test/CC/CCCOM.py index f930ecd..291dad8 100644 --- a/test/CC/CCCOM.py +++ b/test/CC/CCCOM.py @@ -33,11 +33,10 @@ import os import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -45,12 +44,14 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(CCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.c') env.Object(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ @@ -61,8 +62,6 @@ test.run() test.must_match('test1.obj', "test1.c\n") test.must_match('test2.obj', "test2.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/CCCOMSTR.py b/test/CC/CCCOMSTR.py index 0be9971..9977243 100644 --- a/test/CC/CCCOMSTR.py +++ b/test/CC/CCCOMSTR.py @@ -34,11 +34,10 @@ import os import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -46,13 +45,15 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(CCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', CCCOMSTR = 'Building $TARGET from $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.c') env.Object(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ @@ -66,8 +67,6 @@ Building test2.obj from test2%(alt_c_suffix)s test.must_match('test1.obj', "test1.c\n") test.must_match('test2.obj', "test2.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/SHCCCOM.py b/test/CC/SHCCCOM.py index 689b6e7..5326c01 100644 --- a/test/CC/SHCCCOM.py +++ b/test/CC/SHCCCOM.py @@ -36,7 +36,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -44,13 +44,15 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') env.SharedObject(target = 'test1', source = 'test1.c') env.SharedObject(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ @@ -61,8 +63,6 @@ test.run() test.must_match('test1.obj', "test1.c\n") test.must_match('test2.obj', "test2.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CC/SHCCCOMSTR.py b/test/CC/SHCCCOMSTR.py index 0983a67..75f3aad 100644 --- a/test/CC/SHCCCOMSTR.py +++ b/test/CC/SHCCCOMSTR.py @@ -34,11 +34,10 @@ import os import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') +test.file_fixture('mycompile.py') if os.path.normcase('.c') == os.path.normcase('.C'): alt_c_suffix = '.C' @@ -46,7 +45,7 @@ else: alt_c_suffix = '.c' test.write('SConstruct', """ -env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCE', SHCCCOMSTR = 'Building $TARGET from $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') @@ -54,6 +53,8 @@ env.SharedObject(target = 'test1', source = 'test1.c') env.SharedObject(target = 'test2', source = 'test2%(alt_c_suffix)s') """ % locals()) +test.write('test1.c', 'test1.c\n/*cc*/\n') + test.write('test2'+alt_c_suffix, """\ test2.C /*cc*/ diff --git a/test/CC/shared-fixture/.exclude_tests b/test/CC/shared-fixture/.exclude_tests deleted file mode 100644 index 3f2bc0f..0000000 --- a/test/CC/shared-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -mycc.py diff --git a/test/CC/shared-fixture/mycc.py b/test/CC/shared-fixture/mycc.py deleted file mode 100644 index b96c31c..0000000 --- a/test/CC/shared-fixture/mycc.py +++ /dev/null @@ -1,6 +0,0 @@ -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l[:6] != b'/*cc*/']: - outfile.write(l) -sys.exit(0) diff --git a/test/CC/shared-fixture/test1.c b/test/CC/shared-fixture/test1.c deleted file mode 100644 index 9c281d7..0000000 --- a/test/CC/shared-fixture/test1.c +++ /dev/null @@ -1,2 +0,0 @@ -test1.c -/*cc*/ diff --git a/test/CXX/CXXCOM.py b/test/CXX/CXXCOM.py index a3da81a..307ab13 100644 --- a/test/CXX/CXXCOM.py +++ b/test/CXX/CXXCOM.py @@ -31,25 +31,15 @@ Test the ability to configure the $CXXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mycc.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.cpp') env.Object(target = 'test2', source = 'test2.cc') @@ -75,8 +65,6 @@ test.must_match('test4.obj', "test4.c++\n") test.must_match('test5.obj', "test5.C++\n") test.must_match('test6.obj', "test6.C\n") - - test.pass_test() # Local Variables: diff --git a/test/CXX/CXXCOMSTR.py b/test/CXX/CXXCOMSTR.py index 9d54e91..f7494ca 100644 --- a/test/CXX/CXXCOMSTR.py +++ b/test/CXX/CXXCOMSTR.py @@ -32,25 +32,15 @@ the C++ compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mycc.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*c++*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(CXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(CXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', CXXCOMSTR = 'Building $TARGET from $SOURCE', OBJSUFFIX='.obj') env.Object(target = 'test1', source = 'test1.cpp') diff --git a/test/CXX/SHCXXCOM.py b/test/CXX/SHCXXCOM.py index 7f151ed..72e247a 100644 --- a/test/CXX/SHCXXCOM.py +++ b/test/CXX/SHCXXCOM.py @@ -31,25 +31,15 @@ Test the ability to configure the $SHCXXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mycc.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l[:7] != '/*c++*/']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') env.SharedObject(target = 'test1', source = 'test1.cpp') @@ -76,7 +66,6 @@ test.must_match('test4.obj', "test4.c++\n") test.must_match('test5.obj', "test5.C++\n") test.must_match('test6.obj', "test6.C\n") - test.pass_test() # Local Variables: diff --git a/test/CXX/SHCXXCOMSTR.py b/test/CXX/SHCXXCOMSTR.py index 716c9ad..77075e4 100644 --- a/test/CXX/SHCXXCOMSTR.py +++ b/test/CXX/SHCXXCOMSTR.py @@ -32,25 +32,15 @@ the shared object C++ compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mycc.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*c++*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') alt_cpp_suffix=test.get_alt_cpp_suffix() test.write('SConstruct', """ -env = Environment(SHCXXCOM = r'%(_python_)s mycc.py $TARGET $SOURCE', +env = Environment(SHCXXCOM = r'%(_python_)s mycompile.py c++ $TARGET $SOURCE', SHCXXCOMSTR = 'Building shared object $TARGET from $SOURCE', SHOBJPREFIX='', SHOBJSUFFIX='.obj') env.SharedObject(target = 'test1', source = 'test1.cpp') @@ -84,8 +74,6 @@ test.must_match('test4.obj', "test4.c++\n") test.must_match('test5.obj', "test5.C++\n") test.must_match('test6.obj', "test6.C\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPDF/DVIPDFCOM.py b/test/DVIPDF/DVIPDFCOM.py index 362279e..ddc42b6 100644 --- a/test/DVIPDF/DVIPDFCOM.py +++ b/test/DVIPDF/DVIPDFCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypdf.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*pdf*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvipdf'], - DVIPDFCOM = r'%(_python_)s mypdf.py $TARGET $SOURCES') + DVIPDFCOM = r'%(_python_)s mycompile.py pdf $TARGET $SOURCES') env.PDF(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -58,8 +48,6 @@ test.run() test.must_match('aaa.pdf', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPDF/DVIPDFCOMSTR.py b/test/DVIPDF/DVIPDFCOMSTR.py index 0063e84..7cf221c 100644 --- a/test/DVIPDF/DVIPDFCOMSTR.py +++ b/test/DVIPDF/DVIPDFCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypdf.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*pdf*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvipdf'], - DVIPDFCOM = r'%(_python_)s mypdf.py $TARGET $SOURCES', + DVIPDFCOM = r'%(_python_)s mycompile.py pdf $TARGET $SOURCES', DVIPDFCOMSTR = 'DVIPDFing $TARGET from $SOURCE') env.PDF(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -62,8 +52,6 @@ DVIPDFing aaa.pdf from aaa.dvi test.must_match('aaa.pdf', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPS/PSCOM.py b/test/DVIPS/PSCOM.py index fe4832b..1b90736 100644 --- a/test/DVIPS/PSCOM.py +++ b/test/DVIPS/PSCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myps.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*ps*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvips'], - PSCOM = r'%(_python_)s myps.py $TARGET $SOURCES') + PSCOM = r'%(_python_)s mycompile.py ps $TARGET $SOURCES') env.PostScript(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -58,8 +48,6 @@ test.run() test.must_match('aaa.ps', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/DVIPS/PSCOMSTR.py b/test/DVIPS/PSCOMSTR.py index 7c57ded..0d754d2 100644 --- a/test/DVIPS/PSCOMSTR.py +++ b/test/DVIPS/PSCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myps.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*ps*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'dvips'], - PSCOM = r'%(_python_)s myps.py $TARGET $SOURCES', + PSCOM = r'%(_python_)s mycompile.py ps $TARGET $SOURCES', PSCOMSTR = 'PostScripting $TARGET from $SOURCE') env.PostScript(target = 'aaa', source = 'aaa.dvi') """ % locals()) @@ -62,8 +52,6 @@ PostScripting aaa.ps from aaa.dvi test.must_match('aaa.ps', "aaa.dvi\n") - - test.pass_test() # Local Variables: diff --git a/test/Fortran/F03COM.py b/test/Fortran/F03COM.py index dc1523e..4a42d22 100644 --- a/test/Fortran/F03COM.py +++ b/test/Fortran/F03COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F03COM = r'%(_python_)s myfortran.py f03 $TARGET $SOURCES', - F03PPCOM = r'%(_python_)s myfortran.py f03pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F03COM = r'%(_python_)s mycompile.py f03 $TARGET $SOURCES', + F03PPCOM = r'%(_python_)s mycompile.py f03pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,25 +53,25 @@ env.Program(target = 'test13', source = 'test13.f03') env.Program(target = 'test14', source = 'test14.F03') env2 = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F03COM = r'%(_python_)s myfortran.py f03 $TARGET $SOURCES', - F03PPCOM = r'%(_python_)s myfortran.py f03pp $TARGET $SOURCES') + F03COM = r'%(_python_)s mycompile.py f03 $TARGET $SOURCES', + F03PPCOM = r'%(_python_)s mycompile.py f03pp $TARGET $SOURCES') env2.Program(target = 'test21', source = 'test21.f03') env2.Program(target = 'test22', source = 'test22.F03') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test13.f03', "This is a .f03 file.\n#link\n#f03\n") -test.write('test14.F03', "This is a .F03 file.\n#link\n#f03pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test13.f03', "This is a .f03 file.\n#link\n/*f03*/\n") +test.write('test14.F03', "This is a .F03 file.\n#link\n/*f03pp*/\n") -test.write('test21.f03', "This is a .f03 file.\n#link\n#f03\n") -test.write('test22.F03', "This is a .F03 file.\n#link\n#f03pp\n") +test.write('test21.f03', "This is a .f03 file.\n#link\n/*f03*/\n") +test.write('test22.F03', "This is a .F03 file.\n#link\n/*f03pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F03COMSTR.py b/test/Fortran/F03COMSTR.py index 327c1cd..a3f4e38 100644 --- a/test/Fortran/F03COMSTR.py +++ b/test/Fortran/F03COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f03pp = 'f03' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F03COM = r'%(_python_)s myfc.py f03 $TARGET $SOURCES', +env = Environment(F03COM = r'%(_python_)s mycompile.py f03 $TARGET $SOURCES', F03COMSTR = 'Building f03 $TARGET from $SOURCES', - F03PPCOM = r'%(_python_)s myfc.py f03pp $TARGET $SOURCES', + F03PPCOM = r'%(_python_)s mycompile.py f03pp $TARGET $SOURCES', F03PPCOMSTR = 'Building f03pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f03') env.Object(source = 'test02.F03') """ % locals()) -test.write('test01.f03', "A .f03 file.\n#f03\n") -test.write('test02.F03', "A .F03 file.\n#%s\n" % f03pp) +test.write('test01.f03', "A .f03 file.\n/*f03*/\n") +test.write('test02.F03', "A .F03 file.\n/*%s*/\n" % f03pp) test.run(stdout = test.wrap_stdout("""\ Building f03 test01.obj from test01.f03 diff --git a/test/Fortran/F08COM.py b/test/Fortran/F08COM.py index 363c2d0..ba7d64e 100644 --- a/test/Fortran/F08COM.py +++ b/test/Fortran/F08COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F08COM = r'%(_python_)s myfortran.py f08 $TARGET $SOURCES', - F08PPCOM = r'%(_python_)s myfortran.py f08pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F08COM = r'%(_python_)s mycompile.py f08 $TARGET $SOURCES', + F08PPCOM = r'%(_python_)s mycompile.py f08pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,16 +53,16 @@ env.Program(target = 'test09', source = 'test09.f08') env.Program(target = 'test10', source = 'test10.F08') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test09.f08', "This is a .f08 file.\n#link\n#f08\n") -test.write('test10.F08', "This is a .F08 file.\n#link\n#f08pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test09.f08', "This is a .f08 file.\n#link\n/*f08*/\n") +test.write('test10.F08', "This is a .F08 file.\n#link\n/*f08pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F08COMSTR.py b/test/Fortran/F08COMSTR.py index 65bf32c..ba0b506 100644 --- a/test/Fortran/F08COMSTR.py +++ b/test/Fortran/F08COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f08pp = 'f08' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F08COM = r'%(_python_)s myfc.py f08 $TARGET $SOURCES', +env = Environment(F08COM = r'%(_python_)s mycompile.py f08 $TARGET $SOURCES', F08COMSTR = 'Building f08 $TARGET from $SOURCES', - F08PPCOM = r'%(_python_)s myfc.py f08pp $TARGET $SOURCES', + F08PPCOM = r'%(_python_)s mycompile.py f08pp $TARGET $SOURCES', F08PPCOMSTR = 'Building f08pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f08') env.Object(source = 'test02.F08') """ % locals()) -test.write('test01.f08', "A .f08 file.\n#f08\n") -test.write('test02.F08', "A .F08 file.\n#%s\n" % f08pp) +test.write('test01.f08', "A .f08 file.\n/*f08*/\n") +test.write('test02.F08', "A .F08 file.\n/*%s*/\n" % f08pp) test.run(stdout = test.wrap_stdout("""\ Building f08 test01.obj from test01.f08 diff --git a/test/Fortran/F77COM.py b/test/Fortran/F77COM.py index 4e15eea..e7a3cca 100644 --- a/test/Fortran/F77COM.py +++ b/test/Fortran/F77COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F77COM = r'%(_python_)s myfortran.py f77 $TARGET $SOURCES', - F77PPCOM = r'%(_python_)s myfortran.py f77pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', + F77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,16 +53,16 @@ env.Program(target = 'test09', source = 'test09.f77') env.Program(target = 'test10', source = 'test10.F77') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test09.f77', "This is a .f77 file.\n#link\n#f77\n") -test.write('test10.F77', "This is a .F77 file.\n#link\n#f77pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test09.f77', "This is a .f77 file.\n#link\n/*f77*/\n") +test.write('test10.F77', "This is a .F77 file.\n#link\n/*f77pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F77COMSTR.py b/test/Fortran/F77COMSTR.py index 6c89833..2bedf73 100644 --- a/test/Fortran/F77COMSTR.py +++ b/test/Fortran/F77COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f77pp = 'f77' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F77COM = r'%(_python_)s myfc.py f77 $TARGET $SOURCES', +env = Environment(F77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', F77COMSTR = 'Building f77 $TARGET from $SOURCES', - F77PPCOM = r'%(_python_)s myfc.py f77pp $TARGET $SOURCES', + F77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', F77PPCOMSTR = 'Building f77pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test09.f77') env.Object(source = 'test10.F77') """ % locals()) -test.write('test09.f77', "A .f77 file.\n#f77\n") -test.write('test10.F77', "A .F77 file.\n#%s\n" % f77pp) +test.write('test09.f77', "A .f77 file.\n/*f77*/\n") +test.write('test10.F77', "A .F77 file.\n/*%s*/\n" % f77pp) test.run(stdout = test.wrap_stdout("""\ Building f77 test09.obj from test09.f77 diff --git a/test/Fortran/F90COM.py b/test/Fortran/F90COM.py index e3be2a1..a4f37c2 100644 --- a/test/Fortran/F90COM.py +++ b/test/Fortran/F90COM.py @@ -31,26 +31,16 @@ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - F90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + F90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -63,25 +53,25 @@ env.Program(target = 'test11', source = 'test11.f90') env.Program(target = 'test12', source = 'test12.F90') env2 = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - F90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES') + F90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + F90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES') env2.Program(target = 'test21', source = 'test21.f90') env2.Program(target = 'test22', source = 'test22.F90') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test11.f90', "This is a .f90 file.\n#link\n#f90\n") -test.write('test12.F90', "This is a .F90 file.\n#link\n#f90pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test11.f90', "This is a .f90 file.\n#link\n/*f90*/\n") +test.write('test12.F90', "This is a .F90 file.\n#link\n/*f90pp*/\n") -test.write('test21.f90', "This is a .f90 file.\n#link\n#f90\n") -test.write('test22.F90', "This is a .F90 file.\n#link\n#f90pp\n") +test.write('test21.f90', "This is a .f90 file.\n#link\n/*f90*/\n") +test.write('test22.F90', "This is a .F90 file.\n#link\n/*f90pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F90COMSTR.py b/test/Fortran/F90COMSTR.py index 117a5a9..4a0ab75 100644 --- a/test/Fortran/F90COMSTR.py +++ b/test/Fortran/F90COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f90pp = 'f90' @@ -48,17 +38,17 @@ else: f90pp = 'f90pp' test.write('SConstruct', """ -env = Environment(F90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES', +env = Environment(F90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', F90COMSTR = 'Building f90 $TARGET from $SOURCES', - F90PPCOM = r'%(_python_)s myfc.py f90pp $TARGET $SOURCES', + F90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', F90PPCOMSTR = 'Building f90pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f90') env.Object(source = 'test02.F90') """ % locals()) -test.write('test01.f90', "A .f90 file.\n#f90\n") -test.write('test02.F90', "A .F90 file.\n#%s\n" % f90pp) +test.write('test01.f90', "A .f90 file.\n/*f90*/\n") +test.write('test02.F90', "A .F90 file.\n/*%s*/\n" % f90pp) test.run(stdout = test.wrap_stdout("""\ Building f90 test01.obj from test01.f90 diff --git a/test/Fortran/F95COM.py b/test/Fortran/F95COM.py index 4761635..32ae594 100644 --- a/test/Fortran/F95COM.py +++ b/test/Fortran/F95COM.py @@ -26,33 +26,21 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons - - _python_ = TestSCons._python_ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - F95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES', - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + F95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + F95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -65,25 +53,25 @@ env.Program(target = 'test13', source = 'test13.f95') env.Program(target = 'test14', source = 'test14.F95') env2 = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - F95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - F95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES') + F95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + F95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES') env2.Program(target = 'test21', source = 'test21.f95') env2.Program(target = 'test22', source = 'test22.F95') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") -test.write('test13.f95', "This is a .f95 file.\n#link\n#f95\n") -test.write('test14.F95', "This is a .F95 file.\n#link\n#f95pp\n") - -test.write('test21.f95', "This is a .f95 file.\n#link\n#f95\n") -test.write('test22.F95', "This is a .F95 file.\n#link\n#f95pp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") +test.write('test13.f95', "This is a .f95 file.\n#link\n/*f95*/\n") +test.write('test14.F95', "This is a .F95 file.\n#link\n/*f95pp*/\n") + +test.write('test21.f95', "This is a .f95 file.\n#link\n/*f95*/\n") +test.write('test22.F95', "This is a .F95 file.\n#link\n/*f95pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/F95COMSTR.py b/test/Fortran/F95COMSTR.py index 5d162f9..e3bc3ac 100644 --- a/test/Fortran/F95COMSTR.py +++ b/test/Fortran/F95COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f95pp = 'f95' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(F95COM = r'%(_python_)s myfc.py f95 $TARGET $SOURCES', +env = Environment(F95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', F95COMSTR = 'Building f95 $TARGET from $SOURCES', - F95PPCOM = r'%(_python_)s myfc.py f95pp $TARGET $SOURCES', + F95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', F95PPCOMSTR = 'Building f95pp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f95') env.Object(source = 'test02.F95') """ % locals()) -test.write('test01.f95', "A .f95 file.\n#f95\n") -test.write('test02.F95', "A .F95 file.\n#%s\n" % f95pp) +test.write('test01.f95', "A .f95 file.\n/*f95*/\n") +test.write('test02.F95', "A .F95 file.\n/*%s*/\n" % f95pp) test.run(stdout = test.wrap_stdout("""\ Building f95 test01.obj from test01.f95 diff --git a/test/Fortran/FORTRANCOM.py b/test/Fortran/FORTRANCOM.py index bf84d26..a07d427 100644 --- a/test/Fortran/FORTRANCOM.py +++ b/test/Fortran/FORTRANCOM.py @@ -26,31 +26,19 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import TestSCons - - _python_ = TestSCons._python_ _exe = TestSCons._exe test = TestSCons.TestSCons() +test.file_fixture('mycompile.py') test.file_fixture('mylink.py') -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - test.write('SConstruct', """ env = Environment(LINK = r'%(_python_)s mylink.py', LINKFLAGS = [], - FORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') + FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.Program(target = 'test01', source = 'test01.f') env.Program(target = 'test02', source = 'test02.F') env.Program(target = 'test03', source = 'test03.for') @@ -61,14 +49,14 @@ env.Program(target = 'test07', source = 'test07.fpp') env.Program(target = 'test08', source = 'test08.FPP') """ % locals()) -test.write('test01.f', "This is a .f file.\n#link\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#link\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#link\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#link\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#link\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#link\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#link\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#link\n#fortranpp\n") +test.write('test01.f', "This is a .f file.\n#link\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n#link\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n#link\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n#link\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n#link\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n#link\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n#link\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n#link\n/*fortranpp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/FORTRANCOMSTR.py b/test/Fortran/FORTRANCOMSTR.py index 5efa820..10f7d3f 100644 --- a/test/Fortran/FORTRANCOMSTR.py +++ b/test/Fortran/FORTRANCOMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): fortranpp = 'fortran' @@ -49,9 +39,9 @@ else: test.write('SConstruct', """ -env = Environment(FORTRANCOM = r'%(_python_)s myfc.py fortran $TARGET $SOURCES', +env = Environment(FORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', FORTRANCOMSTR = 'Building fortran $TARGET from $SOURCES', - FORTRANPPCOM = r'%(_python_)s myfc.py fortranpp $TARGET $SOURCES', + FORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES', FORTRANPPCOMSTR = 'Building fortranpp $TARGET from $SOURCES', OBJSUFFIX='.obj') env.Object(source = 'test01.f') @@ -64,14 +54,14 @@ env.Object(source = 'test07.fpp') env.Object(source = 'test08.FPP') """ % locals()) -test.write('test01.f', "A .f file.\n#fortran\n") -test.write('test02.F', "A .F file.\n#%s\n" % fortranpp) -test.write('test03.for', "A .for file.\n#fortran\n") -test.write('test04.FOR', "A .FOR file.\n#%s\n" % fortranpp) -test.write('test05.ftn', "A .ftn file.\n#fortran\n") -test.write('test06.FTN', "A .FTN file.\n#%s\n" % fortranpp) -test.write('test07.fpp', "A .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "A .FPP file.\n#fortranpp\n") +test.write('test01.f', "A .f file.\n/*fortran*/\n") +test.write('test02.F', "A .F file.\n/*%s*/\n" % fortranpp) +test.write('test03.for', "A .for file.\n/*fortran*/\n") +test.write('test04.FOR', "A .FOR file.\n/*%s*/\n" % fortranpp) +test.write('test05.ftn', "A .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "A .FTN file.\n/*%s*/\n" % fortranpp) +test.write('test07.fpp', "A .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "A .FPP file.\n/*fortranpp*/\n") test.run(stdout = test.wrap_stdout("""\ Building fortran test01.obj from test01.f diff --git a/test/Fortran/SHF77COM.py b/test/Fortran/SHF77COM.py index c99207f..9289fa3 100644 --- a/test/Fortran/SHF77COM.py +++ b/test/Fortran/SHF77COM.py @@ -32,26 +32,13 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHF77COM = r'%(_python_)s myfortran.py f77 $TARGET $SOURCES', - SHF77PPCOM = r'%(_python_)s myfortran.py f77pp $TARGET $SOURCES', - SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHF77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', + SHF77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', + SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -64,16 +51,16 @@ env.SharedObject(target = 'test09', source = 'test09.f77') env.SharedObject(target = 'test10', source = 'test10.F77') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") -test.write('test09.f77', "This is a .f77 file.\n#f77\n") -test.write('test10.F77', "This is a .F77 file.\n#f77pp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") +test.write('test09.f77', "This is a .f77 file.\n/*f77*/\n") +test.write('test10.F77', "This is a .F77 file.\n/*f77pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHF77COMSTR.py b/test/Fortran/SHF77COMSTR.py index 7a43a4a..37d2edf 100644 --- a/test/Fortran/SHF77COMSTR.py +++ b/test/Fortran/SHF77COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f77pp = 'f77' @@ -49,25 +39,25 @@ else: test.write('SConstruct', """ -env = Environment(SHF77COM = r'%(_python_)s myfc.py f77 $TARGET $SOURCES', +env = Environment(SHF77COM = r'%(_python_)s mycompile.py f77 $TARGET $SOURCES', SHF77COMSTR = 'Building f77 $TARGET from $SOURCES', - SHF77PPCOM = r'%(_python_)s myfc.py f77pp $TARGET $SOURCES', + SHF77PPCOM = r'%(_python_)s mycompile.py f77pp $TARGET $SOURCES', SHF77PPCOMSTR = 'Building f77pp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test09.f77') env.SharedObject(source = 'test10.F77') """ % locals()) -test.write('test01.f', "A .f file.\n#f77\n") -test.write('test02.F', "A .F file.\n#%s\n" % f77pp) -test.write('test03.for', "A .for file.\n#f77\n") -test.write('test04.FOR', "A .FOR file.\n#%s\n" % f77pp) -test.write('test05.ftn', "A .ftn file.\n#f77\n") -test.write('test06.FTN', "A .FTN file.\n#%s\n" % f77pp) -test.write('test07.fpp', "A .fpp file.\n#f77pp\n") -test.write('test08.FPP', "A .FPP file.\n#f77pp\n") -test.write('test09.f77', "A .f77 file.\n#f77\n") -test.write('test10.F77', "A .F77 file.\n#%s\n" % f77pp) +test.write('test01.f', "A .f file.\n/*f77*/\n") +test.write('test02.F', "A .F file.\n/*%s*/\n" % f77pp) +test.write('test03.for', "A .for file.\n/*f77*/\n") +test.write('test04.FOR', "A .FOR file.\n/*%s*/\n" % f77pp) +test.write('test05.ftn', "A .ftn file.\n/*f77*/\n") +test.write('test06.FTN', "A .FTN file.\n/*%s*/\n" % f77pp) +test.write('test07.fpp', "A .fpp file.\n/*f77pp*/\n") +test.write('test08.FPP', "A .FPP file.\n/*f77pp*/\n") +test.write('test09.f77', "A .f77 file.\n/*f77*/\n") +test.write('test10.F77', "A .F77 file.\n/*%s*/\n" % f77pp) test.run(stdout = test.wrap_stdout("""\ Building f77 test09.shobj from test09.f77 diff --git a/test/Fortran/SHF90COM.py b/test/Fortran/SHF90COM.py index 415cb9b..9eef8b6 100644 --- a/test/Fortran/SHF90COM.py +++ b/test/Fortran/SHF90COM.py @@ -32,26 +32,13 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHF90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - SHF90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES', - SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', + SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -62,25 +49,25 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') env.SharedObject(target = 'test11', source = 'test11.f90') env.SharedObject(target = 'test12', source = 'test12.F90') -env2 = Environment(SHF90COM = r'%(_python_)s myfortran.py f90 $TARGET $SOURCES', - SHF90PPCOM = r'%(_python_)s myfortran.py f90pp $TARGET $SOURCES') +env2 = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', + SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES') env2.SharedObject(target = 'test21', source = 'test21.f90') env2.SharedObject(target = 'test22', source = 'test22.F90') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") -test.write('test11.f90', "This is a .f90 file.\n#f90\n") -test.write('test12.F90', "This is a .F90 file.\n#f90pp\n") - -test.write('test21.f90', "This is a .f90 file.\n#f90\n") -test.write('test22.F90', "This is a .F90 file.\n#f90pp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") +test.write('test11.f90', "This is a .f90 file.\n/*f90*/\n") +test.write('test12.F90', "This is a .F90 file.\n/*f90pp*/\n") + +test.write('test21.f90', "This is a .f90 file.\n/*f90*/\n") +test.write('test22.F90', "This is a .F90 file.\n/*f90pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHF90COMSTR.py b/test/Fortran/SHF90COMSTR.py index a3353fa..4ea8ca6 100644 --- a/test/Fortran/SHF90COMSTR.py +++ b/test/Fortran/SHF90COMSTR.py @@ -30,36 +30,25 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f90pp = 'f90' else: f90pp = 'f90pp' - test.write('SConstruct', """ -env = Environment(SHF90COM = r'%(_python_)s myfc.py f90 $TARGET $SOURCES', +env = Environment(SHF90COM = r'%(_python_)s mycompile.py f90 $TARGET $SOURCES', SHF90COMSTR = 'Building f90 $TARGET from $SOURCES', - SHF90PPCOM = r'%(_python_)s myfc.py f90pp $TARGET $SOURCES', + SHF90PPCOM = r'%(_python_)s mycompile.py f90pp $TARGET $SOURCES', SHF90PPCOMSTR = 'Building f90pp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test01.f90') env.SharedObject(source = 'test02.F90') """ % locals()) -test.write('test01.f90', "A .f90 file.\n#f90\n") -test.write('test02.F90', "A .F90 file.\n#%s\n" % f90pp) +test.write('test01.f90', "A .f90 file.\n/*f90*/\n") +test.write('test02.F90', "A .F90 file.\n/*%s*/\n" % f90pp) test.run(stdout = test.wrap_stdout("""\ Building f90 test01.shobj from test01.f90 diff --git a/test/Fortran/SHF95COM.py b/test/Fortran/SHF95COM.py index 0984b20..e31cf45 100644 --- a/test/Fortran/SHF95COM.py +++ b/test/Fortran/SHF95COM.py @@ -32,26 +32,13 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHF95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - SHF95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES', - SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHF95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + SHF95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', + SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -62,25 +49,25 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') env.SharedObject(target = 'test13', source = 'test13.f95') env.SharedObject(target = 'test14', source = 'test14.F95') -env2 = Environment(SHF95COM = r'%(_python_)s myfortran.py f95 $TARGET $SOURCES', - SHF95PPCOM = r'%(_python_)s myfortran.py f95pp $TARGET $SOURCES') +env2 = Environment(SHF95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', + SHF95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES') env2.SharedObject(target = 'test21', source = 'test21.f95') env2.SharedObject(target = 'test22', source = 'test22.F95') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") -test.write('test13.f95', "This is a .f95 file.\n#f95\n") -test.write('test14.F95', "This is a .F95 file.\n#f95pp\n") - -test.write('test21.f95', "This is a .f95 file.\n#f95\n") -test.write('test22.F95', "This is a .F95 file.\n#f95pp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") +test.write('test13.f95', "This is a .f95 file.\n/*f95*/\n") +test.write('test14.F95', "This is a .F95 file.\n/*f95pp*/\n") + +test.write('test21.f95', "This is a .f95 file.\n/*f95*/\n") +test.write('test22.F95', "This is a .F95 file.\n/*f95pp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHF95COMSTR.py b/test/Fortran/SHF95COMSTR.py index 5aec6b0..2c1282f 100644 --- a/test/Fortran/SHF95COMSTR.py +++ b/test/Fortran/SHF95COMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): f95pp = 'f95' @@ -49,17 +39,17 @@ else: test.write('SConstruct', """ -env = Environment(SHF95COM = r'%(_python_)s myfc.py f95 $TARGET $SOURCES', +env = Environment(SHF95COM = r'%(_python_)s mycompile.py f95 $TARGET $SOURCES', SHF95COMSTR = 'Building f95 $TARGET from $SOURCES', - SHF95PPCOM = r'%(_python_)s myfc.py f95pp $TARGET $SOURCES', + SHF95PPCOM = r'%(_python_)s mycompile.py f95pp $TARGET $SOURCES', SHF95PPCOMSTR = 'Building f95pp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test01.f95') env.SharedObject(source = 'test02.F95') """ % locals()) -test.write('test01.f95', "A .f95 file.\n#f95\n") -test.write('test02.F95', "A .F95 file.\n#%s\n" % f95pp) +test.write('test01.f95', "A .f95 file.\n/*f95*/\n") +test.write('test02.F95', "A .F95 file.\n/*%s*/\n" % f95pp) test.run(stdout = test.wrap_stdout("""\ Building f95 test01.shobj from test01.f95 diff --git a/test/Fortran/SHFORTRANCOM.py b/test/Fortran/SHFORTRANCOM.py index f89358d..56958b2 100644 --- a/test/Fortran/SHFORTRANCOM.py +++ b/test/Fortran/SHFORTRANCOM.py @@ -32,24 +32,11 @@ obj_ = TestSCons.shobj_ test = TestSCons.TestSCons() - - -test.write('myfortran.py', r""" -import sys -comment = '#' + sys.argv[1] -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in infile.readlines(): - if l[:len(comment)] != comment: - outfile.write(l) -sys.exit(0) -""") - - +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHFORTRANCOM = r'%(_python_)s myfortran.py fortran $TARGET $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfortran.py fortranpp $TARGET $SOURCES') +env = Environment(SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES') env.SharedObject(target = 'test01', source = 'test01.f') env.SharedObject(target = 'test02', source = 'test02.F') env.SharedObject(target = 'test03', source = 'test03.for') @@ -60,14 +47,14 @@ env.SharedObject(target = 'test07', source = 'test07.fpp') env.SharedObject(target = 'test08', source = 'test08.FPP') """ % locals()) -test.write('test01.f', "This is a .f file.\n#fortran\n") -test.write('test02.F', "This is a .F file.\n#fortranpp\n") -test.write('test03.for', "This is a .for file.\n#fortran\n") -test.write('test04.FOR', "This is a .FOR file.\n#fortranpp\n") -test.write('test05.ftn', "This is a .ftn file.\n#fortran\n") -test.write('test06.FTN', "This is a .FTN file.\n#fortranpp\n") -test.write('test07.fpp', "This is a .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "This is a .FPP file.\n#fortranpp\n") +test.write('test01.f', "This is a .f file.\n/*fortran*/\n") +test.write('test02.F', "This is a .F file.\n/*fortranpp*/\n") +test.write('test03.for', "This is a .for file.\n/*fortran*/\n") +test.write('test04.FOR', "This is a .FOR file.\n/*fortranpp*/\n") +test.write('test05.ftn', "This is a .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "This is a .FTN file.\n/*fortranpp*/\n") +test.write('test07.fpp', "This is a .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "This is a .FPP file.\n/*fortranpp*/\n") test.run(arguments = '.', stderr = None) diff --git a/test/Fortran/SHFORTRANCOMSTR.py b/test/Fortran/SHFORTRANCOMSTR.py index 3b801db..c58920e 100644 --- a/test/Fortran/SHFORTRANCOMSTR.py +++ b/test/Fortran/SHFORTRANCOMSTR.py @@ -30,17 +30,7 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myfc.py', r""" -import sys -fline = '#'+sys.argv[1]+'\n' -outfile = open(sys.argv[2], 'wb') -infile = open(sys.argv[3], 'rb') -for l in [l for l in infile.readlines() if l != fline]: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') if not TestSCons.case_sensitive_suffixes('.f','.F'): fortranpp = 'fortran' @@ -49,9 +39,9 @@ else: test.write('SConstruct', """ -env = Environment(SHFORTRANCOM = r'%(_python_)s myfc.py fortran $TARGET $SOURCES', +env = Environment(SHFORTRANCOM = r'%(_python_)s mycompile.py fortran $TARGET $SOURCES', SHFORTRANCOMSTR = 'Building fortran $TARGET from $SOURCES', - SHFORTRANPPCOM = r'%(_python_)s myfc.py fortranpp $TARGET $SOURCES', + SHFORTRANPPCOM = r'%(_python_)s mycompile.py fortranpp $TARGET $SOURCES', SHFORTRANPPCOMSTR = 'Building fortranpp $TARGET from $SOURCES', SHOBJPREFIX='', SHOBJSUFFIX='.shobj') env.SharedObject(source = 'test01.f') @@ -64,14 +54,14 @@ env.SharedObject(source = 'test07.fpp') env.SharedObject(source = 'test08.FPP') """ % locals()) -test.write('test01.f', "A .f file.\n#fortran\n") -test.write('test02.F', "A .F file.\n#%s\n" % fortranpp) -test.write('test03.for', "A .for file.\n#fortran\n") -test.write('test04.FOR', "A .FOR file.\n#%s\n" % fortranpp) -test.write('test05.ftn', "A .ftn file.\n#fortran\n") -test.write('test06.FTN', "A .FTN file.\n#%s\n" % fortranpp) -test.write('test07.fpp', "A .fpp file.\n#fortranpp\n") -test.write('test08.FPP', "A .FPP file.\n#fortranpp\n") +test.write('test01.f', "A .f file.\n/*fortran*/\n") +test.write('test02.F', "A .F file.\n/*%s*/\n" % fortranpp) +test.write('test03.for', "A .for file.\n/*fortran*/\n") +test.write('test04.FOR', "A .FOR file.\n/*%s*/\n" % fortranpp) +test.write('test05.ftn', "A .ftn file.\n/*fortran*/\n") +test.write('test06.FTN', "A .FTN file.\n/*%s*/\n" % fortranpp) +test.write('test07.fpp', "A .fpp file.\n/*fortranpp*/\n") +test.write('test08.FPP', "A .FPP file.\n/*fortranpp*/\n") test.run(stdout = test.wrap_stdout("""\ Building fortran test01.shobj from test01.f diff --git a/test/Ghostscript/GSCOM.py b/test/Ghostscript/GSCOM.py index c86f8b6..fd14ad8 100644 --- a/test/Ghostscript/GSCOM.py +++ b/test/Ghostscript/GSCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mygs.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*gs*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'gs'], - GSCOM = r'%(_python_)s mygs.py $TARGET $SOURCES') + GSCOM = r'%(_python_)s mycompile.py gs $TARGET $SOURCES') env.PDF(target = 'aaa', source = 'aaa.ps') """ % locals()) @@ -58,8 +48,6 @@ test.run(arguments = '.') test.must_match('aaa.pdf', "aaa.ps\n") - - test.pass_test() # Local Variables: diff --git a/test/Ghostscript/GSCOMSTR.py b/test/Ghostscript/GSCOMSTR.py index b39cf4f..fd82bff 100644 --- a/test/Ghostscript/GSCOMSTR.py +++ b/test/Ghostscript/GSCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mygs.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*gs*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'gs'], - GSCOM = r'%(_python_)s mygs.py $TARGET $SOURCES', + GSCOM = r'%(_python_)s mycompile.py gs $TARGET $SOURCES', GSCOMSTR = 'GSing $TARGET from $SOURCE') env.PDF(target = 'aaa', source = 'aaa.ps') """ % locals()) @@ -62,8 +52,6 @@ GSing aaa.pdf from aaa.ps test.must_match('aaa.pdf', "aaa.ps\n") - - test.pass_test() # Local Variables: diff --git a/test/IDL/MIDLCOMSTR.py b/test/IDL/MIDLCOMSTR.py index 56f8c40..9e01aa0 100644 --- a/test/IDL/MIDLCOMSTR.py +++ b/test/IDL/MIDLCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mymidl.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*midl*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'midl'], - MIDLCOM = r'%(_python_)s mymidl.py $TARGET $SOURCES', + MIDLCOM = r'%(_python_)s mycompile.py midl $TARGET $SOURCES', MIDLCOMSTR = 'MIDLing $TARGET from $SOURCE') env.TypeLibrary(target = 'aaa', source = 'aaa.idl') """ % locals()) @@ -62,8 +52,6 @@ MIDLing aaa.tlb from aaa.idl test.must_match('aaa.tlb', "aaa.idl\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JARCOM.py b/test/Java/JARCOM.py index 9d93ba5..9146445 100644 --- a/test/Java/JARCOM.py +++ b/test/Java/JARCOM.py @@ -35,20 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - -test.write('myjar.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*jar*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'jar'], - JARCOM = r'%(_python_)s myjar.py $TARGET $SOURCES') + JARCOM = r'%(_python_)s mycompile.py jar $TARGET $SOURCES') env.Jar(target = 'test1', source = ['file1.in', 'file2.in', 'file3.in']) """ % locals()) @@ -60,8 +51,6 @@ test.run() test.must_match('test1.jar', "file1.in\nfile2.in\nfile3.in\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JARCOMSTR.py b/test/Java/JARCOMSTR.py index 069587f..4bdc45b 100644 --- a/test/Java/JARCOMSTR.py +++ b/test/Java/JARCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myjar.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*jar*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'jar'], - JARCOM = r'%(_python_)s myjar.py $TARGET $SOURCES', + JARCOM = r'%(_python_)s mycompile.py jar $TARGET $SOURCES', JARCOMSTR = "Jar'ing up $TARGET from $SOURCES") env.Jar(target = 'test1', source = ['file1.in', 'file2.in', 'file3.in']) """ % locals()) @@ -64,8 +54,6 @@ Jar'ing up test1.jar from file1.in file2.in file3.in test.must_match('test1.jar', "file1.in\nfile2.in\nfile3.in\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVACCOM.py b/test/Java/JAVACCOM.py index 064feed..0de173d 100644 --- a/test/Java/JAVACCOM.py +++ b/test/Java/JAVACCOM.py @@ -36,21 +36,11 @@ test = TestSCons.TestSCons() test.subdir('src') - - -test.write('myjavac.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*javac*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javac'], - JAVACCOM = r'%(_python_)s myjavac.py $TARGET $SOURCES') + JAVACCOM = r'%(_python_)s mycompile.py javac $TARGET $SOURCES') env.Java(target = 'classes', source = 'src') """ % locals()) @@ -63,8 +53,6 @@ test.run() test.must_match(['classes', 'file1.class'], "file1.java\nfile2.java\nfile3.java\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVACCOMSTR.py b/test/Java/JAVACCOMSTR.py index 6440283..8540e13 100644 --- a/test/Java/JAVACCOMSTR.py +++ b/test/Java/JAVACCOMSTR.py @@ -39,21 +39,11 @@ test = TestSCons.TestSCons() test.subdir('src') - - -test.write('myjavac.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*javac*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javac'], - JAVACCOM = r'%(_python_)s myjavac.py $TARGET $SOURCES', + JAVACCOM = r'%(_python_)s mycompile.py javac $TARGET $SOURCES', JAVACCOMSTR = "Compiling class(es) $TARGET from $SOURCES") env.Java(target = 'classes', source = 'src') """ % locals()) @@ -74,8 +64,6 @@ Compiling class(es) %(classes_file1_class)s from %(src_file1_java)s %(src_file2_ test.must_match(['classes', 'file1.class'], "file1.java\nfile2.java\nfile3.java\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVAHCOM.py b/test/Java/JAVAHCOM.py index 9db897a..801707e 100644 --- a/test/Java/JAVAHCOM.py +++ b/test/Java/JAVAHCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myjavah.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*javah*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javah'], - JAVAHCOM = r'%(_python_)s myjavah.py $TARGET $SOURCES') + JAVAHCOM = r'%(_python_)s mycompile.py javah $TARGET $SOURCES') env.JavaH(target = 'out', source = 'file1.class') env.JavaH(target = 'out', source = 'file2.class') env.JavaH(target = 'out', source = 'file3.class') @@ -64,8 +54,6 @@ test.must_match(['out', 'file1.h'], "file1.class\n") test.must_match(['out', 'file2.h'], "file2.class\n") test.must_match(['out', 'file3.h'], "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/JAVAHCOMSTR.py b/test/Java/JAVAHCOMSTR.py index f8120d6..c205890 100644 --- a/test/Java/JAVAHCOMSTR.py +++ b/test/Java/JAVAHCOMSTR.py @@ -39,27 +39,15 @@ test = TestSCons.TestSCons() test.subdir('src') - - out_file1_h = os.path.join('out', 'file1.h') out_file2_h = os.path.join('out', 'file2.h') out_file3_h = os.path.join('out', 'file3.h') - - -test.write('myjavah.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*javah*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'javah'], - JAVAHCOM = r'%(_python_)s myjavah.py $TARGET $SOURCES', + JAVAHCOM = r'%(_python_)s mycompile.py javah $TARGET $SOURCES', JAVAHCOMSTR = 'Building javah $TARGET from $SOURCES') env.JavaH(target = 'out', source = 'file1.class') env.JavaH(target = 'out', source = 'file2.class') @@ -80,8 +68,6 @@ test.must_match(['out', 'file1.h'], "file1.class\n") test.must_match(['out', 'file2.h'], "file2.class\n") test.must_match(['out', 'file3.h'], "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/RMICCOM.py b/test/Java/RMICCOM.py index ba7f965..9f6595d 100644 --- a/test/Java/RMICCOM.py +++ b/test/Java/RMICCOM.py @@ -38,27 +38,15 @@ test = TestSCons.TestSCons() test.subdir('src') - - out_file1 = os.path.join('out', 'file1', 'class_Stub.class') out_file2 = os.path.join('out', 'file2', 'class_Stub.class') out_file3 = os.path.join('out', 'file3', 'class_Stub.class') - - -test.write('myrmic.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*rmic*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'rmic'], - RMICCOM = r'%(_python_)s myrmic.py $TARGET $SOURCES') + RMICCOM = r'%(_python_)s mycompile.py rmic $TARGET $SOURCES') env.RMIC(target = 'out', source = 'file1.class') env.RMIC(target = 'out', source = 'file2.class') env.RMIC(target = 'out', source = 'file3.class') @@ -74,8 +62,6 @@ test.must_match(out_file1, "file1.class\n") test.must_match(out_file2, "file2.class\n") test.must_match(out_file3, "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/Java/RMICCOMSTR.py b/test/Java/RMICCOMSTR.py index 8fe535a..d4d1904 100644 --- a/test/Java/RMICCOMSTR.py +++ b/test/Java/RMICCOMSTR.py @@ -39,27 +39,15 @@ test = TestSCons.TestSCons() test.subdir('src') - - out_file1 = os.path.join('out', 'file1', 'class_Stub.class') out_file2 = os.path.join('out', 'file2', 'class_Stub.class') out_file3 = os.path.join('out', 'file3', 'class_Stub.class') - - -test.write('myrmic.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*rmic*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['default', 'rmic'], - RMICCOM = r'%(_python_)s myrmic.py $TARGET $SOURCES', + RMICCOM = r'%(_python_)s mycompile.py rmic $TARGET $SOURCES', RMICCOMSTR = 'Building rmic $TARGET from $SOURCES') env.RMIC(target = 'out', source = 'file1.class') env.RMIC(target = 'out', source = 'file2.class') @@ -80,8 +68,6 @@ test.must_match(out_file1, "file1.class\n") test.must_match(out_file2, "file2.class\n") test.must_match(out_file3, "file3.class\n") - - test.pass_test() # Local Variables: diff --git a/test/LEX/LEXCOM.py b/test/LEX/LEXCOM.py index 6a32388..75f21b7 100644 --- a/test/LEX/LEXCOM.py +++ b/test/LEX/LEXCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mylex.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*lex*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'lex'], - LEXCOM = r'%(_python_)s mylex.py $TARGET $SOURCES') + LEXCOM = r'%(_python_)s mycompile.py lex $TARGET $SOURCES') env.CFile(target = 'aaa', source = 'aaa.l') env.CFile(target = 'bbb', source = 'bbb.lex') """ % locals()) @@ -61,8 +51,6 @@ test.run(arguments = '.') test.must_match('aaa.c', "aaa.l\n") test.must_match('bbb.c', "bbb.lex\n") - - test.pass_test() # Local Variables: diff --git a/test/LEX/LEXCOMSTR.py b/test/LEX/LEXCOMSTR.py index 07e693c..2130d60 100644 --- a/test/LEX/LEXCOMSTR.py +++ b/test/LEX/LEXCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mylex.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*lex*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'lex'], - LEXCOM = r'%(_python_)s mylex.py $TARGET $SOURCES', + LEXCOM = r'%(_python_)s mycompile.py lex $TARGET $SOURCES', LEXCOMSTR = 'Lexing $TARGET from $SOURCE') env.CFile(target = 'aaa', source = 'aaa.l') env.CFile(target = 'bbb', source = 'bbb.lex') @@ -66,8 +56,6 @@ Lexing bbb.c from bbb.lex test.must_match('aaa.c', "aaa.l\n") test.must_match('bbb.c', "bbb.lex\n") - - test.pass_test() # Local Variables: diff --git a/test/LINK/LINKCOM.py b/test/LINK/LINKCOM.py index 996e727..da12b10 100644 --- a/test/LINK/LINKCOM.py +++ b/test/LINK/LINKCOM.py @@ -34,18 +34,10 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.write('mylink.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*link*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(LINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES', +env = Environment(LINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES', OBJSUFFIX = '.obj', PROGSUFFIX = '.exe') env.Program(target = 'test1', source = ['test1.obj', 'test2.obj']) @@ -65,8 +57,6 @@ test.run() test.must_match('test1.exe', "test1.obj\ntest2.obj\n") - - test.pass_test() # Local Variables: diff --git a/test/LINK/LINKCOMSTR.py b/test/LINK/LINKCOMSTR.py index 8163016..df070fb 100644 --- a/test/LINK/LINKCOMSTR.py +++ b/test/LINK/LINKCOMSTR.py @@ -35,20 +35,10 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mylink.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*link*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(LINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES', +env = Environment(LINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES', LINKCOMSTR = 'Linking $TARGET from $SOURCES', OBJSUFFIX = '.obj', PROGSUFFIX = '.exe') diff --git a/test/LINK/SHLINKCOM.py b/test/LINK/SHLINKCOM.py index 1204ed1..9907db5 100644 --- a/test/LINK/SHLINKCOM.py +++ b/test/LINK/SHLINKCOM.py @@ -34,31 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mycc.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*cc*/\n']: - outfile.write(l) -sys.exit(0) - -""") -test.write('mylink.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*link*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCES', - SHLINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES', +env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCES', + SHLINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES', SHOBJSUFFIX = '.obj', SHLIBPREFIX = '', SHLIBSUFFIX = '.dll') @@ -83,9 +63,6 @@ test.run() test.must_match('test3.dll', "test1.c\ntest2.c\n") - - - test.pass_test() # Local Variables: diff --git a/test/LINK/SHLINKCOMSTR.py b/test/LINK/SHLINKCOMSTR.py index 5663a1e..4dd5c7c 100644 --- a/test/LINK/SHLINKCOMSTR.py +++ b/test/LINK/SHLINKCOMSTR.py @@ -36,31 +36,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mycc.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*cc*/\n']: - outfile.write(l) -sys.exit(0) - -""") -test.write('mylink.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*link*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ -env = Environment(SHCCCOM = r'%(_python_)s mycc.py $TARGET $SOURCES', - SHLINKCOM = r'%(_python_)s mylink.py $TARGET $SOURCES', +env = Environment(SHCCCOM = r'%(_python_)s mycompile.py cc $TARGET $SOURCES', + SHLINKCOM = r'%(_python_)s mycompile.py link $TARGET $SOURCES', SHLINKCOMSTR = 'Linking shared $TARGET from $SOURCES', SHOBJPREFIX = '', SHOBJSUFFIX = '.obj', @@ -84,8 +64,8 @@ test2.c """) test.run(stdout = test.wrap_stdout("""\ -%(_python_)s mycc.py test1.obj test1.c -%(_python_)s mycc.py test2.obj test2.c +%(_python_)s mycompile.py cc test1.obj test1.c +%(_python_)s mycompile.py cc test2.obj test2.c Linking shared test3.dll from test1.obj test2.obj """ % locals())) diff --git a/test/MSVC/PCHCOM.py b/test/MSVC/PCHCOM.py index ff27e10..fefab92 100644 --- a/test/MSVC/PCHCOM.py +++ b/test/MSVC/PCHCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypch.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*pch*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - PCHCOM = r'%(_python_)s mypch.py $TARGET $SOURCES') + PCHCOM = r'%(_python_)s mycompile.py pch $TARGET $SOURCES') env.PCH(target = 'aaa', source = 'aaa.h') """ % locals()) @@ -58,8 +48,6 @@ test.run(arguments = ".") test.must_match('aaa.pch', "aaa.h\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVC/PCHCOMSTR.py b/test/MSVC/PCHCOMSTR.py index 51f56fb..beea488 100644 --- a/test/MSVC/PCHCOMSTR.py +++ b/test/MSVC/PCHCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mypch.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*pch*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - PCHCOM = r'%(_python_)s mypch.py $TARGET $SOURCES', + PCHCOM = r'%(_python_)s mycompile.py pch $TARGET $SOURCES', PCHCOMSTR = 'PCHing $TARGET from $SOURCE') env.PCH(target = 'aaa', source = 'aaa.h') """ % locals()) @@ -62,8 +52,6 @@ PCHing aaa.pch from aaa.h test.must_match('aaa.pch', "aaa.h\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVC/RCCOM.py b/test/MSVC/RCCOM.py index 05382b8..04f8fff 100644 --- a/test/MSVC/RCCOM.py +++ b/test/MSVC/RCCOM.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myrc.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES') + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -59,8 +49,6 @@ test.run(arguments = ".") test.must_match('aaa.res', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVC/RCCOMSTR.py b/test/MSVC/RCCOMSTR.py index 8425d73..2630651 100644 --- a/test/MSVC/RCCOMSTR.py +++ b/test/MSVC/RCCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myrc.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'msvc'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES', + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES', RCCOMSTR = 'RCing $TARGET from $SOURCE') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -62,8 +52,6 @@ RCing aaa.res from aaa.rc test.must_match('aaa.res', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/MSVS/vs-10.0Exp-exec.py b/test/MSVS/vs-10.0Exp-exec.py index 39c96ac..a63f6c4 100644 --- a/test/MSVS/vs-10.0Exp-exec.py +++ b/test/MSVS/vs-10.0Exp-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-11.0-exec.py b/test/MSVS/vs-11.0-exec.py index 7acf9d5..21645f5 100644 --- a/test/MSVS/vs-11.0-exec.py +++ b/test/MSVS/vs-11.0-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-11.0Exp-exec.py b/test/MSVS/vs-11.0Exp-exec.py index 7cfc85d..be48971 100644 --- a/test/MSVS/vs-11.0Exp-exec.py +++ b/test/MSVS/vs-11.0Exp-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-14.0-exec.py b/test/MSVS/vs-14.0-exec.py index b96bdab..f2a826c 100644 --- a/test/MSVS/vs-14.0-exec.py +++ b/test/MSVS/vs-14.0-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) @@ -70,8 +71,8 @@ env=Environment(MSVS_VERSION = '%(msvs_version)s') env.MSVSProject(target = 'foo.vcxproj', srcs = ['foo.c'], buildtarget = 'foo.exe', - variant = 'Release') - + variant = 'Release', + DebugSettings = {'LocalDebuggerCommandArguments':'echo "<foo.c>" > output.txt'}) env.Program('foo.c') """ % locals()) @@ -97,7 +98,7 @@ test.run(chdir='sub dir', arguments=['foo.sln', '/build', 'Release']) test.run(program=test.workpath('sub dir', 'foo'), stdout="foo.c\n") - +test.validate_msvs_file(test.workpath('sub dir', 'foo.vcxproj.user')) test.pass_test() diff --git a/test/MSVS/vs-14.0Exp-exec.py b/test/MSVS/vs-14.0Exp-exec.py index 44ebece..cb4aaf3 100644 --- a/test/MSVS/vs-14.0Exp-exec.py +++ b/test/MSVS/vs-14.0Exp-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-6.0-exec.py b/test/MSVS/vs-6.0-exec.py index fe08a77..d017790 100644 --- a/test/MSVS/vs-6.0-exec.py +++ b/test/MSVS/vs-6.0-exec.py @@ -54,7 +54,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-7.0-exec.py b/test/MSVS/vs-7.0-exec.py index cc141f3..e62ee77 100644 --- a/test/MSVS/vs-7.0-exec.py +++ b/test/MSVS/vs-7.0-exec.py @@ -54,7 +54,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-7.1-exec.py b/test/MSVS/vs-7.1-exec.py index f44af80..42f6ae8 100644 --- a/test/MSVS/vs-7.1-exec.py +++ b/test/MSVS/vs-7.1-exec.py @@ -54,7 +54,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-8.0Exp-exec.py b/test/MSVS/vs-8.0Exp-exec.py index 5132d6d..66196f1 100644 --- a/test/MSVS/vs-8.0Exp-exec.py +++ b/test/MSVS/vs-8.0Exp-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-9.0-exec.py b/test/MSVS/vs-9.0-exec.py index ebd08c0..7b544aa 100644 --- a/test/MSVS/vs-9.0-exec.py +++ b/test/MSVS/vs-9.0-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MSVS/vs-9.0Exp-exec.py b/test/MSVS/vs-9.0Exp-exec.py index c4a562a..caa763e 100644 --- a/test/MSVS/vs-9.0Exp-exec.py +++ b/test/MSVS/vs-9.0Exp-exec.py @@ -55,7 +55,8 @@ if not msvs_version in test.msvs_versions(): test.run(arguments = '-n -q -Q -f -', stdin = """\ env = Environment(tools = ['msvc'], MSVS_VERSION='%(msvs_version)s') -print "os.environ.update(%%s)" %% repr(env['ENV']) +sconsEnv = repr(env['ENV']) +print("os.environ.update(" + sconsEnv + ")") """ % locals()) exec(test.stdout()) diff --git a/test/MinGW/RCCOM.py b/test/MinGW/RCCOM.py index dadfea5..a4d9147 100644 --- a/test/MinGW/RCCOM.py +++ b/test/MinGW/RCCOM.py @@ -39,19 +39,11 @@ test = TestSCons.TestSCons() if sys.platform in ('irix6',): test.skip_test("Skipping mingw test on non-Windows %s platform."%sys.platform) -test.write('myrc.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'mingw'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES') + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -61,8 +53,6 @@ test.run(arguments = ".") test.must_match('aaa.o', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/MinGW/RCCOMSTR.py b/test/MinGW/RCCOMSTR.py index 501a57d..0ed84c2 100644 --- a/test/MinGW/RCCOMSTR.py +++ b/test/MinGW/RCCOMSTR.py @@ -39,19 +39,11 @@ test = TestSCons.TestSCons() if sys.platform in ('irix6',): test.skip_test("Skipping mingw test on non-Windows %s platform."%sys.platform) -test.write('myrc.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*rc*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'mingw'], - RCCOM = r'%(_python_)s myrc.py $TARGET $SOURCES', + RCCOM = r'%(_python_)s mycompile.py rc $TARGET $SOURCES', RCCOMSTR = 'RCing $TARGET from $SOURCE') env.RES(target = 'aaa', source = 'aaa.rc') """ % locals()) @@ -64,8 +56,6 @@ RCing aaa.o from aaa.rc test.must_match('aaa.o', "aaa.rc\n") - - test.pass_test() # Local Variables: diff --git a/test/RANLIB/RANLIBCOM.py b/test/RANLIB/RANLIBCOM.py index 486a91f..6a3ea0f 100644 --- a/test/RANLIB/RANLIBCOM.py +++ b/test/RANLIB/RANLIBCOM.py @@ -39,31 +39,13 @@ ranlib = test.detect('RANLIB', 'ranlib') if not ranlib: test.skip_test("Could not find 'ranlib', skipping test.\n") - - -test.write('myar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -import sys -lines = open(sys.argv[1], 'rb').readlines() -outfile = open(sys.argv[1], 'wb') -for l in [l for l in lines if l != '/*ranlib*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') env.Library(target = 'output', source = ['file.1', 'file.2']) @@ -76,8 +58,6 @@ test.run(arguments = '.') test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/RANLIB/RANLIBCOMSTR.py b/test/RANLIB/RANLIBCOMSTR.py index 6e76cbf..2b8fc83 100644 --- a/test/RANLIB/RANLIBCOMSTR.py +++ b/test/RANLIB/RANLIBCOMSTR.py @@ -42,29 +42,13 @@ if not ranlib: -test.write('myar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*ar*/\\n']: - outfile.write(l) -sys.exit(0) -""") - -test.write('myranlib.py', """ -import sys -lines = open(sys.argv[1], 'rb').readlines() -outfile = open(sys.argv[1], 'wb') -for l in [l for l in lines if l != '/*ranlib*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') +test.file_fixture('myrewrite.py') test.write('SConstruct', """ env = Environment(tools=['default', 'ar'], - ARCOM = r'%(_python_)s myar.py $TARGET $SOURCES', - RANLIBCOM = r'%(_python_)s myranlib.py $TARGET', + ARCOM = r'%(_python_)s mycompile.py ar $TARGET $SOURCES', + RANLIBCOM = r'%(_python_)s myrewrite.py ranlib $TARGET', RANLIBCOMSTR = 'Indexing $TARGET', LIBPREFIX = '', LIBSUFFIX = '.lib') @@ -75,7 +59,7 @@ test.write('file.1', "file.1\n/*ar*/\n/*ranlib*/\n") test.write('file.2', "file.2\n/*ar*/\n/*ranlib*/\n") expect = test.wrap_stdout("""\ -%(_python_)s myar.py output.lib file.1 file.2 +%(_python_)s mycompile.py ar output.lib file.1 file.2 Indexing output.lib """ % locals()) @@ -83,8 +67,6 @@ test.run(stdout = expect) test.must_match('output.lib', "file.1\nfile.2\n") - - test.pass_test() # Local Variables: diff --git a/test/SWIG/SWIGCOM.py b/test/SWIG/SWIGCOM.py index ee3ff64..b2d8da2 100644 --- a/test/SWIG/SWIGCOM.py +++ b/test/SWIG/SWIGCOM.py @@ -34,21 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myswig.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*swig*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'swig'], - SWIGCOM = r'%(_python_)s myswig.py $TARGET $SOURCES') + SWIGCOM = r'%(_python_)s mycompile.py swig $TARGET $SOURCES') env.CFile(target = 'aaa', source = 'aaa.i') env.CXXFile(target = 'bbb', source = 'bbb.i', SWIGFLAGS='-c++') """ % locals()) @@ -61,8 +51,6 @@ test.run(arguments = '.') test.must_match('aaa_wrap.c', "aaa.i\n") test.must_match('bbb_wrap.cc', "bbb.i\n") - - test.pass_test() # Local Variables: diff --git a/test/SWIG/SWIGCOMSTR.py b/test/SWIG/SWIGCOMSTR.py index 24db13e..c2c3df3 100644 --- a/test/SWIG/SWIGCOMSTR.py +++ b/test/SWIG/SWIGCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('myswig.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*swig*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'swig'], - SWIGCOM = r'%(_python_)s myswig.py $TARGET $SOURCES', + SWIGCOM = r'%(_python_)s mycompile.py swig $TARGET $SOURCES', SWIGCOMSTR = 'Swigging $TARGET from $SOURCE') env.CFile(target = 'aaa', source = 'aaa.i') env.CXXFile(target = 'bbb', source = 'bbb.i', SWIGFLAGS='-c++') @@ -66,8 +56,6 @@ Swigging bbb_wrap.cc from bbb.i test.must_match('aaa_wrap.c', "aaa.i\n") test.must_match('bbb_wrap.cc', "bbb.i\n") - - test.pass_test() # Local Variables: diff --git a/test/TAR/TARCOM.py b/test/TAR/TARCOM.py index d1b3662..aaf7b60 100644 --- a/test/TAR/TARCOM.py +++ b/test/TAR/TARCOM.py @@ -34,20 +34,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mytar.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*tar*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['tar'], - TARCOM = r'%(_python_)s mytar.py $TARGET $SOURCE') + TARCOM = r'%(_python_)s mycompile.py tar $TARGET $SOURCE') env.Tar('test1.tar', 'test1.in') """ % locals()) @@ -60,8 +51,6 @@ test.run() test.must_match('test1.tar', "test1.in\n") - - test.pass_test() # Local Variables: diff --git a/test/TAR/TARCOMSTR.py b/test/TAR/TARCOMSTR.py index 339f0ca..817dc59 100644 --- a/test/TAR/TARCOMSTR.py +++ b/test/TAR/TARCOMSTR.py @@ -35,21 +35,11 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() - - -test.write('mytar.py', """ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != '/*tar*/\\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['tar'], - TARCOM = r'%(_python_)s mytar.py $TARGET $SOURCES', + TARCOM = r'%(_python_)s mycompile.py tar $TARGET $SOURCES', TARCOMSTR = 'Taring $TARGET from $SOURCE') env.Tar('aaa.tar', 'aaa.in') """ % locals()) @@ -62,8 +52,6 @@ Taring aaa.tar from aaa.in test.must_match('aaa.tar', "aaa.in\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/LATEXCOM.py b/test/TEX/LATEXCOM.py index 2c63864..878d4cf 100644 --- a/test/TEX/LATEXCOM.py +++ b/test/TEX/LATEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $LATEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mylatex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['latex'], - LATEXCOM = r'%(_python_)s mylatex.py $TARGET $SOURCE') + LATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE') env.DVI('test1', 'test1.latex') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.dvi', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/LATEXCOMSTR.py b/test/TEX/LATEXCOMSTR.py index 4e1b93c..f8a377d 100644 --- a/test/TEX/LATEXCOMSTR.py +++ b/test/TEX/LATEXCOMSTR.py @@ -32,24 +32,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mylatex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['latex'], - LATEXCOM = r'%(_python_)s mylatex.py $TARGET $SOURCE', + LATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE', LATEXCOMSTR = 'Building $TARGET from $SOURCE') env.DVI('test1', 'test1.latex') """ % locals()) @@ -65,8 +55,6 @@ Building test1.dvi from test1.latex test.must_match('test1.dvi', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFLATEXCOM.py b/test/TEX/PDFLATEXCOM.py index 09283f3..c2b54ce 100644 --- a/test/TEX/PDFLATEXCOM.py +++ b/test/TEX/PDFLATEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $PDFLATEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdflatex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdflatex'], - PDFLATEXCOM = r'%(_python_)s mypdflatex.py $TARGET $SOURCE') + PDFLATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE') env.PDF('test1', 'test1.latex') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.pdf', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFLATEXCOMSTR.py b/test/TEX/PDFLATEXCOMSTR.py index c751e8e..1d911bd 100644 --- a/test/TEX/PDFLATEXCOMSTR.py +++ b/test/TEX/PDFLATEXCOMSTR.py @@ -33,24 +33,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdflatex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*latex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdflatex'], - PDFLATEXCOM = r'%(_python_)s mypdflatex.py $TARGET $SOURCE', + PDFLATEXCOM = r'%(_python_)s mycompile.py latex $TARGET $SOURCE', PDFLATEXCOMSTR = 'Building $TARGET from $SOURCE') env.PDF('test1', 'test1.latex') """ % locals()) @@ -66,8 +56,6 @@ Building test1.pdf from test1.latex test.must_match('test1.pdf', "test1.latex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFTEXCOM.py b/test/TEX/PDFTEXCOM.py index 8c31da3..6e915a4 100644 --- a/test/TEX/PDFTEXCOM.py +++ b/test/TEX/PDFTEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $PDFTEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdftex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdftex'], - PDFTEXCOM = r'%(_python_)s mypdftex.py $TARGET $SOURCE') + PDFTEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE') env.PDF('test1') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.pdf', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/PDFTEXCOMSTR.py b/test/TEX/PDFTEXCOMSTR.py index 13abe7a..7ee5b41 100644 --- a/test/TEX/PDFTEXCOMSTR.py +++ b/test/TEX/PDFTEXCOMSTR.py @@ -33,24 +33,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mypdftex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['pdftex'], - PDFTEXCOM = r'%(_python_)s mypdftex.py $TARGET $SOURCE', + PDFTEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE', PDFTEXCOMSTR = 'Building $TARGET from $SOURCE') env.PDF('test1') """ % locals()) @@ -66,8 +56,6 @@ Building test1.pdf from test1.tex test.must_match('test1.pdf', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/TEXCOM.py b/test/TEX/TEXCOM.py index 1cadd63..9d820bc 100644 --- a/test/TEX/TEXCOM.py +++ b/test/TEX/TEXCOM.py @@ -31,24 +31,14 @@ Test the ability to configure the $TEXCOM construction variable. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mytex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['tex'], - TEXCOM = r'%(_python_)s mytex.py $TARGET $SOURCE') + TEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE') env.DVI('test1') """ % locals()) @@ -61,8 +51,6 @@ test.run() test.must_match('test1.dvi', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/TEXCOMSTR.py b/test/TEX/TEXCOMSTR.py index f1ead7f..0facc6f 100644 --- a/test/TEX/TEXCOMSTR.py +++ b/test/TEX/TEXCOMSTR.py @@ -32,24 +32,14 @@ the C compilation output. import TestSCons _python_ = TestSCons._python_ -_exe = TestSCons._exe test = TestSCons.TestSCons() - - -test.write('mytex.py', r""" -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != '/*tex*/\n']: - outfile.write(l) -sys.exit(0) -""") +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['tex'], - TEXCOM = r'%(_python_)s mytex.py $TARGET $SOURCE', + TEXCOM = r'%(_python_)s mycompile.py tex $TARGET $SOURCE', TEXCOMSTR = 'Building $TARGET from $SOURCE') env.DVI('test1') """ % locals()) @@ -65,8 +55,6 @@ Building test1.dvi from test1.tex test.must_match('test1.dvi', "test1.tex\n") - - test.pass_test() # Local Variables: diff --git a/test/TEX/recursive_scanner_dependencies_import.py b/test/TEX/recursive_scanner_dependencies_import.py new file mode 100644 index 0000000..d9d2625 --- /dev/null +++ b/test/TEX/recursive_scanner_dependencies_import.py @@ -0,0 +1,122 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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 we re-run LaTeX after changing a nested \import. This +checks that recursive implicit dependencies are found correctly. + +This is a separate test from the +recursive_scanner_dependencies_input.py test because \input and +\include are handled specially by the PDF builder, whereas \import +dependencies are found only by the scanner. + +""" + +import TestSCons + +test = TestSCons.TestSCons() + +pdflatex = test.where_is('pdflatex') + +if not pdflatex: + test.skip_test("Could not find pdflatex; skipping test(s).\n") + +test.subdir('subdir') +test.subdir('subdir/subdir2') + +test.write(['SConstruct'], """\ +env = Environment(tools=['pdftex', 'tex']) +env.PDF('master.tex') +""") + +test.write(['master.tex'], r""" +\documentclass{article} +\usepackage{import} +\begin{document} +\subinputfrom{subdir/}{sub1} +\end{document} +""") + +test.write(['subdir', 'sub1.tex'], r""" +\subinputfrom{subdir2/}{sub2} +""") + +test.write(['subdir', 'subdir2', 'sub2.tex'], r""" +Sub-document 2 content +""") + +test.run() + +pdf_output_1 = test.read('master.pdf') + +# Change sub2.tex, see if master.pdf is changed +test.write(['subdir', 'subdir2', 'sub2.tex'], r""" +Sub-document 2 content -- updated +""") + +test.run() + +pdf_output_2 = test.read('master.pdf') + +# If the PDF file is the same as it was previously, then it didn't +# pick up the change in sub2.tex, so fail. +test.fail_test(pdf_output_1 == pdf_output_2) + +# Double-check: clean everything and rebuild from scratch, which +# should force the PDF file to be the 1982 version. + +test.run(arguments='-c') +test.run() + +pdf_output_3 = test.read('master.pdf') + +# If the PDF file is now different than the second run, modulo the +# creation timestamp and the ID and some other PDF garp, then something +# else odd has happened, so fail. + +pdf_output_2 = test.normalize_pdf(pdf_output_2) +pdf_output_3 = test.normalize_pdf(pdf_output_3) + +if pdf_output_2 != pdf_output_3: + import sys + test.write('master.normalized.2.pdf', pdf_output_2) + test.write('master.normalized.3.pdf', pdf_output_3) + sys.stdout.write("***** 2 and 3 are different!\n") + sys.stdout.write(test.diff_substr(pdf_output_2, pdf_output_3, 80, 80) + + '\n') + sys.stdout.write("Output from run 2:\n") + sys.stdout.write(test.stdout(-2) + '\n') + sys.stdout.write("Output from run 3:\n") + sys.stdout.write(test.stdout() + '\n') + sys.stdout.flush() + test.fail_test() + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/TEX/recursive_scanner_dependencies_input.py b/test/TEX/recursive_scanner_dependencies_input.py new file mode 100644 index 0000000..257051e --- /dev/null +++ b/test/TEX/recursive_scanner_dependencies_input.py @@ -0,0 +1,112 @@ +#!/usr/bin/env python +# +# __COPYRIGHT__ +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# 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 we re-run LaTeX after changing a nested \input. This +checks that recursive implicit dependencies are found correctly. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +pdflatex = test.where_is('pdflatex') + +if not pdflatex: + test.skip_test("Could not find pdflatex; skipping test(s).\n") + +test.write(['SConstruct'], """\ +env = Environment(tools=['pdftex', 'tex']) +env.PDF('master.tex') +""") + +test.write(['master.tex'], r""" +\documentclass{article} +\begin{document} +\input{sub1} +\end{document} +""") + +test.write(['sub1.tex'], r""" +\input{sub2} +""") + +test.write(['sub2.tex'], r""" +Sub-document 2 content +""") + +test.run() + +pdf_output_1 = test.read('master.pdf') + +# Change sub2.tex, see if master.pdf is changed +test.write(['sub2.tex'], r""" +Sub-document 2 content -- updated +""") + +test.run() + +pdf_output_2 = test.read('master.pdf') + +# If the PDF file is the same as it was previously, then it didn't +# pick up the change in sub2.tex, so fail. +test.fail_test(pdf_output_1 == pdf_output_2) + +# Double-check: clean everything and rebuild from scratch, which +# should force the PDF file to be the 1982 version. + +test.run(arguments='-c') +test.run() + +pdf_output_3 = test.read('master.pdf') + +# If the PDF file is now different than the second run, modulo the +# creation timestamp and the ID and some other PDF garp, then something +# else odd has happened, so fail. + +pdf_output_2 = test.normalize_pdf(pdf_output_2) +pdf_output_3 = test.normalize_pdf(pdf_output_3) + +if pdf_output_2 != pdf_output_3: + import sys + test.write('master.normalized.2.pdf', pdf_output_2) + test.write('master.normalized.3.pdf', pdf_output_3) + sys.stdout.write("***** 2 and 3 are different!\n") + sys.stdout.write(test.diff_substr(pdf_output_2, pdf_output_3, 80, 80) + + '\n') + sys.stdout.write("Output from run 2:\n") + sys.stdout.write(test.stdout(-2) + '\n') + sys.stdout.write("Output from run 3:\n") + sys.stdout.write(test.stdout() + '\n') + sys.stdout.flush() + test.fail_test() + +test.pass_test() + +# Local Variables: +# tab-width:4 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/test/YACC/YACCCOM-fixture/.exclude_tests b/test/YACC/YACCCOM-fixture/.exclude_tests deleted file mode 100644 index f12c4d0..0000000 --- a/test/YACC/YACCCOM-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myyacc.py diff --git a/test/YACC/YACCCOM-fixture/myyacc.py b/test/YACC/YACCCOM-fixture/myyacc.py deleted file mode 100644 index 1502800..0000000 --- a/test/YACC/YACCCOM-fixture/myyacc.py +++ /dev/null @@ -1,7 +0,0 @@ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*yacc*/\n']: - outfile.write(l) -sys.exit(0) diff --git a/test/YACC/YACCCOM.py b/test/YACC/YACCCOM.py index 70ffa72..e9fb47f 100644 --- a/test/YACC/YACCCOM.py +++ b/test/YACC/YACCCOM.py @@ -34,23 +34,23 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') -test.dir_fixture('YACCCOM-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'yacc'], - YACCCOM = r'%(_python_)s myyacc.py $TARGET $SOURCES') + YACCCOM = r'%(_python_)s mycompile.py yacc $TARGET $SOURCES') env.CFile(target = 'aaa', source = 'aaa.y') env.CFile(target = 'bbb', source = 'bbb.yacc') """ % locals()) +test.write('aaa.y', 'aaa.y\n/*yacc*/\n') +test.write('bbb.yacc', 'bbb.yacc\n/*yacc*/\n') + test.run(arguments = '.') test.must_match('aaa.c', "aaa.y\n") test.must_match('bbb.c', "bbb.yacc\n") - - test.pass_test() # Local Variables: diff --git a/test/YACC/YACCCOMSTR.py b/test/YACC/YACCCOMSTR.py index 344b715..bded560 100644 --- a/test/YACC/YACCCOMSTR.py +++ b/test/YACC/YACCCOMSTR.py @@ -35,17 +35,19 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('shared-fixture') -test.dir_fixture('YACCCOM-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['default', 'yacc'], - YACCCOM = r'%(_python_)s myyacc.py $TARGET $SOURCES', + YACCCOM = r'%(_python_)s mycompile.py yacc $TARGET $SOURCES', YACCCOMSTR = 'Yaccing $TARGET from $SOURCE') env.CFile(target = 'aaa', source = 'aaa.y') env.CFile(target = 'bbb', source = 'bbb.yacc') """ % locals()) +test.write('aaa.y', 'aaa.y\n/*yacc*/\n') +test.write('bbb.yacc', 'bbb.yacc\n/*yacc*/\n') + test.run(stdout = test.wrap_stdout("""\ Yaccing aaa.c from aaa.y Yaccing bbb.c from bbb.yacc @@ -54,8 +56,6 @@ Yaccing bbb.c from bbb.yacc test.must_match('aaa.c', "aaa.y\n") test.must_match('bbb.c', "bbb.yacc\n") - - test.pass_test() # Local Variables: diff --git a/test/YACC/shared-fixture/.exclude_tests b/test/YACC/shared-fixture/.exclude_tests deleted file mode 100644 index f12c4d0..0000000 --- a/test/YACC/shared-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myyacc.py diff --git a/test/YACC/shared-fixture/aaa.y b/test/YACC/shared-fixture/aaa.y deleted file mode 100644 index f7f4cc7..0000000 --- a/test/YACC/shared-fixture/aaa.y +++ /dev/null @@ -1,2 +0,0 @@ -aaa.y -/*yacc*/ diff --git a/test/YACC/shared-fixture/bbb.yacc b/test/YACC/shared-fixture/bbb.yacc deleted file mode 100644 index b3c856f..0000000 --- a/test/YACC/shared-fixture/bbb.yacc +++ /dev/null @@ -1,2 +0,0 @@ -bbb.yacc -/*yacc*/ diff --git a/test/ZIP/ZIPCOM-fixture/.exclude_tests b/test/ZIP/ZIPCOM-fixture/.exclude_tests deleted file mode 100644 index dae6f60..0000000 --- a/test/ZIP/ZIPCOM-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myzip.py diff --git a/test/ZIP/ZIPCOM-fixture/myzip.py b/test/ZIP/ZIPCOM-fixture/myzip.py deleted file mode 100644 index adbc6ac..0000000 --- a/test/ZIP/ZIPCOM-fixture/myzip.py +++ /dev/null @@ -1,6 +0,0 @@ -import sys -outfile = open(sys.argv[1], 'wb') -infile = open(sys.argv[2], 'rb') -for l in [l for l in infile.readlines() if l != b'/*zip*/\n']: - outfile.write(l) -sys.exit(0) diff --git a/test/ZIP/ZIPCOM-fixture/test1.in b/test/ZIP/ZIPCOM-fixture/test1.in deleted file mode 100644 index 0546626..0000000 --- a/test/ZIP/ZIPCOM-fixture/test1.in +++ /dev/null @@ -1,2 +0,0 @@ -test1.in -/*zip*/ diff --git a/test/ZIP/ZIPCOM.py b/test/ZIP/ZIPCOM.py index 4d84ccf..c6c1412 100644 --- a/test/ZIP/ZIPCOM.py +++ b/test/ZIP/ZIPCOM.py @@ -34,14 +34,16 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('ZIPCOM-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(TOOLS = ['zip'], - ZIPCOM = r'%(_python_)s myzip.py $TARGET $SOURCE') + ZIPCOM = r'%(_python_)s mycompile.py zip $TARGET $SOURCE') env.Zip('test1.zip', 'test1.in') """ % locals()) +test.write('test1.in', 'test1.in\n/*zip*/\n') + test.run() test.must_match('test1.zip', "test1.in\n") diff --git a/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests b/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests deleted file mode 100644 index dae6f60..0000000 --- a/test/ZIP/ZIPCOMSTR-fixture/.exclude_tests +++ /dev/null @@ -1 +0,0 @@ -myzip.py diff --git a/test/ZIP/ZIPCOMSTR-fixture/aaa.in b/test/ZIP/ZIPCOMSTR-fixture/aaa.in deleted file mode 100644 index 8474a29..0000000 --- a/test/ZIP/ZIPCOMSTR-fixture/aaa.in +++ /dev/null @@ -1,2 +0,0 @@ -aaa.in -/*zip*/ diff --git a/test/ZIP/ZIPCOMSTR-fixture/myzip.py b/test/ZIP/ZIPCOMSTR-fixture/myzip.py deleted file mode 100644 index f0fcc51..0000000 --- a/test/ZIP/ZIPCOMSTR-fixture/myzip.py +++ /dev/null @@ -1,7 +0,0 @@ -import sys -outfile = open(sys.argv[1], 'wb') -for f in sys.argv[2:]: - infile = open(f, 'rb') - for l in [l for l in infile.readlines() if l != b'/*zip*/\n']: - outfile.write(l) -sys.exit(0) diff --git a/test/ZIP/ZIPCOMSTR.py b/test/ZIP/ZIPCOMSTR.py index a26ed49..af9ba57 100644 --- a/test/ZIP/ZIPCOMSTR.py +++ b/test/ZIP/ZIPCOMSTR.py @@ -35,15 +35,17 @@ _python_ = TestSCons._python_ test = TestSCons.TestSCons() -test.dir_fixture('ZIPCOMSTR-fixture') +test.file_fixture('mycompile.py') test.write('SConstruct', """ env = Environment(tools=['zip'], - ZIPCOM = r'%(_python_)s myzip.py $TARGET $SOURCES', + ZIPCOM = r'%(_python_)s mycompile.py zip $TARGET $SOURCES', ZIPCOMSTR = 'Zipping $TARGET from $SOURCE') env.Zip('aaa.zip', 'aaa.in') """ % locals()) +test.write('aaa.in', 'aaa.in\n/*zip*/\n') + test.run(stdout = test.wrap_stdout("""\ Zipping aaa.zip from aaa.in """)) diff --git a/test/fixture/mycompile.py b/test/fixture/mycompile.py new file mode 100644 index 0000000..555c2c8 --- /dev/null +++ b/test/fixture/mycompile.py @@ -0,0 +1,8 @@ +import sys +line = ('/*' + sys.argv[1] + '*/\n').encode() +outfile = open(sys.argv[2], 'wb') +for f in sys.argv[3:]: + infile = open(f, 'rb') + for l in [l for l in infile.readlines() if l != line]: + outfile.write(l) +sys.exit(0) diff --git a/test/fixture/myrewrite.py b/test/fixture/myrewrite.py new file mode 100644 index 0000000..40bf830 --- /dev/null +++ b/test/fixture/myrewrite.py @@ -0,0 +1,7 @@ +import sys +line = ('/*' + sys.argv[1] + '*/\n').encode() +lines = open(sys.argv[2], 'rb').readlines() +outfile = open(sys.argv[2], 'wb') +for l in [l for l in lines if l != line]: + outfile.write(l) +sys.exit(0) |