FortranCommon.py (SCons-4.3.0) | : | FortranCommon.py (SCons-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 23 | skipping to change at line 23 | |||
# The above copyright notice and this permission notice shall be included | # The above copyright notice and this permission notice shall be included | |||
# in all copies or substantial portions of the Software. | # in all copies or substantial portions of the Software. | |||
# | # | |||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY | |||
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE | |||
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |||
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |||
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |||
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |||
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |||
"""SCons.Tool.FortranCommon | ||||
Stuff for processing Fortran, common to all fortran dialects. | """Routines for setting up Fortran, common to all dialects.""" | |||
""" | ||||
import re | import re | |||
import os.path | import os.path | |||
from typing import Tuple | ||||
import SCons.Action | ||||
import SCons.Scanner.Fortran | import SCons.Scanner.Fortran | |||
import SCons.Tool | import SCons.Tool | |||
import SCons.Util | import SCons.Util | |||
from SCons.Action import Action | ||||
def isfortran(env, source) -> bool: | ||||
"""Returns True if source has any fortran files in it. | ||||
def isfortran(env, source): | Only checks based on filename suffixes, does not examine code. | |||
"""Return 1 if any of code in source has fortran files in it, 0 | """ | |||
otherwise.""" | ||||
try: | try: | |||
fsuffixes = env['FORTRANSUFFIXES'] | fsuffixes = env['FORTRANSUFFIXES'] | |||
except KeyError: | except KeyError: | |||
# If no FORTRANSUFFIXES, no fortran tool, so there is no need to look | # If no FORTRANSUFFIXES, no fortran tool, so there is no need to look | |||
# for fortran sources. | # for fortran sources. | |||
return 0 | return False | |||
if not source: | if not source: | |||
# Source might be None for unusual cases like SConf. | # Source might be None for unusual cases like SConf. | |||
return 0 | return False | |||
for s in source: | for s in source: | |||
if s.sources: | if s.sources: | |||
ext = os.path.splitext(str(s.sources[0]))[1] | ext = os.path.splitext(str(s.sources[0]))[1] | |||
if ext in fsuffixes: | if ext in fsuffixes: | |||
return 1 | return True | |||
return 0 | return False | |||
def _fortranEmitter(target, source, env) -> Tuple: | ||||
"""Common code for Fortran emitter. | ||||
Called by both the static and shared object emitters, | ||||
mainly to account for generated module files. | ||||
""" | ||||
def _fortranEmitter(target, source, env): | ||||
node = source[0].rfile() | node = source[0].rfile() | |||
if not node.exists() and not node.is_derived(): | if not node.exists() and not node.is_derived(): | |||
print("Could not locate " + str(node.name)) | print("Could not locate " + str(node.name)) | |||
return ([], []) | return ([], []) | |||
# This has to match the def_regex in the Fortran scanner | # This has to match the def_regex in the Fortran scanner | |||
mod_regex = r"""(?i)^\s*MODULE\s+(?!PROCEDURE|SUBROUTINE|FUNCTION|PURE|ELEME NTAL)(\w+)""" | mod_regex = r"""(?i)^\s*MODULE\s+(?!PROCEDURE|SUBROUTINE|FUNCTION|PURE|ELEME NTAL)(\w+)""" | |||
cre = re.compile(mod_regex,re.M) | cre = re.compile(mod_regex,re.M) | |||
# Retrieve all USE'd module names | # Retrieve all USE'd module names | |||
modules = cre.findall(node.get_text_contents()) | modules = cre.findall(node.get_text_contents()) | |||
# Remove unique items from the list | # Remove unique items from the list | |||
modules = SCons.Util.unique(modules) | modules = SCons.Util.unique(modules) | |||
# Convert module name to a .mod filename | # Convert module name to a .mod filename | |||
suffix = env.subst('$FORTRANMODSUFFIX', target=target, source=source) | suffix = env.subst('$FORTRANMODSUFFIX', target=target, source=source) | |||
moddir = env.subst('$FORTRANMODDIR', target=target, source=source) | moddir = env.subst('$FORTRANMODDIR', target=target, source=source) | |||
modules = [x.lower() + suffix for x in modules] | modules = [x.lower() + suffix for x in modules] | |||
for m in modules: | for m in modules: | |||
target.append(env.fs.File(m, moddir)) | target.append(env.fs.File(m, moddir)) | |||
return (target, source) | return (target, source) | |||
def FortranEmitter(target, source, env): | def FortranEmitter(target, source, env) -> Tuple: | |||
import SCons.Defaults | import SCons.Defaults | |||
target, source = _fortranEmitter(target, source, env) | target, source = _fortranEmitter(target, source, env) | |||
return SCons.Defaults.StaticObjectEmitter(target, source, env) | return SCons.Defaults.StaticObjectEmitter(target, source, env) | |||
def ShFortranEmitter(target, source, env): | def ShFortranEmitter(target, source, env) -> Tuple: | |||
import SCons.Defaults | import SCons.Defaults | |||
target, source = _fortranEmitter(target, source, env) | target, source = _fortranEmitter(target, source, env) | |||
return SCons.Defaults.SharedObjectEmitter(target, source, env) | return SCons.Defaults.SharedObjectEmitter(target, source, env) | |||
def ComputeFortranSuffixes(suffixes, ppsuffixes): | def ComputeFortranSuffixes(suffixes, ppsuffixes) -> None: | |||
"""suffixes are fortran source files, and ppsuffixes the ones to be | """Update the suffix lists to reflect the platform requirements. | |||
pre-processed. Both should be sequences, not strings.""" | ||||
If upper-cased suffixes can be distinguished from lower, those are | ||||
added to *ppsuffixes*. If not, they are added to *suffixes*. | ||||
Args: | ||||
suffixes (list): indicate regular Fortran source files | ||||
ppsuffixes (list): indicate Fortran source files that should be | ||||
be run through the pre-processor | ||||
""" | ||||
assert len(suffixes) > 0 | assert len(suffixes) > 0 | |||
s = suffixes[0] | s = suffixes[0] | |||
sup = s.upper() | sup = s.upper() | |||
upper_suffixes = [_.upper() for _ in suffixes] | upper_suffixes = [_.upper() for _ in suffixes] | |||
if SCons.Util.case_sensitive_suffixes(s, sup): | if SCons.Util.case_sensitive_suffixes(s, sup): | |||
ppsuffixes.extend(upper_suffixes) | ppsuffixes.extend(upper_suffixes) | |||
else: | else: | |||
suffixes.extend(upper_suffixes) | suffixes.extend(upper_suffixes) | |||
def CreateDialectActions(dialect): | def CreateDialectActions(dialect) -> Tuple[Action, Action, Action, Action]: | |||
"""Create dialect specific actions.""" | """Create dialect specific actions.""" | |||
CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect) | CompAction = Action(f'${dialect}COM ', cmdstr=f'${dialect}COMSTR') | |||
CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % di | CompPPAction = Action(f'${dialect}PPCOM ', cmdstr=f'${dialect}PPCOMSTR') | |||
alect) | ShCompAction = Action(f'$SH{dialect}COM ', cmdstr=f'$SH{dialect}COMSTR') | |||
ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%sCOMSTR' % di | ShCompPPAction = Action(f'$SH{dialect}PPCOM ', cmdstr=f'$SH{dialect}PPCOMSTR | |||
alect) | ') | |||
ShCompPPAction = SCons.Action.Action('$SH%sPPCOM ' % dialect, '$SH%sPPCOMSTR | ||||
' % dialect) | ||||
return CompAction, CompPPAction, ShCompAction, ShCompPPAction | return CompAction, CompPPAction, ShCompAction, ShCompPPAction | |||
def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0): | def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_mods=False) -> N | |||
"""Add dialect specific construction variables.""" | one: | |||
ComputeFortranSuffixes(suffixes, ppsuffixes) | """Add dialect specific construction variables. | |||
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect) | Args: | |||
dialect (str): dialect name | ||||
suffixes (list): suffixes associated with this dialect | ||||
ppsuffixes (list): suffixes using cpp associated with this dialect | ||||
support_mods (bool): whether this dialect supports modules | ||||
""" | ||||
ComputeFortranSuffixes(suffixes, ppsuffixes) | ||||
fscan = SCons.Scanner.Fortran.FortranScan(f"{dialect}PATH") | ||||
for suffix in suffixes + ppsuffixes: | for suffix in suffixes + ppsuffixes: | |||
SCons.Tool.SourceFileScanner.add_scanner(suffix, fscan) | SCons.Tool.SourceFileScanner.add_scanner(suffix, fscan) | |||
env.AppendUnique(FORTRANSUFFIXES = suffixes + ppsuffixes) | env.AppendUnique(FORTRANSUFFIXES=suffixes + ppsuffixes) | |||
compaction, compppaction, shcompaction, shcompppaction = \ | compaction, compppaction, shcompaction, shcompppaction = \ | |||
CreateDialectActions(dialect) | CreateDialectActions(dialect) | |||
static_obj, shared_obj = SCons.Tool.createObjBuilders(env) | static_obj, shared_obj = SCons.Tool.createObjBuilders(env) | |||
for suffix in suffixes: | for suffix in suffixes: | |||
static_obj.add_action(suffix, compaction) | static_obj.add_action(suffix, compaction) | |||
shared_obj.add_action(suffix, shcompaction) | shared_obj.add_action(suffix, shcompaction) | |||
static_obj.add_emitter(suffix, FortranEmitter) | static_obj.add_emitter(suffix, FortranEmitter) | |||
shared_obj.add_emitter(suffix, ShFortranEmitter) | shared_obj.add_emitter(suffix, ShFortranEmitter) | |||
for suffix in ppsuffixes: | for suffix in ppsuffixes: | |||
static_obj.add_action(suffix, compppaction) | static_obj.add_action(suffix, compppaction) | |||
shared_obj.add_action(suffix, shcompppaction) | shared_obj.add_action(suffix, shcompppaction) | |||
static_obj.add_emitter(suffix, FortranEmitter) | static_obj.add_emitter(suffix, FortranEmitter) | |||
shared_obj.add_emitter(suffix, ShFortranEmitter) | shared_obj.add_emitter(suffix, ShFortranEmitter) | |||
if '%sFLAGS' % dialect not in env: | if f'{dialect}FLAGS' not in env: | |||
env['%sFLAGS' % dialect] = SCons.Util.CLVar('') | env[f'{dialect}FLAGS'] = SCons.Util.CLVar('') | |||
if f'SH{dialect}FLAGS' not in env: | ||||
if 'SH%sFLAGS' % dialect not in env: | env[f'SH{dialect}FLAGS'] = SCons.Util.CLVar(f'${dialect}FLAGS') | |||
env['SH%sFLAGS' % dialect] = SCons.Util.CLVar('$%sFLAGS' % dialect) | ||||
# If a tool does not define fortran prefix/suffix for include path, use C on es | # If a tool does not define fortran prefix/suffix for include path, use C on es | |||
if 'INC%sPREFIX' % dialect not in env: | if f'INC{dialect}PREFIX' not in env: | |||
env['INC%sPREFIX' % dialect] = '$INCPREFIX' | env[f'INC{dialect}PREFIX'] = '$INCPREFIX' | |||
if f'INC{dialect}SUFFIX' not in env: | ||||
if 'INC%sSUFFIX' % dialect not in env: | env[f'INC{dialect}SUFFIX'] = '$INCSUFFIX' | |||
env['INC%sSUFFIX' % dialect] = '$INCSUFFIX' | ||||
env[f'_{dialect}INCFLAGS'] = f'${{_concat(INC{dialect}PREFIX, {dialect}PATH, | ||||
env['_%sINCFLAGS' % dialect] = '${_concat(INC%sPREFIX, %sPATH, INC%sSUFFIX, | INC{dialect}SUFFIX, __env__, RDirs, TARGET, SOURCE, affect_signature=False)}}' | |||
__env__, RDirs, TARGET, SOURCE, affect_signature=False)}' % (dialect, dialect, d | ||||
ialect) | if support_mods: | |||
env[f'{dialect}COM'] = f'${dialect} -o $TARGET -c $FORTRANCOMMONFLAGS ${ | ||||
if support_module == 1: | dialect}FLAGS $_{dialect}INCFLAGS $_FORTRANMODFLAG $SOURCES' | |||
env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $_ | env[f'{dialect}PPCOM'] = f'${dialect} -o $TARGET -c $FORTRANCOMMONFLAGS | |||
FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) | ${dialect}FLAGS $CPPFLAGS $_CPPDEFFLAGS $_{dialect}INCFLAGS $_FORTRANMODFLAG $SO | |||
env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPP | URCES' | |||
DEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) | env[f'SH{dialect}COM'] = f'$SH{dialect} -o $TARGET -c $FORTRANCOMMONFLAG | |||
env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLA | S $SH{dialect}FLAGS $_{dialect}INCFLAGS $_FORTRANMODFLAG $SOURCES' | |||
GS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, dialect) | env[f'SH{dialect}PPCOM'] = f'$SH{dialect} -o $TARGET -c $FORTRANCOMMONFL | |||
env['SH%sPPCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $CPPFLAGS | AGS $SH{dialect}FLAGS $CPPFLAGS $_CPPDEFFLAGS $_{dialect}INCFLAGS $_FORTRANMODFL | |||
$_CPPDEFFLAGS $_%sINCFLAGS $_FORTRANMODFLAG $SOURCES' % (dialect, dialect, diale | AG $SOURCES' | |||
ct) | ||||
else: | else: | |||
env['%sCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $_%sINCFLAGS $S | env[f'{dialect}COM'] = f'${dialect} -o $TARGET -c $FORTRANCOMMONFLAGS ${ | |||
OURCES' % (dialect, dialect, dialect) | dialect}FLAGS $_{dialect}INCFLAGS $SOURCES' | |||
env['%sPPCOM' % dialect] = '$%s -o $TARGET -c $%sFLAGS $CPPFLAGS $_CPP | env[f'{dialect}PPCOM'] = f'${dialect} -o $TARGET -c $FORTRANCOMMONFLAGS | |||
DEFFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) | ${dialect}FLAGS $CPPFLAGS $_CPPDEFFLAGS $_{dialect}INCFLAGS $SOURCES' | |||
env['SH%sCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $_%sINCFLA | env[f'SH{dialect}COM'] = f'$SH{dialect} -o $TARGET -c $FORTRANCOMMONFLAG | |||
GS $SOURCES' % (dialect, dialect, dialect) | S $SH{dialect}FLAGS $_{dialect}INCFLAGS $SOURCES' | |||
env['SH%sPPCOM' % dialect] = '$SH%s -o $TARGET -c $SH%sFLAGS $CPPFLAGS | env[f'SH{dialect}PPCOM'] = f'$SH{dialect} -o $TARGET -c $FORTRANCOMMONFL | |||
$_CPPDEFFLAGS $_%sINCFLAGS $SOURCES' % (dialect, dialect, dialect) | AGS $SH{dialect}FLAGS $CPPFLAGS $_CPPDEFFLAGS $_{dialect}INCFLAGS $SOURCES' | |||
def add_fortran_to_env(env): | def add_fortran_to_env(env) -> None: | |||
"""Add Builders and construction variables for Fortran to an Environment.""" | """Add Builders and construction variables for Fortran/generic.""" | |||
try: | try: | |||
FortranSuffixes = env['FORTRANFILESUFFIXES'] | FortranSuffixes = env['FORTRANFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
FortranSuffixes = ['.f', '.for', '.ftn'] | FortranSuffixes = ['.f', '.for', '.ftn'] | |||
#print("Adding %s to fortran suffixes" % FortranSuffixes) | ||||
try: | try: | |||
FortranPPSuffixes = env['FORTRANPPFILESUFFIXES'] | FortranPPSuffixes = env['FORTRANPPFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
FortranPPSuffixes = ['.fpp', '.FPP'] | FortranPPSuffixes = ['.fpp', '.FPP'] | |||
DialectAddToEnv(env, "FORTRAN", FortranSuffixes, | DialectAddToEnv(env, "FORTRAN", FortranSuffixes, FortranPPSuffixes, support_ | |||
FortranPPSuffixes, support_module = 1) | mods=True) | |||
# Module support | ||||
env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX | env['FORTRANMODPREFIX'] = '' # like $LIBPREFIX | |||
env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX | env['FORTRANMODSUFFIX'] = '.mod' # like $LIBSUFFIX | |||
env['FORTRANMODDIR'] = '' # where the compiler should place .mod fi les | env['FORTRANMODDIR'] = '' # where the compiler should place .mod fi les | |||
env['FORTRANMODDIRPREFIX'] = '' # some prefix to $FORTRANMODDIR - similar to $INCPREFIX | env['FORTRANMODDIRPREFIX'] = '' # some prefix to $FORTRANMODDIR - similar to $INCPREFIX | |||
env['FORTRANMODDIRSUFFIX'] = '' # some suffix to $FORTRANMODDIR - similar to $INCSUFFIX | env['FORTRANMODDIRSUFFIX'] = '' # some suffix to $FORTRANMODDIR - similar to $INCSUFFIX | |||
env['_FORTRANMODFLAG'] = '$( ${_concat(FORTRANMODDIRPREFIX, FORTRANMODDIR, F ORTRANMODDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' | env['_FORTRANMODFLAG'] = '$( ${_concat(FORTRANMODDIRPREFIX, FORTRANMODDIR, F ORTRANMODDIRSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' | |||
def add_f77_to_env(env): | def add_f77_to_env(env) -> None: | |||
"""Add Builders and construction variables for f77 to an Environment.""" | """Add Builders and construction variables for f77 dialect.""" | |||
try: | try: | |||
F77Suffixes = env['F77FILESUFFIXES'] | F77Suffixes = env['F77FILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F77Suffixes = ['.f77'] | F77Suffixes = ['.f77'] | |||
#print("Adding %s to f77 suffixes" % F77Suffixes) | ||||
try: | try: | |||
F77PPSuffixes = env['F77PPFILESUFFIXES'] | F77PPSuffixes = env['F77PPFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F77PPSuffixes = [] | F77PPSuffixes = [] | |||
DialectAddToEnv(env, "F77", F77Suffixes, F77PPSuffixes) | DialectAddToEnv(env, "F77", F77Suffixes, F77PPSuffixes) | |||
def add_f90_to_env(env): | def add_f90_to_env(env) -> None: | |||
"""Add Builders and construction variables for f90 to an Environment.""" | """Add Builders and construction variables for f90 dialect.""" | |||
try: | try: | |||
F90Suffixes = env['F90FILESUFFIXES'] | F90Suffixes = env['F90FILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F90Suffixes = ['.f90'] | F90Suffixes = ['.f90'] | |||
#print("Adding %s to f90 suffixes" % F90Suffixes) | ||||
try: | try: | |||
F90PPSuffixes = env['F90PPFILESUFFIXES'] | F90PPSuffixes = env['F90PPFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F90PPSuffixes = [] | F90PPSuffixes = [] | |||
DialectAddToEnv(env, "F90", F90Suffixes, F90PPSuffixes, | DialectAddToEnv(env, "F90", F90Suffixes, F90PPSuffixes, support_mods=True) | |||
support_module = 1) | ||||
def add_f95_to_env(env): | def add_f95_to_env(env) -> None: | |||
"""Add Builders and construction variables for f95 to an Environment.""" | """Add Builders and construction variables for f95 dialect.""" | |||
try: | try: | |||
F95Suffixes = env['F95FILESUFFIXES'] | F95Suffixes = env['F95FILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F95Suffixes = ['.f95'] | F95Suffixes = ['.f95'] | |||
#print("Adding %s to f95 suffixes" % F95Suffixes) | ||||
try: | try: | |||
F95PPSuffixes = env['F95PPFILESUFFIXES'] | F95PPSuffixes = env['F95PPFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F95PPSuffixes = [] | F95PPSuffixes = [] | |||
DialectAddToEnv(env, "F95", F95Suffixes, F95PPSuffixes, | DialectAddToEnv(env, "F95", F95Suffixes, F95PPSuffixes, support_mods=True) | |||
support_module = 1) | ||||
def add_f03_to_env(env): | def add_f03_to_env(env) -> None: | |||
"""Add Builders and construction variables for f03 to an Environment.""" | """Add Builders and construction variables for f03 dialect.""" | |||
try: | try: | |||
F03Suffixes = env['F03FILESUFFIXES'] | F03Suffixes = env['F03FILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F03Suffixes = ['.f03'] | F03Suffixes = ['.f03'] | |||
#print("Adding %s to f95 suffixes" % F95Suffixes) | ||||
try: | try: | |||
F03PPSuffixes = env['F03PPFILESUFFIXES'] | F03PPSuffixes = env['F03PPFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F03PPSuffixes = [] | F03PPSuffixes = [] | |||
DialectAddToEnv(env, "F03", F03Suffixes, F03PPSuffixes, | DialectAddToEnv(env, "F03", F03Suffixes, F03PPSuffixes, support_mods=True) | |||
support_module = 1) | ||||
def add_f08_to_env(env): | def add_f08_to_env(env) -> None: | |||
"""Add Builders and construction variables for f08 to an Environment.""" | """Add Builders and construction variables for f08 dialect.""" | |||
try: | try: | |||
F08Suffixes = env['F08FILESUFFIXES'] | F08Suffixes = env['F08FILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F08Suffixes = ['.f08'] | F08Suffixes = ['.f08'] | |||
try: | try: | |||
F08PPSuffixes = env['F08PPFILESUFFIXES'] | F08PPSuffixes = env['F08PPFILESUFFIXES'] | |||
except KeyError: | except KeyError: | |||
F08PPSuffixes = [] | F08PPSuffixes = [] | |||
DialectAddToEnv(env, "F08", F08Suffixes, F08PPSuffixes, | DialectAddToEnv(env, "F08", F08Suffixes, F08PPSuffixes, support_mods=True) | |||
support_module = 1) | ||||
def add_all_to_env(env): | def add_all_to_env(env) -> None: | |||
"""Add builders and construction variables for all supported fortran | """Add builders and construction variables for all supported dialects.""" | |||
dialects.""" | ||||
add_fortran_to_env(env) | add_fortran_to_env(env) | |||
add_f77_to_env(env) | add_f77_to_env(env) | |||
add_f90_to_env(env) | add_f90_to_env(env) | |||
add_f95_to_env(env) | add_f95_to_env(env) | |||
add_f03_to_env(env) | add_f03_to_env(env) | |||
add_f08_to_env(env) | add_f08_to_env(env) | |||
# Local Variables: | # Local Variables: | |||
# tab-width:4 | # tab-width:4 | |||
# indent-tabs-mode:nil | # indent-tabs-mode:nil | |||
End of changes. 42 change blocks. | ||||
97 lines changed or deleted | 102 lines changed or added |