diff options
author | Steven Knight <knight@baldmt.com> | 2003-04-10 05:35:38 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2003-04-10 05:35:38 (GMT) |
commit | 2f8be7360679ad5e0260f4965ea5dd9506c7b033 (patch) | |
tree | 1379c046e82985011c5ab2d7604adf055e3140b9 | |
parent | 81e5793a07783b29a13004f834b7579a0e1605bb (diff) | |
download | SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.zip SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.tar.gz SCons-2f8be7360679ad5e0260f4965ea5dd9506c7b033.tar.bz2 |
Implement Tool refactoring. (Chad Austin + Steve Leblanc)
62 files changed, 161 insertions, 81 deletions
diff --git a/doc/man/scons.1 b/doc/man/scons.1 index 75e83d1..a3f35af 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -844,12 +844,15 @@ will call the specified elements to update the new construction environment: .ES -def my_tool(env, platform): +def my_tool(env): env['XYZZY'] = 'xyzzy' env = Environment(tools = [my_tool]) .EE +The tool definition (i.e. my_tool()) can use the PLATFORM variable from +the environment it receives to customize the tool for different platforms. + If no tool list is specified, then SCons will auto-detect the installed tools using the PATH variable in the ENV construction variable and the platform name when the Environment is constructed. Changing the PATH @@ -2555,6 +2558,20 @@ The prefix used for PDF file names. .IP PDFSUFFIX The suffix used for PDF file names. +.IP PLATFORM +The name of the platform used to create the Environment. If no platform is +specified when the Environment is created, +.B SCons +autodetects the platform. + +.ES +env = Environment(tools = []) +if env['PLATFORM'] == 'cygwin': + Tool('mingw')(env) +else: + Tool('msvc')(env) +.EE + .IP PROGPREFIX The prefix used for executable file names. diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 5e0067b..1c01d1b 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -14,6 +14,10 @@ RELEASE 0.14 - XXX - Use .dll (not .so) for shared libraries on Cygwin. + - Add a PLATFORM variable to construction environments. + + - Remove the "platform" argument from tool specifications. + From Steven Knight: - Add support for Java (javac and jar). diff --git a/src/RELEASE.txt b/src/RELEASE.txt index e023518..493ed00 100644 --- a/src/RELEASE.txt +++ b/src/RELEASE.txt @@ -27,7 +27,8 @@ RELEASE 0.14 - XXX Please note the following important changes since release 0.13: - - + - Tool specifications no longer take a "platform" argument. + XXX Please note the following important changes since release 0.11: diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 37182c4..e3d29eb 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -191,6 +191,7 @@ class Environment: if SCons.Util.is_String(platform): platform = SCons.Platform.Platform(platform) + self._dict['PLATFORM'] = str(platform) platform(self) # Apply the passed-in variables before calling the tools, @@ -207,7 +208,7 @@ class Environment: for tool in tools: if SCons.Util.is_String(tool): tool = SCons.Tool.Tool(tool) - tool(self, platform) + tool(self) # Reapply the passed in variables after calling the tools, # since they should overide anything set by the tools: diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 9a6eb1c..c041755 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -735,23 +735,34 @@ class EnvironmentTestCase(unittest.TestCase): def test_platform(self): """Test specifying a platform callable when instantiating.""" - def p(env): - env['XYZZY'] = 777 - env = Environment(platform = p) + class platform: + def __str__(self): return "TestPlatform" + def __call__(self, env): env['XYZZY'] = 777 + + def tool(env): + assert env['PLATFORM'] == "TestPlatform" + + env = Environment(platform = platform(), tools = [tool]) assert env['XYZZY'] == 777, env + assert env['PLATFORM'] == "TestPlatform" def test_tools(self): """Test specifying a tool callable when instantiating.""" - def t1(env, platform): + def t1(env): env['TOOL1'] = 111 - def t2(env, platform): + def t2(env): env['TOOL2'] = 222 - def t3(env, platform): + def t3(env): env['AAA'] = env['XYZ'] + def t4(env): + env['TOOL4'] = 444 env = Environment(tools = [t1, t2, t3], XYZ = 'aaa') assert env['TOOL1'] == 111, env['TOOL1'] assert env['TOOL2'] == 222, env - assert env['AAA'] == 'aaa', env + assert env['AAA'] == 'aaa', env + t4(env) + assert env['TOOL4'] == 444, env + def test_get(self): """Test the get() method.""" diff --git a/src/engine/SCons/Tool/386asm.py b/src/engine/SCons/Tool/386asm.py index c07f856..5a2340b 100644 --- a/src/engine/SCons/Tool/386asm.py +++ b/src/engine/SCons/Tool/386asm.py @@ -51,7 +51,7 @@ if os.path.normcase('.s') == os.path.normcase('.S'): else: ASPPSuffixes.extend(['.S']) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ar to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/BitKeeper.py b/src/engine/SCons/Tool/BitKeeper.py index 6d81eb0..3208b67 100644 --- a/src/engine/SCons/Tool/BitKeeper.py +++ b/src/engine/SCons/Tool/BitKeeper.py @@ -38,7 +38,7 @@ import os.path import SCons.Builder -def generate(env, platform): +def generate(env): """Add a Builder factory function and construction variables for BitKeeper to an Environment.""" diff --git a/src/engine/SCons/Tool/CVS.py b/src/engine/SCons/Tool/CVS.py index 9c5dc60..f16376b 100644 --- a/src/engine/SCons/Tool/CVS.py +++ b/src/engine/SCons/Tool/CVS.py @@ -37,7 +37,7 @@ import os.path import SCons.Builder -def generate(env, platform): +def generate(env): """Add a Builder factory function and construction variables for CVS to an Environment.""" diff --git a/src/engine/SCons/Tool/Perforce.py b/src/engine/SCons/Tool/Perforce.py index 2f9fb88..3c574b4 100644 --- a/src/engine/SCons/Tool/Perforce.py +++ b/src/engine/SCons/Tool/Perforce.py @@ -46,7 +46,7 @@ from SCons.Tool.PharLapCommon import addPathIfNotExists _import_env = [ 'P4PORT', 'P4CLIENT', 'P4USER', 'USER', 'USERNAME', 'P4PASSWD', 'P4CHARSET', 'P4LANGUAGE', 'SYSTEMROOT' ] -def generate(env, platform): +def generate(env): """Add a Builder factory function and construction variables for Perforce to an Environment.""" diff --git a/src/engine/SCons/Tool/RCS.py b/src/engine/SCons/Tool/RCS.py index 2a7e9e4..3b9547c 100644 --- a/src/engine/SCons/Tool/RCS.py +++ b/src/engine/SCons/Tool/RCS.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Builder -def generate(env, platform): +def generate(env): """Add a Builder factory function and construction variables for RCS to an Environment.""" diff --git a/src/engine/SCons/Tool/SCCS.py b/src/engine/SCons/Tool/SCCS.py index b559fea..b75d676 100644 --- a/src/engine/SCons/Tool/SCCS.py +++ b/src/engine/SCons/Tool/SCCS.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Builder -def generate(env, platform): +def generate(env): """Add a Builder factory function and construction variables for SCCS to an Environment.""" diff --git a/src/engine/SCons/Tool/Subversion.py b/src/engine/SCons/Tool/Subversion.py index 195af39..56569f3 100644 --- a/src/engine/SCons/Tool/Subversion.py +++ b/src/engine/SCons/Tool/Subversion.py @@ -37,7 +37,7 @@ import os.path import SCons.Builder -def generate(env, platform): +def generate(env): """Add a Builder factory function and construction variables for Subversion to an Environment.""" diff --git a/src/engine/SCons/Tool/ToolTests.py b/src/engine/SCons/Tool/ToolTests.py index 53922b0..72aab35 100644 --- a/src/engine/SCons/Tool/ToolTests.py +++ b/src/engine/SCons/Tool/ToolTests.py @@ -47,7 +47,7 @@ class ToolTestCase(unittest.TestCase): env['BUILDERS'] = {} env['ENV'] = {} t = SCons.Tool.Tool('g++') - t(env, 'foo') + t(env) assert (env['CXX'] == 'c++' or env['CXX'] == 'g++'), env['CXX'] assert env['CXXFLAGS'] == '$CCFLAGS', env['CXXFLAGS'] assert env['INCPREFIX'] == '-I', env['INCPREFIX'] diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py index ca28471..9e6d450 100644 --- a/src/engine/SCons/Tool/__init__.py +++ b/src/engine/SCons/Tool/__init__.py @@ -51,7 +51,7 @@ class ToolSpec: def __str__(self): return self.name -def Tool(name, platform = None): +def Tool(name): """Select a canned Tool specification. """ full_name = 'SCons.Tool.' + name diff --git a/src/engine/SCons/Tool/ar.py b/src/engine/SCons/Tool/ar.py index 4671309..d0ecb9b 100644 --- a/src/engine/SCons/Tool/ar.py +++ b/src/engine/SCons/Tool/ar.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ar to an Environment.""" bld = SCons.Defaults.StaticLibrary env['BUILDERS']['Library'] = bld diff --git a/src/engine/SCons/Tool/default.py b/src/engine/SCons/Tool/default.py index f334b68..fd77229 100644 --- a/src/engine/SCons/Tool/default.py +++ b/src/engine/SCons/Tool/default.py @@ -35,10 +35,10 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Tool -def generate(env, platform): +def generate(env): """Add default tools.""" - for t in SCons.Tool.tool_list(platform, env): - SCons.Tool.Tool(t, platform)(env, platform) + for t in SCons.Tool.tool_list(env['PLATFORM'], env): + SCons.Tool.Tool(t)(env) def exists(env): return 1 diff --git a/src/engine/SCons/Tool/dvipdf.py b/src/engine/SCons/Tool/dvipdf.py index e77bed7..3f4198f 100644 --- a/src/engine/SCons/Tool/dvipdf.py +++ b/src/engine/SCons/Tool/dvipdf.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for dvipdf to an Environment.""" try: bld = env['BUILDERS']['PDF'] diff --git a/src/engine/SCons/Tool/dvips.py b/src/engine/SCons/Tool/dvips.py index 4e668e5..f197b9b 100644 --- a/src/engine/SCons/Tool/dvips.py +++ b/src/engine/SCons/Tool/dvips.py @@ -42,7 +42,7 @@ PostScript = SCons.Builder.Builder(action = '$PSCOM', src_suffix = '.dvi', src_builder = 'DVI') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for dvips to an Environment.""" env['BUILDERS']['PostScript'] = PostScript diff --git a/src/engine/SCons/Tool/g++.py b/src/engine/SCons/Tool/g++.py index 877b605..c13f986 100644 --- a/src/engine/SCons/Tool/g++.py +++ b/src/engine/SCons/Tool/g++.py @@ -45,7 +45,7 @@ CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] if os.path.normcase('.c') != os.path.normcase('.C'): CXXSuffixes.append('.C') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for g++ to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/g77.py b/src/engine/SCons/Tool/g77.py index 3c50581..33fe76b 100644 --- a/src/engine/SCons/Tool/g77.py +++ b/src/engine/SCons/Tool/g77.py @@ -48,7 +48,7 @@ if os.path.normcase('.f') == os.path.normcase('.F'): else: F77PPSuffixes.append('.F') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for g77 to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/gas.py b/src/engine/SCons/Tool/gas.py index 08f0e5b..097624c 100644 --- a/src/engine/SCons/Tool/gas.py +++ b/src/engine/SCons/Tool/gas.py @@ -48,7 +48,7 @@ if os.path.normcase('.s') == os.path.normcase('.S'): else: ASPPSuffixes.extend(['.S']) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for as to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/gcc.py b/src/engine/SCons/Tool/gcc.py index 3321d91..5b6befa 100644 --- a/src/engine/SCons/Tool/gcc.py +++ b/src/engine/SCons/Tool/gcc.py @@ -45,7 +45,7 @@ CSuffixes = ['.c'] if os.path.normcase('.c') == os.path.normcase('.C'): CSuffixes.append('.C') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for gcc to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/gnulink.py b/src/engine/SCons/Tool/gnulink.py index 9f782c1..7e17370 100644 --- a/src/engine/SCons/Tool/gnulink.py +++ b/src/engine/SCons/Tool/gnulink.py @@ -38,7 +38,7 @@ import SCons.Util linkers = ['c++', 'cc', 'g++', 'gcc'] -def generate(env, platform): +def generate(env): """Add Builders and construction variables for gnulink to an Environment.""" env['BUILDERS']['SharedLibrary'] = SCons.Defaults.SharedLibrary env['BUILDERS']['Program'] = SCons.Defaults.Program diff --git a/src/engine/SCons/Tool/icc.py b/src/engine/SCons/Tool/icc.py index c10886b..490db6d 100644 --- a/src/engine/SCons/Tool/icc.py +++ b/src/engine/SCons/Tool/icc.py @@ -40,7 +40,7 @@ import SCons.Errors CSuffixes = ['.c', '.C'] CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] -def generate(env, platform): +def generate(env): """Add Builders and construction variables for MSVC++ to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/ifl.py b/src/engine/SCons/Tool/ifl.py index fbd1fbe..6e9f248 100644 --- a/src/engine/SCons/Tool/ifl.py +++ b/src/engine/SCons/Tool/ifl.py @@ -46,7 +46,7 @@ if os.path.normcase('.f') == os.path.normcase('.F'): else: F77PPSuffixes.append('.F') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ifl to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/ilink.py b/src/engine/SCons/Tool/ilink.py index 27713f2..388fb86 100644 --- a/src/engine/SCons/Tool/ilink.py +++ b/src/engine/SCons/Tool/ilink.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ilink to an Environment.""" env['BUILDERS']['Program'] = SCons.Defaults.Program diff --git a/src/engine/SCons/Tool/jar.py b/src/engine/SCons/Tool/jar.py index 496a823..b1164b5 100644 --- a/src/engine/SCons/Tool/jar.py +++ b/src/engine/SCons/Tool/jar.py @@ -38,7 +38,7 @@ import os.path import SCons.Builder -def generate(env, platform): +def generate(env): """Add Builders and construction variables for jar to an Environment.""" try: bld = env['BUILDERS']['Jar'] diff --git a/src/engine/SCons/Tool/javac.py b/src/engine/SCons/Tool/javac.py index 22145fc..e2d4ecb 100644 --- a/src/engine/SCons/Tool/javac.py +++ b/src/engine/SCons/Tool/javac.py @@ -133,7 +133,7 @@ elif java_parsing == 2: f.close() return pkg_dir, classes -def generate(env, platform): +def generate(env): """Add Builders and construction variables for javac to an Environment.""" def emit_java_files(target, source, env): """Create and return lists of source java files diff --git a/src/engine/SCons/Tool/latex.py b/src/engine/SCons/Tool/latex.py index 2326f9d..d9b912c 100644 --- a/src/engine/SCons/Tool/latex.py +++ b/src/engine/SCons/Tool/latex.py @@ -38,7 +38,7 @@ import SCons.Defaults LaTeXAction = SCons.Action.Action('$LATEXCOM') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for LaTeX to an Environment.""" try: diff --git a/src/engine/SCons/Tool/lex.py b/src/engine/SCons/Tool/lex.py index cd2eb7b..95a5315 100644 --- a/src/engine/SCons/Tool/lex.py +++ b/src/engine/SCons/Tool/lex.py @@ -36,7 +36,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults import SCons.Tool -def generate(env, platform): +def generate(env): """Add Builders and construction variables for lex to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) diff --git a/src/engine/SCons/Tool/linkloc.py b/src/engine/SCons/Tool/linkloc.py index d55a4ee..fc315d9 100644 --- a/src/engine/SCons/Tool/linkloc.py +++ b/src/engine/SCons/Tool/linkloc.py @@ -76,7 +76,7 @@ class LinklocGenerator: else: return "${TEMPFILE('" + self.cmdline + "')}" -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ar to an Environment.""" env['BUILDERS']['SharedLibrary'] = SCons.Defaults.SharedLibrary env['BUILDERS']['Program'] = SCons.Defaults.Program diff --git a/src/engine/SCons/Tool/masm.py b/src/engine/SCons/Tool/masm.py index 46f6c20..0284c1d 100644 --- a/src/engine/SCons/Tool/masm.py +++ b/src/engine/SCons/Tool/masm.py @@ -45,7 +45,7 @@ if os.path.normcase('.s') == os.path.normcase('.S'): else: ASPPSuffixes.extend(['.S']) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for masm to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py index 2d1c500..c89bc21 100644 --- a/src/engine/SCons/Tool/mingw.py +++ b/src/engine/SCons/Tool/mingw.py @@ -95,8 +95,7 @@ shlib_action = SCons.Action.CommandGenerator(shlib_generator) res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.o') -def generate(env, platform): - +def generate(env): mingw = find(env) if mingw: dir = os.path.dirname(mingw) @@ -114,7 +113,7 @@ def generate(env, platform): # Most of mingw is the same as gcc and friends... gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas'] for tool in gnu_tools: - SCons.Tool.Tool(tool, platform)(env,platform) + SCons.Tool.Tool(tool)(env) #... but a few things differ: env['CC'] = 'gcc' diff --git a/src/engine/SCons/Tool/mslib.py b/src/engine/SCons/Tool/mslib.py index 958218f..4180e05 100644 --- a/src/engine/SCons/Tool/mslib.py +++ b/src/engine/SCons/Tool/mslib.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for lib to an Environment.""" env['BUILDERS']['Library'] = SCons.Defaults.StaticLibrary env['BUILDERS']['StaticLibrary'] = SCons.Defaults.StaticLibrary diff --git a/src/engine/SCons/Tool/mslink.py b/src/engine/SCons/Tool/mslink.py index fa174e4..5522b0a 100644 --- a/src/engine/SCons/Tool/mslink.py +++ b/src/engine/SCons/Tool/mslink.py @@ -118,7 +118,7 @@ def prog_emitter(target, source, env): return (target,source) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ar to an Environment.""" env['BUILDERS']['SharedLibrary'] = SCons.Defaults.SharedLibrary env['BUILDERS']['Program'] = SCons.Defaults.Program diff --git a/src/engine/SCons/Tool/msvc.py b/src/engine/SCons/Tool/msvc.py index 70d43ad..eaaec3e 100644 --- a/src/engine/SCons/Tool/msvc.py +++ b/src/engine/SCons/Tool/msvc.py @@ -240,7 +240,7 @@ def object_emitter(target, source, env): pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter) res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for MSVC++ to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/nasm.py b/src/engine/SCons/Tool/nasm.py index 4c00872..1a9a8d5 100644 --- a/src/engine/SCons/Tool/nasm.py +++ b/src/engine/SCons/Tool/nasm.py @@ -45,7 +45,7 @@ if os.path.normcase('.s') == os.path.normcase('.S'): else: ASPPSuffixes.extend(['.S']) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for nasm to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/pdflatex.py b/src/engine/SCons/Tool/pdflatex.py index e96dc6f..1ae606e 100644 --- a/src/engine/SCons/Tool/pdflatex.py +++ b/src/engine/SCons/Tool/pdflatex.py @@ -38,7 +38,7 @@ import SCons.Defaults PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM') -def generate(env, platform): +def generate(env): """Add Builders and construction variables for pdflatex to an Environment.""" try: bld = env['BUILDERS']['PDF'] diff --git a/src/engine/SCons/Tool/pdftex.py b/src/engine/SCons/Tool/pdftex.py index 821ded6..14b3d95 100644 --- a/src/engine/SCons/Tool/pdftex.py +++ b/src/engine/SCons/Tool/pdftex.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for pdftex to an Environment.""" try: bld = env['BUILDERS']['PDF'] diff --git a/src/engine/SCons/Tool/sgiar.py b/src/engine/SCons/Tool/sgiar.py index 7869298..2722af6 100644 --- a/src/engine/SCons/Tool/sgiar.py +++ b/src/engine/SCons/Tool/sgiar.py @@ -37,7 +37,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for ar to an Environment.""" bld = SCons.Defaults.StaticLibrary env['BUILDERS']['Library'] = bld diff --git a/src/engine/SCons/Tool/sgias.py b/src/engine/SCons/Tool/sgias.py index fea4a6f..f258ab2 100644 --- a/src/engine/SCons/Tool/sgias.py +++ b/src/engine/SCons/Tool/sgias.py @@ -42,9 +42,9 @@ import SCons.Util assemblers = ['as'] ASSuffixes = ['.s', '.asm', '.ASM'] -ASPPSuffixes = ['.spp', '.SPP'] +ASPPSuffixes = ['.S', '.spp', '.SPP'] -def generate(env, platform): +def generate(env): """Add Builders and construction variables for as to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/sgicc.py b/src/engine/SCons/Tool/sgicc.py index d323303..92ce92b 100644 --- a/src/engine/SCons/Tool/sgicc.py +++ b/src/engine/SCons/Tool/sgicc.py @@ -40,9 +40,9 @@ import SCons.Defaults import SCons.Util CSuffixes = ['.c'] -CXXSuffixes = ['.C', '.cpp', '.cc', '.cxx'] +CXXSuffixes = ['.C', '.cpp', '.cc', '.cxx', '.c++', '.C++'] -def generate(env, platform): +def generate(env): """Add Builders and construction variables for gcc to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) diff --git a/src/engine/SCons/Tool/sgif77.py b/src/engine/SCons/Tool/sgif77.py index 5cb3b26..040e1d8 100644 --- a/src/engine/SCons/Tool/sgif77.py +++ b/src/engine/SCons/Tool/sgif77.py @@ -41,10 +41,10 @@ import SCons.Util compilers = ['f77'] -F77Suffixes = ['.f', '.for', '.F', '.FOR'] -F77PPSuffixes = ['.fpp', '.FPP'] +F77Suffixes = ['.f', '.for', '.FOR'] +F77PPSuffixes = ['.F', '.fpp', '.FPP'] -def generate(env, platform): +def generate(env): """Add Builders and construction variables for g77 to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) @@ -61,7 +61,7 @@ def generate(env, platform): env['F77COM'] = '$F77 $F77FLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' env['F77PPCOM'] = '$F77 $F77FLAGS $CPPFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' env['SHF77'] = '$F77' - env['SHF77FLAGS'] = '$F77FLAGS -fPIC' + env['SHF77FLAGS'] = '$F77FLAGS' env['SHF77COM'] = '$SHF77 $SHF77FLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' env['SHF77PPCOM'] = '$SHF77 $SHF77FLAGS $CPPFLAGS $_F77INCFLAGS -c -o $TARGET $SOURCES' diff --git a/src/engine/SCons/Tool/sgilink.py b/src/engine/SCons/Tool/sgilink.py index 8304bb6..f1b6a06 100644 --- a/src/engine/SCons/Tool/sgilink.py +++ b/src/engine/SCons/Tool/sgilink.py @@ -38,7 +38,7 @@ import SCons.Util linkers = ['CC', 'cc'] -def generate(env, platform): +def generate(env): """Add Builders and construction variables for MIPSPro to an Environment.""" env['BUILDERS']['SharedLibrary'] = SCons.Defaults.SharedLibrary env['BUILDERS']['Program'] = SCons.Defaults.Program diff --git a/src/engine/SCons/Tool/tar.py b/src/engine/SCons/Tool/tar.py index 6692d57..011f48b 100644 --- a/src/engine/SCons/Tool/tar.py +++ b/src/engine/SCons/Tool/tar.py @@ -45,7 +45,7 @@ TarBuilder = SCons.Builder.Builder(action = '$TARCOM', multi = 1) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for tar to an Environment.""" try: bld = env['BUILDERS']['Tar'] diff --git a/src/engine/SCons/Tool/tex.py b/src/engine/SCons/Tool/tex.py index 398b841..c3d38f1 100644 --- a/src/engine/SCons/Tool/tex.py +++ b/src/engine/SCons/Tool/tex.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Defaults -def generate(env, platform): +def generate(env): """Add Builders and construction variables for TeX to an Environment.""" try: bld = env['BUILDERS']['DVI'] diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py index 5322904..0c80cf8 100644 --- a/src/engine/SCons/Tool/yacc.py +++ b/src/engine/SCons/Tool/yacc.py @@ -35,7 +35,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import SCons.Tool -def generate(env, platform): +def generate(env): """Add Builders and construction variables for yacc to an Environment.""" c_file, cxx_file = SCons.Tool.createCFileBuilders(env) diff --git a/src/engine/SCons/Tool/zip.py b/src/engine/SCons/Tool/zip.py index f4a8a28..4404247 100644 --- a/src/engine/SCons/Tool/zip.py +++ b/src/engine/SCons/Tool/zip.py @@ -71,7 +71,7 @@ ZipBuilder = SCons.Builder.Builder(action = '$ZIPCOM', multi = 1) -def generate(env, platform): +def generate(env): """Add Builders and construction variables for zip to an Environment.""" try: bld = env['BUILDERS']['Zip'] @@ -112,6 +112,7 @@ sys.exit(0) test.write('SConstruct', """ env = Environment(LINK = r'%s mylink.py', + LINKFLAGS = [], AS = r'%s myas.py', CC = r'%s myas.py') env.Program(target = 'test1', source = 'test1.s') @@ -168,8 +169,9 @@ test.fail_test(test.read('test6' + _exe) != "This is a .SPP file.\n") as = test.detect('AS', 'as') +x86 = (sys.platform == 'win32' or string.find(sys.platform, 'linux') != -1) -if as: +if as and x86: test.write("wrapper.py", """import os @@ -248,7 +250,7 @@ main(int argc, char *argv[]) ml = test.where_is('ml') -if ml: +if ml and sys.platform == 'win32': test.write("wrapper.py", """import os diff --git a/test/ASFLAGS.py b/test/ASFLAGS.py index 229a27a..0331aed 100644 --- a/test/ASFLAGS.py +++ b/test/ASFLAGS.py @@ -130,6 +130,7 @@ sys.exit(0) test.write('SConstruct', """ env = Environment(LINK = r'%s mylink.py', + LINKFLAGS = [], AS = r'%s myas.py', ASFLAGS = '-x', CC = r'%s myas.py') env.Program(target = 'test1', source = 'test1.s') diff --git a/test/BuildDir.py b/test/BuildDir.py index c7c8dd4..f0e889a 100644 --- a/test/BuildDir.py +++ b/test/BuildDir.py @@ -25,6 +25,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os.path +import string import sys import time import TestSCons @@ -97,7 +98,12 @@ SConscript(File('SConscript', var4), "env") env = Environment(CPPPATH='.', F77PATH='.') SConscript('../build/var5/SConscript', "env") SConscript('../build/var6/SConscript', "env") -""") +""") + +if string.find(sys.platform, 'irix') != -1: + fortran_runtime = 'ftn' +else: + fortran_runtime = 'g2c' test.subdir(['test', 'src']) test.write(['test', 'src', 'SConscript'], """ @@ -132,9 +138,9 @@ except: if f77 and WhereIs(env['F77']): env.Command(target='b2.f', source='b2.in', action=buildIt) - env.Copy(LIBS = ['g2c']).Program(target='bar2', source='b2.f') - env.Copy(LIBS = ['g2c']).Program(target='bar1', source='b1.f') -""") + env.Copy(LIBS = [r'%s']).Program(target='bar2', source='b2.f') + env.Copy(LIBS = [r'%s']).Program(target='bar1', source='b1.f') +""" % (fortran_runtime, fortran_runtime)) test.write('test/src/f1.c', r""" #include "f1.h" @@ -113,8 +113,10 @@ sys.exit(0) test.write('SConstruct', """ cc = Environment().Dictionary('CC') env = Environment(LINK = r'%s mylink.py', + LINKFLAGS = [], CC = r'%s mycc.py', - CXX = cc) + CXX = cc, + CXXFLAGS = []) env.Program(target = 'test1', source = 'test1.c') """ % (python, python)) diff --git a/test/CPPFLAGS.py b/test/CPPFLAGS.py index da4ff13..352ed7d 100644 --- a/test/CPPFLAGS.py +++ b/test/CPPFLAGS.py @@ -34,9 +34,11 @@ python = TestSCons.python if sys.platform == 'win32': _exe = '.exe' _obj = '.obj' + _shobj = '.obj' else: _exe = '' _obj = '.o' + _shobj = '.os' test = TestSCons.TestSCons() @@ -107,8 +109,10 @@ sys.exit(0) test.write('SConstruct', """ env = Environment(CPPFLAGS = '-x', LINK = r'%s mylink.py', + LINKFLAGS = [], CC = r'%s mygcc.py cc', CXX = r'%s mygcc.py c++', + CXXFLAGS = [], F77 = r'%s mygcc.py g77') env.Program(target = 'foo', source = Split('test1.c test2.cpp test3.F')) """ % (python, python, python, python)) @@ -128,7 +132,7 @@ test.write('test3.F', r"""test3.F #link """) -test.run(arguments = '.', stderr = None) +test.run(arguments = '.', stderr=None) test.fail_test(test.read('test1' + _obj) != "test1.c\n#link\n") @@ -143,8 +147,10 @@ test.fail_test(test.read('mygcc.out') != "cc\nc++\ng77\n") test.write('SConstruct', """ env = Environment(CPPFLAGS = '-x', SHLINK = r'%s mylink.py', + SHLINKFLAGS = [], CC = r'%s mygcc.py cc', CXX = r'%s mygcc.py c++', + CXXFLAGS = [], F77 = r'%s mygcc.py g77') env.SharedLibrary(target = File('foo.bar'), source = Split('test1.c test2.cpp test3.F')) @@ -166,14 +172,17 @@ test.write('test3.F', r"""test3.F """) test.unlink('mygcc.out') +test.unlink('test1' + _obj) +test.unlink('test2' + _obj) +test.unlink('test3' + _obj) test.run(arguments = '.', stderr = None) -test.fail_test(test.read('test1' + _obj) != "test1.c\n#link\n") +test.fail_test(test.read('test1' + _shobj) != "test1.c\n#link\n") -test.fail_test(test.read('test2' + _obj) != "test2.cpp\n#link\n") +test.fail_test(test.read('test2' + _shobj) != "test2.cpp\n#link\n") -test.fail_test(test.read('test3' + _obj) != "test3.F\n#link\n") +test.fail_test(test.read('test3' + _shobj) != "test3.F\n#link\n") test.fail_test(test.read('foo.bar') != "test1.c\ntest2.cpp\ntest3.F\n") diff --git a/test/CPPPATH.py b/test/CPPPATH.py index 06e6933..cb650fa 100644 --- a/test/CPPPATH.py +++ b/test/CPPPATH.py @@ -200,7 +200,10 @@ test.up_to_date(arguments = args) # Check that a null-string CPPPATH doesn't blow up. test.write('SConstruct', """ env = Environment(CPPPATH = '') -env.Library('foo', source = '') +env.Library('foo', source = 'empty.c') +""") + +test.write('empty.c', """ """) test.run(arguments = '.') diff --git a/test/CVS.py b/test/CVS.py index d8d9da5..1296c5e 100644 --- a/test/CVS.py +++ b/test/CVS.py @@ -95,6 +95,7 @@ test.run(chdir = 'import', # Test the most straightforward CVS checkouts, using the module name. test.write(['work1', 'SConstruct'], """ +import os def cat(env, source, target): target = str(target[0]) source = map(str, source) @@ -102,7 +103,8 @@ def cat(env, source, target): for src in source: f.write(open(src, "rb").read()) f.close() -env = Environment(BUILDERS={'Cat':Builder(action=cat)}) +env = Environment(ENV = { 'PATH' : os.environ['PATH'] }, + BUILDERS={'Cat':Builder(action=cat)}) env.Prepend(CVSFLAGS='-Q ') env.Cat('aaa.out', 'foo/aaa.in') env.Cat('bbb.out', 'foo/bbb.in') @@ -163,6 +165,7 @@ test.fail_test(not is_writable(test.workpath('work1', 'foo', 'sub', 'fff.in'))) # Test CVS checkouts when the module name is specified. test.write(['work2', 'SConstruct'], """ +import os def cat(env, source, target): target = str(target[0]) source = map(str, source) @@ -170,7 +173,8 @@ def cat(env, source, target): for src in source: f.write(open(src, "rb").read()) f.close() -env = Environment(BUILDERS={'Cat':Builder(action=cat)}) +env = Environment(ENV = { 'PATH' : os.environ['PATH'] }, + BUILDERS={'Cat':Builder(action=cat)}) env.Prepend(CVSFLAGS='-q ') env.Cat('aaa.out', 'aaa.in') env.Cat('bbb.out', 'bbb.in') diff --git a/test/CXX.py b/test/CXX.py index f2b3368..cd2c7a9 100644 --- a/test/CXX.py +++ b/test/CXX.py @@ -112,7 +112,9 @@ sys.exit(0) test.write('SConstruct', """ env = Environment(LINK = r'%s mylink.py', - CXX = r'%s myc++.py') + LINKFLAGS = [], + CXX = r'%s myc++.py', + CXXFLAGS = []) env.Program(target = 'test1', source = 'test1.cc') env.Program(target = 'test2', source = 'test2.cpp') env.Program(target = 'test3', source = 'test3.cxx') @@ -161,7 +163,9 @@ if os.path.normcase('.c') != os.path.normcase('.C'): test.write('SConstruct', """ env = Environment(LINK = r'%s mylink.py', - CXX = r'%s myc++.py') + LINKFLAGS = [], + CXX = r'%s myc++.py', + CXXFLAGS = []) env.Program(target = 'test6', source = 'test6.C') """ % (python, python)) diff --git a/test/DVIPDF.py b/test/DVIPDF.py index 4d0428a..a140c3a 100644 --- a/test/DVIPDF.py +++ b/test/DVIPDF.py @@ -114,9 +114,11 @@ os.system(cmd) """ % string.replace(test.workpath('wrapper.out'), '\\', '\\\\')) test.write('SConstruct', """ -foo = Environment() +import os +foo = Environment(ENV = { 'PATH' : os.environ['PATH'] }) dvipdf = foo.Dictionary('DVIPDF') -bar = Environment(DVIPDF = r'%s wrapper.py ' + dvipdf) +bar = Environment(ENV = { 'PATH' : os.environ['PATH'] }, + DVIPDF = r'%s wrapper.py ' + dvipdf) foo.PDF(target = 'foo.pdf', source = foo.DVI(target = 'foo.dvi', source = 'foo.tex')) bar.PDF(target = 'bar.pdf', diff --git a/test/JAR.py b/test/JAR.py index f5b3048..9fdf20e 100644 --- a/test/JAR.py +++ b/test/JAR.py @@ -89,6 +89,9 @@ line 3 test.fail_test(test.read('test2' + _exe) != "test2.CLASS\nline 3\n") +if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'): + print "Could not find Java, skipping test(s)." + test.pass_test(1) test.write("wrapper.py", """\ diff --git a/test/JARFLAGS.py b/test/JARFLAGS.py index af5b89d..539806f 100644 --- a/test/JARFLAGS.py +++ b/test/JARFLAGS.py @@ -56,6 +56,10 @@ public class Example1 } """) +if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'): + print "Could not find Java, skipping test(s)." + test.pass_test(1) + test.run(arguments = '.', stdout = test.wrap_stdout("""\ /usr/local/j2sdk1.3.1/bin/javac -d classes -sourcepath src src/Example1.java diff --git a/test/JAVAC.py b/test/JAVAC.py index 9526259..f2910a4 100644 --- a/test/JAVAC.py +++ b/test/JAVAC.py @@ -91,6 +91,9 @@ line 3 test.fail_test(test.read('test2.class') != "test2.JAVA\nline3\n") +if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'): + print "Could not find Java, skipping test(s)." + test.pass_test(1) test.write("wrapper.py", """\ diff --git a/test/JAVACFLAGS.py b/test/JAVACFLAGS.py index 1a05e2c..6e02bb6 100644 --- a/test/JAVACFLAGS.py +++ b/test/JAVACFLAGS.py @@ -30,6 +30,10 @@ import TestSCons test = TestSCons.TestSCons() +if not os.path.exists('/usr/local/j2sdk1.3.1/bin/javac'): + print "Could not find Java, skipping test(s)." + test.pass_test(1) + test.subdir('src') test.write('SConstruct', """ diff --git a/test/Options.py b/test/Options.py index 4f979df..9c817ba 100644 --- a/test/Options.py +++ b/test/Options.py @@ -58,7 +58,7 @@ opts.Add('CC', opts.Add('UNSPECIFIED', 'An option with no value') -def test_tool(env, platform): +def test_tool(env): if env['RELEASE_BUILD']: env['CCFLAGS'] = env['CCFLAGS'] + ' -O' if env['DEBUG_BUILD']: |