diff options
author | William Deegan <bill@baddogconsulting.com> | 2022-06-15 18:12:05 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2022-06-15 18:12:05 (GMT) |
commit | a9f2f54194698559bc248a8926fddb5edde98d32 (patch) | |
tree | 242a03b0d0dc7cd21fe14ddecf7b054d40b2d17b | |
parent | 49e50671de9309fd38e5006071332a802161e7c1 (diff) | |
download | SCons-a9f2f54194698559bc248a8926fddb5edde98d32.zip SCons-a9f2f54194698559bc248a8926fddb5edde98d32.tar.gz SCons-a9f2f54194698559bc248a8926fddb5edde98d32.tar.bz2 |
trivial cleanups. Change internal flag in internal methods from 0/1 to True/False for support_module
-rw-r--r-- | SCons/Tool/FortranCommon.py | 25 | ||||
-rw-r--r-- | SCons/Tool/fortran.py | 2 | ||||
-rw-r--r-- | SCons/Tool/g77.py | 26 | ||||
-rw-r--r-- | SCons/Tool/gfortran.py | 29 | ||||
-rw-r--r-- | SCons/Tool/ifort.py | 29 | ||||
-rw-r--r-- | test/Fortran/FORTRANPATH.py | 6 |
6 files changed, 65 insertions, 52 deletions
diff --git a/SCons/Tool/FortranCommon.py b/SCons/Tool/FortranCommon.py index a73de5d..2d0f9e8 100644 --- a/SCons/Tool/FortranCommon.py +++ b/SCons/Tool/FortranCommon.py @@ -20,6 +20,7 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + """SCons.Tool.FortranCommon Stuff for processing Fortran, common to all fortran dialects. @@ -55,6 +56,7 @@ def isfortran(env, source): return 1 return 0 + def _fortranEmitter(target, source, env): node = source[0].rfile() if not node.exists() and not node.is_derived(): @@ -75,16 +77,19 @@ def _fortranEmitter(target, source, env): target.append(env.fs.File(m, moddir)) return (target, source) + def FortranEmitter(target, source, env): import SCons.Defaults target, source = _fortranEmitter(target, source, env) return SCons.Defaults.StaticObjectEmitter(target, source, env) + def ShFortranEmitter(target, source, env): import SCons.Defaults target, source = _fortranEmitter(target, source, env) return SCons.Defaults.SharedObjectEmitter(target, source, env) + def ComputeFortranSuffixes(suffixes, ppsuffixes): """suffixes are fortran source files, and ppsuffixes the ones to be pre-processed. Both should be sequences, not strings.""" @@ -97,6 +102,7 @@ def ComputeFortranSuffixes(suffixes, ppsuffixes): else: suffixes.extend(upper_suffixes) + def CreateDialectActions(dialect): """Create dialect specific actions.""" CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect) @@ -106,7 +112,8 @@ def CreateDialectActions(dialect): return CompAction, CompPPAction, ShCompAction, ShCompPPAction -def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0): + +def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module=False): """Add dialect specific construction variables.""" ComputeFortranSuffixes(suffixes, ppsuffixes) @@ -149,7 +156,7 @@ def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0): env['_%sINCFLAGS' % dialect] = '${_concat(INC%sPREFIX, %sPATH, INC%sSUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}' % (dialect, dialect, dialect) - if support_module == 1: + if support_module: env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPPDEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) @@ -174,7 +181,7 @@ def add_fortran_to_env(env): FortranPPSuffixes = ['.fpp', '.FPP'] DialectAddToEnv(env, "FORTRAN", FortranSuffixes, - FortranPPSuffixes, support_module = 1) + FortranPPSuffixes, support_module=True) env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX @@ -213,7 +220,8 @@ def add_f90_to_env(env): F90PPSuffixes = [] DialectAddToEnv(env, "F90", F90Suffixes, F90PPSuffixes, - support_module = 1) + support_module=True) + def add_f95_to_env(env): """Add Builders and construction variables for f95 to an Environment.""" @@ -229,7 +237,8 @@ def add_f95_to_env(env): F95PPSuffixes = [] DialectAddToEnv(env, "F95", F95Suffixes, F95PPSuffixes, - support_module = 1) + support_module=True) + def add_f03_to_env(env): """Add Builders and construction variables for f03 to an Environment.""" @@ -245,7 +254,8 @@ def add_f03_to_env(env): F03PPSuffixes = [] DialectAddToEnv(env, "F03", F03Suffixes, F03PPSuffixes, - support_module = 1) + support_module=True) + def add_f08_to_env(env): """Add Builders and construction variables for f08 to an Environment.""" @@ -260,7 +270,8 @@ def add_f08_to_env(env): F08PPSuffixes = [] DialectAddToEnv(env, "F08", F08Suffixes, F08PPSuffixes, - support_module = 1) + support_module=True) + def add_all_to_env(env): """Add builders and construction variables for all supported fortran diff --git a/SCons/Tool/fortran.py b/SCons/Tool/fortran.py index 9a095ae..d21b930 100644 --- a/SCons/Tool/fortran.py +++ b/SCons/Tool/fortran.py @@ -32,6 +32,7 @@ from SCons.Tool.FortranCommon import add_all_to_env, add_fortran_to_env compilers = ['f95', 'f90', 'f77'] + def generate(env): add_all_to_env(env) add_fortran_to_env(env) @@ -41,6 +42,7 @@ def generate(env): if 'SHFORTRAN' not in env: env['SHFORTRAN'] = '$FORTRAN' + def exists(env): return env.Detect(compilers) diff --git a/SCons/Tool/g77.py b/SCons/Tool/g77.py index 764235e..bacfc22 100644 --- a/SCons/Tool/g77.py +++ b/SCons/Tool/g77.py @@ -1,15 +1,6 @@ -"""SCons.Tool.g77 - -Tool-specific initialization for g77. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -29,15 +20,23 @@ selection method. # 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__" +"""SCons.Tool.g77 + +Tool-specific initialization for g77. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" import SCons.Util from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env compilers = ['g77', 'f77'] + def generate(env): """Add Builders and construction variables for g77 to an Environment.""" add_all_to_env(env) @@ -63,6 +62,7 @@ def generate(env): env['INCF77PREFIX'] = "-I" env['INCF77SUFFIX'] = "" + def exists(env): return env.Detect(compilers) diff --git a/SCons/Tool/gfortran.py b/SCons/Tool/gfortran.py index 45750d6..c0c100b 100644 --- a/SCons/Tool/gfortran.py +++ b/SCons/Tool/gfortran.py @@ -1,16 +1,6 @@ -"""SCons.Tool.gfortran - -Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran -2003 compiler. - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -30,14 +20,24 @@ selection method. # 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__" +"""SCons.Tool.gfortran + +Tool-specific initialization for gfortran, the GNU Fortran 95/Fortran +2003 compiler. + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + import SCons.Util from . import fortran + def generate(env): """Add Builders and construction variables for gfortran to an Environment.""" @@ -56,6 +56,7 @@ def generate(env): env['FORTRANMODDIRPREFIX'] = "-J" + def exists(env): return env.Detect('gfortran') diff --git a/SCons/Tool/ifort.py b/SCons/Tool/ifort.py index 638bd12..b1a5e14 100644 --- a/SCons/Tool/ifort.py +++ b/SCons/Tool/ifort.py @@ -1,16 +1,6 @@ -"""SCons.Tool.ifort - -Tool-specific initialization for newer versions of the Intel Fortran Compiler -for Linux/Windows (and possibly Mac OS X). - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -30,14 +20,24 @@ selection method. # 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__" +"""SCons.Tool.ifort + +Tool-specific initialization for newer versions of the Intel Fortran Compiler +for Linux/Windows (and possibly Mac OS X). + +There normally shouldn't be any need to import this module directly. +It will usually be imported through the generic SCons.Tool.Tool() +selection method. + +""" + import SCons.Defaults from SCons.Scanner.Fortran import FortranScan from .FortranCommon import add_all_to_env + def generate(env): """Add Builders and construction variables for ifort to an Environment.""" # ifort supports Fortran 90 and Fortran 95 @@ -78,6 +78,7 @@ def generate(env): else: env['FORTRANMODDIRPREFIX'] = "-module " + def exists(env): return env.Detect('ifort') diff --git a/test/Fortran/FORTRANPATH.py b/test/Fortran/FORTRANPATH.py index ee01aee..d80a825 100644 --- a/test/Fortran/FORTRANPATH.py +++ b/test/Fortran/FORTRANPATH.py @@ -1,6 +1,7 @@ #!/usr/bin/env python +# MIT License # -# __COPYRIGHT__ +# Copyright The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,9 +21,6 @@ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os |