summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-03-11 19:54:26 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2019-03-11 19:54:26 (GMT)
commitc9d50a23d164c7e1ca2addad5f7be33083620507 (patch)
tree7766fd8aa8b99efdf1863467c9ba8e200fa6f752 /src
parentdf613e42c8cdd9f257dfdce157be140a519f6bd1 (diff)
downloadSCons-c9d50a23d164c7e1ca2addad5f7be33083620507.zip
SCons-c9d50a23d164c7e1ca2addad5f7be33083620507.tar.gz
SCons-c9d50a23d164c7e1ca2addad5f7be33083620507.tar.bz2
PEP8
Diffstat (limited to 'src')
-rw-r--r--src/engine/SCons/Tool/mingw.py59
1 files changed, 30 insertions, 29 deletions
diff --git a/src/engine/SCons/Tool/mingw.py b/src/engine/SCons/Tool/mingw.py
index 311a955..df88d79 100644
--- a/src/engine/SCons/Tool/mingw.py
+++ b/src/engine/SCons/Tool/mingw.py
@@ -43,7 +43,6 @@ import SCons.Defaults
import SCons.Tool
import SCons.Util
-
mingw_paths = [
r'c:\MinGW\bin',
r'C:\cygwin64\bin',
@@ -52,8 +51,9 @@ mingw_paths = [
r'C:\msys',
]
+
def shlib_generator(target, source, env, for_signature):
- cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS'])
+ cmd = SCons.Util.CLVar(['$SHLINK', '$SHLINKFLAGS'])
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
if dll: cmd.extend(['-o', dll])
@@ -61,31 +61,32 @@ def shlib_generator(target, source, env, for_signature):
cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS'])
implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX')
- if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature))
+ if implib: cmd.append('-Wl,--out-implib,' + implib.get_string(for_signature))
def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX')
insert_def = env.subst("$WINDOWS_INSERT_DEF")
if not insert_def in ['', '0', 0] and def_target: \
- cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature))
+ cmd.append('-Wl,--output-def,' + def_target.get_string(for_signature))
return [cmd]
+
def shlib_emitter(target, source, env):
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
no_import_lib = env.get('no_import_lib', 0)
if not dll:
- raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s Target(s) are:%s" % \
+ raise SCons.Errors.UserError(
+ "A shared library should have exactly one target with the suffix: %s Target(s) are:%s" % \
(env.subst("$SHLIBSUFFIX"), ",".join([str(t) for t in target])))
-
- if not no_import_lib and \
- not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
+ if not no_import_lib and \
+ not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
# Create list of target libraries as strings
- targetStrings=env.ReplaceIxes(dll,
- 'SHLIBPREFIX', 'SHLIBSUFFIX',
- 'LIBPREFIX', 'LIBSUFFIX')
-
+ targetStrings = env.ReplaceIxes(dll,
+ 'SHLIBPREFIX', 'SHLIBSUFFIX',
+ 'LIBPREFIX', 'LIBSUFFIX')
+
# Now add file nodes to target list
target.append(env.fs.File(targetStrings))
@@ -97,15 +98,15 @@ def shlib_emitter(target, source, env):
skip_def_insert = env.subst("$WINDOWS_INSERT_DEF") in ['', '0', 0]
if not def_source and not def_target and not skip_def_insert:
# Create list of target libraries and def files as strings
- targetStrings=env.ReplaceIxes(dll,
- 'SHLIBPREFIX', 'SHLIBSUFFIX',
- 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX')
-
+ targetStrings = env.ReplaceIxes(dll,
+ 'SHLIBPREFIX', 'SHLIBSUFFIX',
+ 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX')
+
# Now add file nodes to target list
target.append(env.fs.File(targetStrings))
return (target, source)
-
+
shlib_action = SCons.Action.Action(shlib_generator, '$SHLINKCOMSTR', generator=1)
ldmodule_action = SCons.Action.Action(shlib_generator, '$LDMODULECOMSTR', generator=1)
@@ -121,7 +122,6 @@ SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan)
key_program = 'mingw32-make'
-
def find_version_specific_mingw_paths():
"""
One example of default mingw install paths is:
@@ -130,14 +130,14 @@ def find_version_specific_mingw_paths():
Use glob'ing to find such and add to mingw_paths
"""
new_paths = glob.glob(r"C:\mingw-w64\*\mingw64\bin")
-
+
return new_paths
def generate(env):
global mingw_paths
# Check for reasoanble mingw default paths
- mingw_paths +=find_version_specific_mingw_paths()
+ mingw_paths += find_version_specific_mingw_paths()
mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_paths)
if mingw:
@@ -149,7 +149,7 @@ def generate(env):
for tool in gnu_tools:
SCons.Tool.Tool(tool)(env)
- #... but a few things differ:
+ # ... but a few things differ:
env['CC'] = 'gcc'
# make sure the msvc tool doesnt break us, it added a /flag
if 'CCFLAGS' in env:
@@ -161,16 +161,16 @@ def generate(env):
env['CXX'] = 'g++'
env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared')
- env['SHLINKCOM'] = shlib_action
+ env['SHLINKCOM'] = shlib_action
env['LDMODULECOM'] = ldmodule_action
- env.Append(SHLIBEMITTER = [shlib_emitter])
- env.Append(LDMODULEEMITTER = [shlib_emitter])
+ env.Append(SHLIBEMITTER=[shlib_emitter])
+ env.Append(LDMODULEEMITTER=[shlib_emitter])
env['AS'] = 'as'
- env['WIN32DEFPREFIX'] = ''
- env['WIN32DEFSUFFIX'] = '.def'
- env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}'
- env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}'
+ env['WIN32DEFPREFIX'] = ''
+ env['WIN32DEFSUFFIX'] = '.def'
+ env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}'
+ env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}'
env['SHOBJSUFFIX'] = '.o'
env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
@@ -181,13 +181,14 @@ def generate(env):
env['RCINCSUFFIX'] = ''
env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET'
env['BUILDERS']['RES'] = res_builder
-
+
# Some setting from the platform also have to be overridden:
env['OBJSUFFIX'] = '.o'
env['LIBPREFIX'] = 'lib'
env['LIBSUFFIX'] = '.a'
env['PROGSUFFIX'] = '.exe'
+
def exists(env):
mingw = SCons.Tool.find_program_path(env, key_program, default_paths=mingw_paths)
if mingw: