diff --git a/lib/hints.py b/lib/hints.py index a4803f0866..be529a54bc 100644 --- a/lib/hints.py +++ b/lib/hints.py @@ -37,9 +37,10 @@ def _normalizePath(path): best = None for path_entry in sys.path: - if path.startswith(path_entry): - if best is None or len(path_entry) > len(best): - best = path_entry + if path.startswith(path_entry) and ( + best is None or len(path_entry) > len(best) + ): + best = path_entry if best is not None: path = path.replace(best, "$PYTHONPATH") diff --git a/nuitka/Builtins.py b/nuitka/Builtins.py index 2525f9e4d9..ec6d5166cd 100644 --- a/nuitka/Builtins.py +++ b/nuitka/Builtins.py @@ -116,7 +116,7 @@ def _getBuiltinNames(): builtin_names, builtin_warnings = _getBuiltinNames() -builtin_named_values = dict((getattr(builtins, x), x) for x in builtin_names) +builtin_named_values = {getattr(builtins, x): x for x in builtin_names} builtin_named_values_list = tuple(builtin_named_values) assert "__import__" in builtin_names @@ -129,11 +129,12 @@ def _getBuiltinNames(): def getBuiltinTypeNames(): - result = [] + result = [ + builtin_name + for builtin_name in builtin_names + if isinstance(getattr(builtins, builtin_name), type) + ] - for builtin_name in builtin_names: - if isinstance(getattr(builtins, builtin_name), type): - result.append(builtin_name) return tuple(sorted(result)) @@ -188,7 +189,7 @@ def _getAnonBuiltins(): builtin_anon_names, builtin_anon_codes = _getAnonBuiltins() -builtin_anon_values = dict((b, a) for a, b in builtin_anon_names.items()) +builtin_anon_values = {b: a for a, b in builtin_anon_names.items()} # For being able to check if it's not hashable, we need something not using # a hash. diff --git a/nuitka/Constants.py b/nuitka/Constants.py index 6a6cf8239e..e5bb26425a 100644 --- a/nuitka/Constants.py +++ b/nuitka/Constants.py @@ -69,11 +69,7 @@ def compareConstants(a, b): if len(a) != len(b): return False - for ea, eb in zip(a, b): - if not compareConstants(ea, eb): - return False - return True - + return all(compareConstants(ea, eb) for ea, eb in zip(a, b)) if type(a) is dict: if len(a) != len(b): return False @@ -150,19 +146,14 @@ def isConstant(constant): return False return True elif constant_type in (tuple, list): - for element_value in constant: - if not isConstant(element_value): - return False - return True + return all(isConstant(element_value) for element_value in constant) elif constant_type is slice: - if ( - not isConstant(constant.start) - or not isConstant(constant.stop) - or not isConstant(constant.step) - ): - return False + return bool( + isConstant(constant.start) + and isConstant(constant.stop) + and isConstant(constant.step) + ) - return True elif constant_type in ( str, unicode, @@ -230,15 +221,9 @@ def isMutable(constant): elif constant_type in (dict, list, set, bytearray): return True elif constant_type is tuple: - for value in constant: - if isMutable(value): - return True - return False + return any(isMutable(value) for value in constant) elif constant_type is frozenset: - for value in constant: - if isMutable(value): - return True - return False + return any(isMutable(value) for value in constant) elif constant is Ellipsis: return False elif constant is NotImplemented: @@ -277,15 +262,9 @@ def isHashable(constant): elif constant_type in (dict, list, set, slice, bytearray): return False elif constant_type is tuple: - for value in constant: - if not isHashable(value): - return False - return True + return not any(not isHashable(value) for value in constant) elif constant_type is frozenset: - for value in constant: - if not isHashable(value): - return False - return True + return all(isHashable(value) for value in constant) elif constant is Ellipsis: return True else: diff --git a/nuitka/ModuleRegistry.py b/nuitka/ModuleRegistry.py index d3449c6f3c..58d62cec1a 100644 --- a/nuitka/ModuleRegistry.py +++ b/nuitka/ModuleRegistry.py @@ -53,11 +53,7 @@ def getRootModules(): def hasRootModule(module_name): - for module in root_modules: - if module.getFullName() == module_name: - return True - - return False + return any(module.getFullName() == module_name for module in root_modules) def replaceRootModule(old, new): @@ -112,12 +108,11 @@ def _normalizeModuleFilename(filename): def getUncompiledModule(module_name, module_filename): for uncompiled_module in uncompiled_modules: - if module_name == uncompiled_module.getFullName(): - if areSamePaths( - _normalizeModuleFilename(module_filename), - _normalizeModuleFilename(uncompiled_module.filename), - ): - return uncompiled_module + if module_name == uncompiled_module.getFullName() and areSamePaths( + _normalizeModuleFilename(module_filename), + _normalizeModuleFilename(uncompiled_module.filename), + ): + return uncompiled_module return None diff --git a/nuitka/Options.py b/nuitka/Options.py index e3541110ab..72affb30ca 100644 --- a/nuitka/Options.py +++ b/nuitka/Options.py @@ -226,45 +226,39 @@ def _splitShellPattern(value): def getShallFollowInNoCase(): """ *list*, items of "--nofollow-import-to=" / "--recurse-not-to=" """ - return sum([_splitShellPattern(x) for x in options.recurse_not_modules], []) + return sum((_splitShellPattern(x) for x in options.recurse_not_modules), []) def getShallFollowModules(): """ *list*, items of "--follow-import-to=" / "--recurse-to=" """ - return sum( - [ - _splitShellPattern(x) - for x in options.recurse_modules - + options.include_modules - + options.include_packages - ], - [], - ) + return sum((_splitShellPattern(x) for x in options.recurse_modules + + options.include_modules + + options.include_packages), []) def getShallFollowExtra(): """ *list*, items of "--include-plugin-directory=" """ - return sum([_splitShellPattern(x) for x in options.recurse_extra], []) + return sum((_splitShellPattern(x) for x in options.recurse_extra), []) def getShallFollowExtraFilePatterns(): """ *list*, items of "--include-plugin-files=" """ - return sum([_splitShellPattern(x) for x in options.recurse_extra_files], []) + return sum((_splitShellPattern(x) for x in options.recurse_extra_files), []) def getMustIncludeModules(): """ *list*, items of "--include-module=" """ - return sum([_splitShellPattern(x) for x in options.include_modules], []) + return sum((_splitShellPattern(x) for x in options.include_modules), []) def getMustIncludePackages(): """ *list*, items of "--include-package=" """ - return sum([_splitShellPattern(x) for x in options.include_packages], []) + return sum((_splitShellPattern(x) for x in options.include_packages), []) def shallWarnImplicitRaises(): @@ -372,7 +366,7 @@ def shallUseStaticLibPython(): return ( os.path.exists(os.path.join(sys.prefix, "conda-meta")) and not Utils.isWin32Windows() - and not Utils.getOS() == "Darwin" + and Utils.getOS() != "Darwin" ) diff --git a/nuitka/PythonVersions.py b/nuitka/PythonVersions.py index 955a8d796a..6b71e85cc1 100644 --- a/nuitka/PythonVersions.py +++ b/nuitka/PythonVersions.py @@ -127,10 +127,7 @@ def needsSetLiteralReverseInsertion(): def needsDuplicateArgumentColOffset(): - if python_version < 353: - return False - else: - return True + return python_version >= 353 def isUninstalledPython(): @@ -246,9 +243,10 @@ def getPythonABI(): # Cyclic dependency here. from nuitka.Options import isPythonDebug - if isPythonDebug() or hasattr(sys, "getobjects"): - if not abiflags.startswith("d"): - abiflags = "d" + abiflags + if ( + isPythonDebug() or hasattr(sys, "getobjects") + ) and not abiflags.startswith("d"): + abiflags = "d" + abiflags else: abiflags = "" diff --git a/nuitka/SourceCodeReferences.py b/nuitka/SourceCodeReferences.py index 88e0cc28fb..9b64005717 100644 --- a/nuitka/SourceCodeReferences.py +++ b/nuitka/SourceCodeReferences.py @@ -109,9 +109,7 @@ def atInternal(self): it is already internal. """ if not self.isInternal(): - result = self._clone(self.line) - - return result + return self._clone(self.line) else: return self diff --git a/nuitka/Variables.py b/nuitka/Variables.py index 0250582f9d..0b227997a9 100644 --- a/nuitka/Variables.py +++ b/nuitka/Variables.py @@ -121,12 +121,13 @@ def addVariableUser(self, user): # These are not really scopes, just shared uses. if ( - user.isExpressionGeneratorObjectBody() - or user.isExpressionCoroutineObjectBody() - or user.isExpressionAsyncgenObjectBody() - ): - if self.owner is user.getParentVariableProvider(): - return + ( + user.isExpressionGeneratorObjectBody() + or user.isExpressionCoroutineObjectBody() + or user.isExpressionAsyncgenObjectBody() + ) + ) and self.owner is user.getParentVariableProvider(): + return self.shared_scopes = True diff --git a/nuitka/__past__.py b/nuitka/__past__.py index 3c001c0678..115b568362 100644 --- a/nuitka/__past__.py +++ b/nuitka/__past__.py @@ -69,14 +69,12 @@ def iterItems(d): from urllib import ( # pylint: disable=I0021,import-error,no-name-in-module urlretrieve, ) + from cStringIO import StringIO # pylint: disable=I0021,import-error else: from urllib.request import ( # pylint: disable=I0021,import-error,no-name-in-module urlretrieve, ) -if str is bytes: - from cStringIO import StringIO # pylint: disable=I0021,import-error -else: from io import StringIO # pylint: disable=I0021,import-error try: @@ -85,7 +83,7 @@ def iterItems(d): # Lame replacement for functools.total_ordering, which does not exist on # Python2.6, this requires "<" and "=" and adds all other operations. def total_ordering(cls): - cls.__ne__ = lambda self, other: not self == other + cls.__ne__ = lambda self, other: self != other cls.__le__ = lambda self, other: self == other or self < other cls.__gt__ = lambda self, other: self != other and not self < other cls.__ge__ = lambda self, other: self == other and not self < other @@ -98,15 +96,13 @@ def total_ordering(cls): Iterable, MutableSet, ) + intern = intern # pylint: disable=I0021,undefined-variable else: from collections.abc import ( # pylint: disable=I0021,import-error,no-name-in-module Iterable, # pylint: disable=I0021,import-error MutableSet, # pylint: disable=I0021,import-error ) -if str is bytes: - intern = intern # pylint: disable=I0021,undefined-variable -else: intern = sys.intern @@ -118,9 +114,7 @@ def getMetaClassBase(meta_class_prefix): class MetaClass(ABCMeta): pass - MetaClassBase = MetaClass("%sMetaClassBase" % meta_class_prefix, (object,), {}) - - return MetaClassBase + return MetaClass("%sMetaClassBase" % meta_class_prefix, (object,), {}) # For PyLint to be happy. diff --git a/nuitka/build/SconsInterface.py b/nuitka/build/SconsInterface.py index 19cc819ca8..eb193cd898 100644 --- a/nuitka/build/SconsInterface.py +++ b/nuitka/build/SconsInterface.py @@ -174,9 +174,12 @@ def _setupSconsEnvironment(): """ # For Python2, avoid unicode working directory. - if Utils.isWin32Windows() and python_version < 300: - if os.getcwd() != os.getcwdu(): - os.chdir(getWindowsShortPathName(os.getcwdu())) + if ( + Utils.isWin32Windows() + and python_version < 300 + and os.getcwd() != os.getcwdu() + ): + os.chdir(getWindowsShortPathName(os.getcwdu())) if Utils.isWin32Windows(): # On Win32, we use the Python.DLL path for some things. We pass it diff --git a/nuitka/build/inline_copy/appdirs/appdirs.py b/nuitka/build/inline_copy/appdirs/appdirs.py index 2acd1debeb..069ba0efbf 100644 --- a/nuitka/build/inline_copy/appdirs/appdirs.py +++ b/nuitka/build/inline_copy/appdirs/appdirs.py @@ -128,7 +128,11 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): WARNING: Do not use this on Windows. See the Vista-Fail note above for why. """ - if system == "win32": + if system == 'darwin': + path = os.path.expanduser('/Library/Application Support') + if appname: + path = os.path.join(path, appname) + elif system == "win32": if appauthor is None: appauthor = appname path = os.path.normpath(_get_win_folder("CSIDL_COMMON_APPDATA")) @@ -137,10 +141,6 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): path = os.path.join(path, appauthor, appname) else: path = os.path.join(path, appname) - elif system == 'darwin': - path = os.path.expanduser('/Library/Application Support') - if appname: - path = os.path.join(path, appname) else: # XDG default for $XDG_DATA_DIRS # only first, if multipath is False @@ -152,10 +152,7 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): appname = os.path.join(appname, version) pathlist = [os.sep.join([x, appname]) for x in pathlist] - if multipath: - path = os.pathsep.join(pathlist) - else: - path = pathlist[0] + path = os.pathsep.join(pathlist) if multipath else pathlist[0] return path if appname and version: @@ -247,10 +244,7 @@ def site_config_dir(appname=None, appauthor=None, version=None, multipath=False) appname = os.path.join(appname, version) pathlist = [os.sep.join([x, appname]) for x in pathlist] - if multipath: - path = os.pathsep.join(pathlist) - else: - path = pathlist[0] + path = os.pathsep.join(pathlist) if multipath else pathlist[0] return path diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Action.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Action.py index 23e32ac625..96ede56821 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Action.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Action.py @@ -152,10 +152,10 @@ def remove_set_lineno_codes(code): if op >= HAVE_ARGUMENT: if op != SET_LINENO: result.append(code[i:i+3]) - i = i+3 + i += 3 else: result.append(c) - i = i+1 + i += 1 return ''.join(result) strip_quotes = re.compile('^[\'"](.*)[\'"]$') @@ -366,10 +366,7 @@ def _do_create_action(act, kw): del kw['generator'] except KeyError: gen = 0 - if gen: - action_type = CommandGeneratorAction - else: - action_type = FunctionAction + action_type = CommandGeneratorAction if gen else FunctionAction return action_type(act, kw) if is_String(act): @@ -532,8 +529,8 @@ def __call__(self, target, source, env, if presub is _null: presub = self.presub - if presub is _null: - presub = print_actions_presub + if presub is _null: + presub = print_actions_presub if exitstatfunc is _null: exitstatfunc = self.exitstatfunc if show is _null: show = print_actions if execute is _null: execute = execute_actions @@ -704,10 +701,9 @@ def __init__(self, cmd, **kw): if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandAction') _ActionAction.__init__(self, **kw) - if is_List(cmd): - if list(filter(is_List, cmd)): - raise TypeError("CommandAction should be given only " \ - "a single command") + if is_List(cmd) and list(filter(is_List, cmd)): + raise TypeError("CommandAction should be given only " \ + "a single command") self.cmd_list = cmd def __str__(self): @@ -823,10 +819,7 @@ def get_presig(self, target, source, env, executor=None): """ from SCons.Subst import SUBST_SIG cmd = self.cmd_list - if is_List(cmd): - cmd = ' '.join(map(str, cmd)) - else: - cmd = str(cmd) + cmd = ' '.join(map(str, cmd)) if is_List(cmd) else str(cmd) if executor: return env.subst_target_source(cmd, SUBST_SIG, executor=executor) else: @@ -955,15 +948,12 @@ def __init__(self, var, kw): def get_parent_class(self, env): c = env.get(self.var) - if is_String(c) and not '\n' in c: + if is_String(c) and '\n' not in c: return CommandAction return CommandGeneratorAction def _generate_cache(self, env): - if env: - c = env.get(self.var, '') - else: - c = '' + c = env.get(self.var, '') if env else '' gen_cmd = Action(c, **self.gen_kw) if not gen_cmd: raise SCons.Errors.UserError("$%s value %s cannot be used to create an Action." % (self.var, repr(c))) @@ -1250,8 +1240,7 @@ def __init__(self, actfunc, strfunc, convert=lambda x: x): def __call__(self, *args, **kw): ac = ActionCaller(self, args, kw) - action = Action(ac, strfunction=ac.strfunction) - return action + return Action(ac, strfunction=ac.strfunction) # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Builder.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Builder.py index 142ca818fd..df5692b7c0 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Builder.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Builder.py @@ -121,7 +121,7 @@ def match_splitext(path, suffixes = []): if suffixes: matchsuf = [S for S in suffixes if path[-len(S):] == S] if matchsuf: - suf = max([(len(_f),_f) for _f in matchsuf])[1] + suf = max((len(_f),_f) for _f in matchsuf)[1] return [path[:-len(suf)], path[-len(suf):]] return SCons.Util.splitext(path) @@ -275,7 +275,7 @@ def Builder(**kw): result = BuilderBase(**kw) - if not composite is None: + if composite is not None: result = CompositeBuilder(result, composite) return result @@ -292,7 +292,7 @@ def _node_errors(builder, env, tlist, slist): if t.side_effect: raise UserError("Multiple ways to build the same target were specified for: %s" % t) if t.has_explicit_builder(): - if not t.env is None and not t.env is env: + if t.env is not None and t.env is not env: action = t.builder.action t_contents = action.get_contents(tlist, slist, t.env) contents = action.get_contents(tlist, slist, env) @@ -315,9 +315,8 @@ def _node_errors(builder, env, tlist, slist): msg = "Multiple ways to build the same target were specified for: %s (from %s and from %s)" % (t, list(map(str, t.sources)), list(map(str, slist))) raise UserError(msg) - if builder.single_source: - if len(slist) > 1: - raise UserError("More than one source given for single-source builder: targets=%s sources=%s" % (list(map(str,tlist)), list(map(str,slist)))) + if builder.single_source and len(slist) > 1: + raise UserError("More than one source given for single-source builder: targets=%s sources=%s" % (list(map(str,tlist)), list(map(str,slist)))) class EmitterProxy(object): """This is a callable class that can act as a @@ -417,7 +416,7 @@ def __init__(self, action = None, if name: self.name = name self.executor_kw = {} - if not chdir is _null: + if chdir is not _null: self.executor_kw['chdir'] = chdir self.is_explicit = is_explicit @@ -453,10 +452,7 @@ def __cmp__(self, other): def splitext(self, path, env=None): if not env: env = self.env - if env: - suffixes = self.src_suffixes(env) - else: - suffixes = [] + suffixes = self.src_suffixes(env) if env else [] return match_splitext(path, suffixes) def _adjustixes(self, files, pre, suf, ensure_suffix=False): @@ -633,7 +629,7 @@ def prependDirIfRelative(f, srcdir=kw['srcdir']): return self._execute(env, target, source, OverrideWarner(kw), ekw) def adjust_suffix(self, suff): - if suff and not suff[0] in [ '.', '_', '$' ]: + if suff and suff[0] not in ['.', '_', '$']: return '.' + suff return suff diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/CacheDir.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/CacheDir.py index 43c7f0e5e5..6aa36399f0 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/CacheDir.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/CacheDir.py @@ -151,7 +151,7 @@ def CacheDebug(self, fmt, target, cachefile): self.debugFP.write(fmt % (target, os.path.split(cachefile)[1])) def is_enabled(self): - return (cache_enabled and not self.path is None) + return cache_enabled and self.path is not None def is_readonly(self): return cache_readonly diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Conftest.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Conftest.py index a8984bd5a7..4012af9353 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Conftest.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Conftest.py @@ -456,7 +456,7 @@ def CheckTypeSize(context, type_name, header = None, language = None, expect = N return msg src = includetext + header - if not expect is None: + if expect is not None: # Only check if the given size is the right one context.Display('Checking %s is %d bytes... ' % (type_name, expect)) @@ -476,15 +476,15 @@ def CheckTypeSize(context, type_name, header = None, language = None, expect = N """ st = context.CompileProg(src % (type_name, expect), suffix) - if not st: + if st: + context.Display("no\n") + _LogFailed(context, src, st) + return 0 + else: context.Display("yes\n") _Have(context, "SIZEOF_%s" % type_name, expect, "The size of `%s', as computed by sizeof." % type_name) return expect - else: - context.Display("no\n") - _LogFailed(context, src, st) - return 0 else: # Only check if the given size is the right one context.Message('Checking size of %s ... ' % type_name) @@ -513,16 +513,16 @@ def CheckTypeSize(context, type_name, header = None, language = None, expect = N st = 1 size = 0 - if not st: - context.Display("yes\n") - _Have(context, "SIZEOF_%s" % type_name, size, - "The size of `%s', as computed by sizeof." % type_name) - return size - else: + if st: context.Display("no\n") _LogFailed(context, src, st) return 0 + else: + context.Display("yes\n") + _Have(context, "SIZEOF_%s" % type_name, size, + "The size of `%s', as computed by sizeof." % type_name) + return size return 0 def CheckDeclaration(context, symbol, includes = None, language = None): @@ -663,10 +663,7 @@ def CheckLib(context, libs, func_name = None, header = None, l = [ lib_name ] if extra_libs: l.extend(extra_libs) - if append: - oldLIBS = context.AppendLIBS(l) - else: - oldLIBS = context.PrependLIBS(l) + oldLIBS = context.AppendLIBS(l) if append else context.PrependLIBS(l) sym = "HAVE_LIB" + lib_name else: oldLIBS = -1 @@ -734,11 +731,7 @@ def _Have(context, key, have, comment = None): else: line = "#define %s %s\n" % (key_up, str(have)) - if comment is not None: - lines = "\n/* %s */\n" % comment + line - else: - lines = "\n" + line - + lines = "\n/* %s */\n" % comment + line if comment is not None else "\n" + line if context.headerfilename: f = open(context.headerfilename, "a") f.write(lines) @@ -760,7 +753,7 @@ def _LogFailed(context, text, msg): n = 1 for line in lines: context.Log("%d: %s\n" % (n, line)) - n = n + 1 + n += 1 if LogErrorMessages: context.Log("Error message: %s\n" % msg) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Debug.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Debug.py index c6372b67ae..4cc3f6a464 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Debug.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Debug.py @@ -180,11 +180,7 @@ def func_shorten(func_tuple): TraceFP = {} -if sys.platform == 'win32': - TraceDefault = 'con' -else: - TraceDefault = '/dev/tty' - +TraceDefault = 'con' if sys.platform == 'win32' else '/dev/tty' TimeStampDefault = None StartTime = time.time() PreviousTime = StartTime diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Defaults.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Defaults.py index 80a6240243..a7e79f2b01 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Defaults.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Defaults.py @@ -110,7 +110,7 @@ def SharedObjectEmitter(target, source, env): def SharedFlagChecker(source, target, env): same = env.subst('$STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME') - if same == '0' or same == '' or same == 'False': + if same in ['0', '', 'False']: for src in source: try: shared = src.attributes.shared @@ -160,9 +160,7 @@ def SharedFlagChecker(source, target, env): def get_paths_str(dest): # If dest is a list, we need to manually call str() on each element if SCons.Util.is_List(dest): - elem_strs = [] - for element in dest: - elem_strs.append('"' + str(element) + '"') + elem_strs = ['"' + str(element) + '"' for element in dest] return '[' + ', '.join(elem_strs) + ']' else: return '"' + str(dest) + '"' diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Environment.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Environment.py index 467007c805..f258b6ad9e 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Environment.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Environment.py @@ -383,9 +383,7 @@ def __init__(self, **kw): def _init_special(self): """Initial the dispatch tables for special handling of special construction variables.""" - self._special_del = {} - self._special_del['SCANNERS'] = _del_SCANNERS - + self._special_del = {'SCANNERS': _del_SCANNERS} self._special_set = {} for key in reserved_construction_var_names: self._special_set[key] = _set_reserved @@ -611,7 +609,9 @@ def RemoveMethod(self, function): Removes the specified function's MethodWrapper from the added_methods list, so we don't re-bind it when making a clone. """ - self.added_methods = [dm for dm in self.added_methods if not dm.method is function] + self.added_methods = [ + dm for dm in self.added_methods if dm.method is not function + ] def Override(self, overrides): """ @@ -825,7 +825,7 @@ def MergeFlags(self, args, unique=1, dict=None): else: if not orig: orig = value - elif value: + else: # Add orig and value. The logic here was lifted from # part of env.Append() (see there for a lot of comments # about the order in which things are tried) and is @@ -956,8 +956,8 @@ def __init__(self, if platform is None: platform = self._dict.get('PLATFORM', None) - if platform is None: - platform = SCons.Platform.Platform() + if platform is None: + platform = SCons.Platform.Platform() if SCons.Util.is_String(platform): platform = SCons.Platform.Platform(platform) self._dict['PLATFORM'] = str(platform) @@ -982,7 +982,7 @@ def __init__(self, self.Replace(**kw) keys = list(kw.keys()) if variables: - keys = keys + list(variables.keys()) + keys += list(variables.keys()) variables.Update(self) save = {} @@ -998,8 +998,8 @@ def __init__(self, if tools is None: tools = self._dict.get('TOOLS', None) - if tools is None: - tools = ['default'] + if tools is None: + tools = ['default'] apply_tools(self, tools, toolpath) # Now restore the passed-in and customized variables @@ -1333,10 +1333,9 @@ def AppendUnique(self, delete_existing=0, **kw): val = [(val,)] if delete_existing: dk = filter(lambda x, val=val: x not in val, dk) - self._dict[key] = dk + val else: dk = [x for x in dk if x not in val] - self._dict[key] = dk + val + self._dict[key] = dk + val else: # By elimination, val is not a list. Since dk is a # list, wrap val in a list first. @@ -1344,7 +1343,7 @@ def AppendUnique(self, delete_existing=0, **kw): dk = filter(lambda x, val=val: x not in val, dk) self._dict[key] = dk + [val] else: - if not val in dk: + if val not in dk: self._dict[key] = dk + [val] else: if key == 'CPPDEFINES': @@ -1353,10 +1352,7 @@ def AppendUnique(self, delete_existing=0, **kw): elif SCons.Util.is_Dict(dk): dk = dk.items() if SCons.Util.is_String(val): - if val in dk: - val = [] - else: - val = [val] + val = [] if val in dk else [val] elif SCons.Util.is_Dict(val): tmp = [] for i,j in val.iteritems(): @@ -1511,10 +1507,7 @@ def Dump(self, key = None): """ import pprint pp = pprint.PrettyPrinter(indent=2) - if key: - dict = self.Dictionary(key) - else: - dict = self.Dictionary() + dict = self.Dictionary(key) if key else self.Dictionary() return pp.pformat(dict) def FindIxes(self, paths, prefix, suffix): @@ -1720,7 +1713,7 @@ def PrependUnique(self, delete_existing=0, **kw): dk = [x for x in dk if x not in val] self._dict[key] = [val] + dk else: - if not val in dk: + if val not in dk: self._dict[key] = [val] + dk else: if delete_existing: @@ -1831,7 +1824,7 @@ def AddPreAction(self, files, action): uniq = {} for executor in [n.get_executor() for n in nodes]: uniq[executor] = 1 - for executor in uniq.keys(): + for executor in uniq: executor.add_pre_action(action) return nodes @@ -1841,7 +1834,7 @@ def AddPostAction(self, files, action): uniq = {} for executor in [n.get_executor() for n in nodes]: uniq[executor] = 1 - for executor in uniq.keys(): + for executor in uniq: executor.add_post_action(action) return nodes @@ -1937,7 +1930,7 @@ def Clean(self, targets, files): def Configure(self, *args, **kw): nargs = [self] if args: - nargs = nargs + self.subst_list(args)[0] + nargs += self.subst_list(args)[0] nkw = self.subst_kw(kw) nkw['_depth'] = kw.get('_depth', 0) + 1 try: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Executor.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Executor.py index 18f7028bbc..343ce6f70b 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Executor.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Executor.py @@ -130,10 +130,7 @@ def __init__(self, action, env=None, overridelist=[{}], self.post_actions = [] self.env = env self.overridelist = overridelist - if targets or sources: - self.batches = [Batch(targets[:], sources[:])] - else: - self.batches = [] + self.batches = [Batch(targets[:], sources[:])] if targets or sources else [] self.builder_kw = builder_kw self._memo = {} @@ -519,9 +516,7 @@ def get_unignored_sources(self, node, ignore=()): else: sourcelist = self.get_all_sources() if ignore: - idict = {} - for i in ignore: - idict[i] = 1 + idict = {i: 1 for i in ignore} sourcelist = [s for s in sourcelist if s not in idict] memo_dict[key] = sourcelist diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Job.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Job.py index fc48e93cbc..30c5eb31d9 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Job.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Job.py @@ -367,66 +367,66 @@ def __init__(self, taskmaster, num, stack_size): self.maxjobs = num def start(self): - """Start the job. This will begin pulling tasks from the + """Start the job. This will begin pulling tasks from the taskmaster and executing them, and return when there are no more tasks. If a task fails to execute (i.e. execute() raises an exception), then the job will stop.""" - jobs = 0 + jobs = 0 - while True: + while True: # Start up as many available tasks as we're # allowed to. - while jobs < self.maxjobs: - task = self.taskmaster.next_task() - if task is None: - break - - try: - # prepare task for execution - task.prepare() - except: - task.exception_set() - task.failed() - task.postprocess() + while jobs < self.maxjobs: + task = self.taskmaster.next_task() + if task is None: + break + + try: + # prepare task for execution + task.prepare() + except: + task.exception_set() + task.failed() + task.postprocess() + else: + if task.needs_execute(): + # dispatch task + self.tp.put(task) + jobs += 1 else: - if task.needs_execute(): - # dispatch task - self.tp.put(task) - jobs = jobs + 1 - else: - task.executed() - task.postprocess() + task.executed() + task.postprocess() - if not task and not jobs: break + if not task and not jobs: break # Let any/all completed tasks finish up before we go # back and put the next batch of tasks on the queue. - while True: - task, ok = self.tp.get() - jobs = jobs - 1 - - if ok: - task.executed() - else: - if self.interrupted(): - try: - raise SCons.Errors.BuildError( - task.targets[0], errstr=interrupt_msg) - except: - task.exception_set() - - # Let the failed() callback function arrange - # for the build to stop if that's appropriate. - task.failed() - - task.postprocess() - - if self.tp.resultsQueue.empty(): - break - - self.tp.cleanup() - self.taskmaster.cleanup() + while True: + task, ok = self.tp.get() + jobs -= 1 + + if ok: + task.executed() + else: + if self.interrupted(): + try: + raise SCons.Errors.BuildError( + task.targets[0], errstr=interrupt_msg) + except: + task.exception_set() + + # Let the failed() callback function arrange + # for the build to stop if that's appropriate. + task.failed() + + task.postprocess() + + if self.tp.resultsQueue.empty(): + break + + self.tp.cleanup() + self.taskmaster.cleanup() # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py index 65e923db63..305f32b5f1 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/FS.py @@ -214,10 +214,7 @@ def _hardlink_func(fs, src, dst): # hard-link the final destination file. while fs.islink(src): link = fs.readlink(src) - if not os.path.isabs(link): - src = link - else: - src = os.path.join(os.path.dirname(src), link) + src = os.path.join(os.path.dirname(src), link) if os.path.isabs(link) else link fs.link(src, dst) else: _hardlink_func = None @@ -253,14 +250,13 @@ def set_duplicate(duplicate): 'copy' : _copy_func } - if not duplicate in Valid_Duplicates: + if duplicate not in Valid_Duplicates: raise SCons.Errors.InternalError("The argument of set_duplicate " "should be in Valid_Duplicates") global Link_Funcs - Link_Funcs = [] - for func in duplicate.split('-'): - if link_dict[func]: - Link_Funcs.append(link_dict[func]) + Link_Funcs = [ + link_dict[func] for func in duplicate.split('-') if link_dict[func] + ] def LinkFunc(target, source, env): # Relative paths cause problems with symbolic links, so @@ -384,10 +380,7 @@ def __init__(self, type, do, ignore): def __call__(self, *args, **kw): return self.func(*args, **kw) def set(self, list): - if self.type in list: - self.func = self.do - else: - self.func = self.ignore + self.func = self.do if self.type in list else self.ignore def do_diskcheck_match(node, predicate, errorfmt): result = predicate() @@ -412,10 +405,7 @@ def do_diskcheck_rcs(node, name): try: rcs_dir = node.rcs_dir except AttributeError: - if node.entry_exists_on_disk('RCS'): - rcs_dir = node.Dir('RCS') - else: - rcs_dir = None + rcs_dir = node.Dir('RCS') if node.entry_exists_on_disk('RCS') else None node.rcs_dir = rcs_dir if rcs_dir: return rcs_dir.entry_exists_on_disk(name+',v') @@ -428,10 +418,7 @@ def do_diskcheck_sccs(node, name): try: sccs_dir = node.sccs_dir except AttributeError: - if node.entry_exists_on_disk('SCCS'): - sccs_dir = node.Dir('SCCS') - else: - sccs_dir = None + sccs_dir = node.Dir('SCCS') if node.entry_exists_on_disk('SCCS') else None node.sccs_dir = sccs_dir if sccs_dir: return sccs_dir.entry_exists_on_disk('s.'+name) @@ -1121,10 +1108,7 @@ def __init__(self, path = None): self.max_drift = default_max_drift self.Top = None - if path is None: - self.pathTop = os.getcwd() - else: - self.pathTop = path + self.pathTop = os.getcwd() if path is None else path self.defaultDrive = _my_normcase(_my_splitdrive(self.pathTop)[0]) self.Top = self.Dir(self.pathTop) @@ -1234,10 +1218,7 @@ def _lookup(self, p, directory, fsclass, create=1): # structure similar to the one found on drive C:. if do_splitdrive: drive, p = _my_splitdrive(p) - if drive: - root = self.get_root(drive) - else: - root = directory.root + root = self.get_root(drive) if drive else directory.root else: root = directory.root @@ -1248,10 +1229,7 @@ def _lookup(self, p, directory, fsclass, create=1): needs_normpath = needs_normpath_match(p) # The path is relative to the top-level SCons directory. - if p in ('', '.'): - p = directory.labspath - else: - p = directory.labspath + '/' + p + p = directory.labspath if p in ('', '.') else directory.labspath + '/' + p else: if do_splitdrive: drive, p = _my_splitdrive(p) @@ -1284,16 +1262,8 @@ def _lookup(self, p, directory, fsclass, create=1): else: directory = self._cwd - if p in ('', '.'): - p = directory.labspath - else: - p = directory.labspath + '/' + p - - if drive: - root = self.get_root(drive) - else: - root = directory.root - + p = directory.labspath if p in ('', '.') else directory.labspath + '/' + p + root = self.get_root(drive) if drive else directory.root if needs_normpath is not None: # Normalize a pathname. Will return the same result for # equivalent paths. @@ -1388,8 +1358,8 @@ def variant_dir_target_climb(self, orig, dir, tail): message = None fmt = "building associated VariantDir targets: %s" start_dir = dir - while dir: - for bd in dir.variant_dirs: + while start_dir: + for bd in start_dir.variant_dirs: if start_dir.is_under(bd): # If already in the build-dir location, don't reflect return [orig], fmt % str(orig) @@ -1576,10 +1546,7 @@ def get_all_rdirs(self): while dir: for rep in dir.getRepositories(): result.append(rep.Dir(fname)) - if fname == '.': - fname = dir.name - else: - fname = dir.name + OS_SEP + fname + fname = dir.name if fname == '.' else dir.name + OS_SEP + fname dir = dir.up() self._memo['get_all_rdirs'] = list(result) @@ -1587,7 +1554,7 @@ def get_all_rdirs(self): return result def addRepository(self, dir): - if dir != self and not dir in self.repositories: + if dir != self and dir not in self.repositories: self.repositories.append(dir) dir.tpath = '.' self.__clearRepositoryCache() @@ -1628,7 +1595,7 @@ def rel_path(self, other): if self is other: result = '.' - elif not other in self.path_elements: + elif other not in self.path_elements: try: other_dir = other.get_dir() except AttributeError: @@ -1753,9 +1720,11 @@ def get_text_contents(self): def get_contents(self): """Return content signatures and names of all our children separated by new-lines. Ensure that the nodes are sorted.""" - contents = [] - for node in sorted(self.children(), key=lambda t: t.name): - contents.append('%s %s\n' % (node.get_csig(), node.name)) + contents = [ + '%s %s\n' % (node.get_csig(), node.name) + for node in sorted(self.children(), key=lambda t: t.name) + ] + return ''.join(contents) def get_csig(self): @@ -1842,7 +1811,7 @@ def entry_exists_on_disk(self, name): for entry in map(_my_normcase, entries): d[entry] = True self.on_disk_entries = d - if sys.platform == 'win32' or sys.platform == 'cygwin': + if sys.platform in ['win32', 'cygwin']: name = _my_normcase(name) result = d.get(name) if result is None: @@ -2337,12 +2306,13 @@ def prepare_dependencies(self): nodes.append(s) setattr(self, nattr, nodes) def format(self, names=0): - result = [] bkids = self.bsources + self.bdepends + self.bimplicit bkidsigs = self.bsourcesigs + self.bdependsigs + self.bimplicitsigs - for bkid, bkidsig in zip(bkids, bkidsigs): - result.append(str(bkid) + ': ' + - ' '.join(bkidsig.format(names=names))) + result = [ + str(bkid) + ': ' + ' '.join(bkidsig.format(names=names)) + for bkid, bkidsig in zip(bkids, bkidsigs) + ] + result.append('%s [%s]' % (self.bactsig, self.bact)) return '\n'.join(result) @@ -2473,11 +2443,7 @@ def get_size(self): except KeyError: pass - if self.rexists(): - size = self.rfile().getsize() - else: - size = 0 - + size = self.rfile().getsize() if self.rexists() else 0 self._memo['get_size'] = size return size @@ -2490,11 +2456,7 @@ def get_timestamp(self): except KeyError: pass - if self.rexists(): - timestamp = self.rfile().getmtime() - else: - timestamp = 0 - + timestamp = self.rfile().getmtime() if self.rexists() else 0 self._memo['get_timestamp'] = timestamp return timestamp diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/Python.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/Python.py index d02a71bc59..8f0d2de4c3 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/Python.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/Python.py @@ -97,7 +97,7 @@ def get_text_contents(self): ###TODO: something reasonable about universal newlines contents = str(self.value) for kid in self.children(None): - contents = contents + kid.get_contents() + contents += kid.get_contents() return contents get_contents = get_text_contents ###TODO should return 'bytes' value diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py index f0cecc4735..dd34683b89 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Node/__init__.py @@ -706,8 +706,7 @@ def env_set(self, env, safe=0): BuildInfo = BuildInfoBase def new_ninfo(self): - ninfo = self.NodeInfo(self) - return ninfo + return self.NodeInfo(self) def get_ninfo(self): try: @@ -717,8 +716,7 @@ def get_ninfo(self): return self.ninfo def new_binfo(self): - binfo = self.BuildInfo(self) - return binfo + return self.BuildInfo(self) def get_binfo(self): """ @@ -759,7 +757,7 @@ def get_binfo(self): bsources = [] bsourcesigs = [] for s in sources: - if not s in seen: + if s not in seen: seen.add(s) bsources.append(s) bsourcesigs.append(s.get_ninfo()) @@ -969,10 +967,7 @@ def _children_get(self): if self.ignore_set: iter = chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit])) - children = [] - for i in iter: - if i not in self.ignore_set: - children.append(i) + children = [i for i in iter if i not in self.ignore_set] else: children = self.all_children(scan=0) @@ -1107,9 +1102,7 @@ def changed(self, node=None, allowcache=False): if t: Trace(': bactsig %s != newsig %s' % (bi.bactsig, newsig)) result = True - if not result: - if t: Trace(': up to date') - + if not result and t: Trace(': up to date') if t: Trace('\n') return result @@ -1134,7 +1127,7 @@ def children_are_up_to_date(self): s = kid.get_state() if s and (not state or s > state): state = s - return (state == 0 or state == SCons.Node.up_to_date) + return state in [0, SCons.Node.up_to_date] def is_literal(self): """Always pass the string representation of a Node to @@ -1353,10 +1346,7 @@ def get_next(self): node = self.stack.pop() del self.history[node] if node: - if self.stack: - parent = self.stack[-1] - else: - parent = None + parent = self.stack[-1] if self.stack else None self.eval_func(node, parent) return node return None diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/PathList.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/PathList.py index 337bf16e9e..ae8a38edce 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/PathList.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/PathList.py @@ -108,10 +108,7 @@ def __init__(self, pathlist): except (AttributeError, TypeError): type = TYPE_OBJECT else: - if index == -1: - type = TYPE_STRING_NO_SUBST - else: - type = TYPE_STRING_SUBST + type = TYPE_STRING_NO_SUBST if index == -1 else TYPE_STRING_SUBST pl.append((type, p)) self.pathlist = tuple(pl) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/__init__.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/__init__.py index c929894d68..7d18aa6332 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/__init__.py @@ -231,8 +231,7 @@ def Platform(name = platform_default()): """Select a canned Platform specification. """ module = platform_module(name) - spec = PlatformSpec(name, module.generate) - return spec + return PlatformSpec(name, module.generate) # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/aix.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/aix.py index 4d9ea92e7a..90aff3e188 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/aix.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/aix.py @@ -69,8 +69,6 @@ def get_xlc(env, xlc=None, packages=[]): or ('/' not in xlc and filename.endswith('/' + xlc)): xlcVersion = fileset.split()[1] xlcPath, sep, xlc = filename.rpartition('/') - pass - pass return (xlcPath, xlc, xlcVersion) def generate(env): diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/win32.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/win32.py index 362c35600f..1d993dea9f 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/win32.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Platform/win32.py @@ -257,8 +257,6 @@ def get_program_files_dir(): val, tok = SCons.Util.RegQueryValueEx(k, 'ProgramFilesDir') except SCons.Util.RegError: val = '' - pass - if val == '': # A reasonable default if we can't read the registry # (Actually, it's pretty reasonable even if we can :-) @@ -350,13 +348,13 @@ def generate(env): if 'PATHEXT' in os.environ: tmp_pathext = os.environ['PATHEXT'] cmd_interp = SCons.Util.WhereIs('cmd', tmp_path, tmp_pathext) - if not cmd_interp: - cmd_interp = SCons.Util.WhereIs('command', tmp_path, tmp_pathext) + if not cmd_interp: + cmd_interp = SCons.Util.WhereIs('command', tmp_path, tmp_pathext) if not cmd_interp: cmd_interp = env.Detect('cmd') - if not cmd_interp: - cmd_interp = env.Detect('command') + if not cmd_interp: + cmd_interp = env.Detect('command') if 'ENV' not in env: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConf.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConf.py index 53c5116575..86a7fa4608 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConf.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConf.py @@ -121,10 +121,7 @@ def _stringConfigH(target, source, env): def NeedConfigHBuilder(): - if len(_ac_config_hs) == 0: - return False - else: - return True + return len(_ac_config_hs) != 0 def CreateConfigHBuilder(env): """Called if necessary just before the building targets phase begins.""" @@ -283,8 +280,9 @@ def collect_node_states(self): t.set_state(SCons.Node.up_to_date) if T: Trace(': set_state(up_to-date)') else: - if T: Trace(': get_state() %s' % t.get_state()) - if T: Trace(': changed() %s' % t.changed()) + if T: + Trace(': get_state() %s' % t.get_state()) + Trace(': changed() %s' % t.changed()) if (t.get_state() != SCons.Node.up_to_date and t.changed()): changed = True if T: Trace(': changed %s' % changed) @@ -596,11 +594,7 @@ def TryBuild(self, builder, text = None, extension = ""): self.env['SPAWN'] = save_spawn _ac_build_counter = _ac_build_counter + 1 - if result: - self.lastTarget = nodes[0] - else: - self.lastTarget = None - + self.lastTarget = nodes[0] if result else None return result def TryAction(self, action, text = None, extension = ""): @@ -641,15 +635,15 @@ def TryRun(self, text, extension ): is saved in self.lastTarget (for further processing). """ ok = self.TryLink(text, extension) - if( ok ): + if ( ok ): prog = self.lastTarget pname = prog.path output = self.confdir.File(os.path.basename(pname)+'.out') node = self.env.Command(output, prog, [ [ pname, ">", "${TARGET}"] ]) ok = self.BuildNodes(node) - if ok: - outputStr = output.get_contents() - return( 1, outputStr) + if ok: + outputStr = output.get_contents() + return( 1, outputStr) return (0, "") class TestWrapper(object): @@ -681,11 +675,10 @@ def AddTests(self, tests): def _createDir( self, node ): dirName = str(node) - if dryrun: - if not os.path.isdir( dirName ): + if not os.path.isdir( dirName ): + if dryrun: raise ConfigureDryRunError(dirName) - else: - if not os.path.isdir( dirName ): + else: os.makedirs( dirName ) node._exists = 1 @@ -751,7 +744,7 @@ def _shutdown(self): self.env.Replace( BUILDERS=blds ) self.active = 0 sconf_global = None - if not self.config_h is None: + if self.config_h is not None: _ac_config_hs[self.config_h] = self.config_h_text self.env.fs = self.lastEnvFs @@ -937,15 +930,13 @@ def createIncludesFromHeaders(headers, leaveLast, include_quotes = '""'): # statements from the specified header (list) if not SCons.Util.is_List(headers): headers = [headers] - l = [] if leaveLast: lastHeader = headers[-1] headers = headers[:-1] else: lastHeader = None - for s in headers: - l.append("#include %s%s%s\n" - % (include_quotes[0], s, include_quotes[1])) + l = ["#include %s%s%s\n" + % (include_quotes[0], s, include_quotes[1]) for s in headers] return ''.join(l), lastHeader def CheckHeader(context, header, include_quotes = '<>', language = None): diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConsign.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConsign.py index a6599f41ad..3eca625e3c 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConsign.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/SConsign.py @@ -380,7 +380,7 @@ def File(name, dbm_module=None): else: ForDirectory = DB DB_Name = name - if not dbm_module is None: + if dbm_module is not None: DB_Module = dbm_module # Local Variables: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/C.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/C.py index 6e06e93f63..6de7f7d6eb 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/C.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/C.py @@ -98,8 +98,8 @@ def __call__(self, node, env, path = ()): cpppath = path, dict = dictify_CPPDEFINES(env)) result = cpp(node) + fmt = "No dependency generated for file: %s (included from: %s) -- file not found" for included, includer in cpp.missing: - fmt = "No dependency generated for file: %s (included from: %s) -- file not found" SCons.Warnings.warn(SCons.Warnings.DependencyWarning, fmt % (included, includer)) return result @@ -119,11 +119,12 @@ def CScanner(): # right configurability to let users pick between the scanners. #return SConsCPPScannerWrapper("CScanner", "CPPPATH") - cs = SCons.Scanner.ClassicCPP("CScanner", - "$CPPSUFFIXES", - "CPPPATH", - '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")') - return cs + return SCons.Scanner.ClassicCPP( + "CScanner", + "$CPPSUFFIXES", + "CPPPATH", + '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")', + ) # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/Prog.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/Prog.py index 07ffd629b8..b6d481a4d9 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/Prog.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/Prog.py @@ -35,8 +35,7 @@ def ProgramScanner(**kw): """Return a prototype Scanner instance for scanning executable files for static-lib dependencies""" kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') - ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) - return ps + return SCons.Scanner.Base(scan, "ProgramScanner", **kw) def scan(node, env, libpath = ()): """ @@ -50,11 +49,7 @@ def scan(node, env, libpath = ()): except KeyError: # There are no LIBS in this environment, so just return a null list: return [] - if SCons.Util.is_String(libs): - libs = libs.split() - else: - libs = SCons.Util.flatten(libs) - + libs = libs.split() if SCons.Util.is_String(libs) else SCons.Util.flatten(libs) try: prefix = env['LIBPREFIXES'] if not SCons.Util.is_List(prefix): diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/RC.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/RC.py index a967a20e36..8174712c1f 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/RC.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/RC.py @@ -41,13 +41,11 @@ def RCScan(): '.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \ '\s*.*?)' \ '\s*(<|"| )([^>"\s]+)(?:[>"\s])*$' - resScanner = SCons.Scanner.ClassicCPP( "ResourceScanner", + return SCons.Scanner.ClassicCPP( "ResourceScanner", "$RCSUFFIXES", "CPPPATH", res_re ) - return resScanner - # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/__init__.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/__init__.py index b846ade11b..48d13d9a3d 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Scanner/__init__.py @@ -169,10 +169,7 @@ def __init__(self, self.argument = argument if skeys is _null: - if SCons.Util.is_Dict(function): - skeys = list(function.keys()) - else: - skeys = [] + skeys = list(function.keys()) if SCons.Util.is_Dict(function) else [] self.skeys = skeys self.node_class = node_class @@ -188,7 +185,7 @@ def __init__(self, def path(self, env, dir=None, target=None, source=None): if not self.path_function: return () - if not self.argument is _null: + if self.argument is not _null: return self.path_function(env, dir, target, source, self.argument) else: return self.path_function(env, dir, target, source) @@ -205,7 +202,7 @@ def __call__(self, node, env, path = ()): self = self.select(node) - if not self.argument is _null: + if self.argument is not _null: list = self.function(node, env, path, self.argument) else: list = self.function(node, env, path) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Interactive.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Interactive.py index 9f62a35970..bdb4a499df 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Interactive.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Interactive.py @@ -123,10 +123,7 @@ def __init__(self, **kw): for key, val in kw.items(): setattr(self, key, val) - if sys.platform == 'win32': - self.shell_variable = 'COMSPEC' - else: - self.shell_variable = 'SHELL' + self.shell_variable = 'COMSPEC' if sys.platform == 'win32' else 'SHELL' def default(self, argv): print "*** Unknown command: %s" % argv[0] diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Main.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Main.py index a039742f29..3ce5ee6c96 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Main.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/Main.py @@ -127,7 +127,7 @@ def erase_previous(self): if self.prev: length = len(self.prev) if self.prev[-1] in ('\n', '\r'): - length = length - 1 + length -= 1 self.write(' ' * length + '\r') self.prev = '' @@ -420,10 +420,7 @@ def get_derived_children(self, node): children = node.all_children(None) return [x for x in children if x.has_builder()] def display(self, t): - if self.derived: - func = self.get_derived_children - else: - func = self.get_all_children + func = self.get_derived_children if self.derived else self.get_all_children s = self.status and 2 or 0 SCons.Util.print_tree(t, func, prune=self.prune, showtags=s) @@ -475,8 +472,7 @@ def add_local_option(self, *args, **kw): def AddOption(*args, **kw): if 'default' not in kw: kw['default'] = None - result = OptionsParser.add_local_option(*args, **kw) - return result + return OptionsParser.add_local_option(*args, **kw) def GetOption(name): return getattr(OptionsParser.values, name) @@ -511,7 +507,7 @@ def do_print(self): for s in self.stats: for n, c in s: stats_table[n][i] = c - i = i + 1 + i += 1 self.outfp.write("Object counts:\n") pre = [" "] post = [" %s\n"] @@ -520,8 +516,8 @@ def do_print(self): fmt2 = ''.join(pre + [' %7d']*l + post) labels = self.labels[:l] labels.append(("", "Class")) - self.outfp.write(fmt1 % tuple([x[0] for x in labels])) - self.outfp.write(fmt1 % tuple([x[1] for x in labels])) + self.outfp.write(fmt1 % tuple(x[0] for x in labels)) + self.outfp.write(fmt1 % tuple(x[1] for x in labels)) for k in sorted(stats_table.keys()): r = stats_table[k][:l] + [k] self.outfp.write(fmt2 % tuple(r)) @@ -677,10 +673,7 @@ def _set_debug_values(options): def _create_path(plist): path = '.' for d in plist: - if os.path.isabs(d): - path = d - else: - path = path + '/' + d + path = d if os.path.isabs(d) else path + '/' + d return path def _load_site_scons_dir(topdir, site_dir_name=None): @@ -1151,7 +1144,7 @@ def _build_targets(fs, options, targets, target_top): # -U, local SConscript Default() targets target_top = fs.Dir(target_top) def check_dir(x, target_top=target_top): - if hasattr(x, 'cwd') and not x.cwd is None: + if hasattr(x, 'cwd') and x.cwd is not None: cwd = x.cwd.srcnode() return cwd == target_top else: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConsOptions.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConsOptions.py index 6f89c6e7f4..a440ffa3da 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConsOptions.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConsOptions.py @@ -192,7 +192,7 @@ def convert_value(self, opt, value): if self.nargs in (1, '?'): return self.check_value(opt, value) else: - return tuple([self.check_value(opt, v) for v in value]) + return tuple(self.check_value(opt, v) for v in value) def process(self, opt, value, values, parser): @@ -313,10 +313,7 @@ def _process_long_opt(self, rargs, values): if option.takes_value(): nargs = option.nargs if nargs == '?': - if had_explicit_value: - value = rargs.pop(0) - else: - value = option.const + value = rargs.pop(0) if had_explicit_value else option.const elif len(rargs) < nargs: if nargs == 1: self.error(_("%s option requires an argument") % opt) @@ -388,7 +385,7 @@ def reparse_local_options(self): # Not known yet, so reject for now largs_restore.append('='.join(lopt)) else: - if l == "--" or l == "-": + if l in ["--", "-"]: # Stop normal processing and don't # process the rest of the command-line opts largs_restore.append(l) @@ -535,21 +532,20 @@ def format_option_strings(self, option): """Return a comma-separated list of option strings & metavariables.""" if option.takes_value(): metavar = option.metavar or option.dest.upper() - short_opts = [] - for sopt in option._short_opts: - short_opts.append(self._short_opt_fmt % (sopt, metavar)) - long_opts = [] - for lopt in option._long_opts: - long_opts.append(self._long_opt_fmt % (lopt, metavar)) + short_opts = [ + self._short_opt_fmt % (sopt, metavar) + for sopt in option._short_opts + ] + + long_opts = [ + self._long_opt_fmt % (lopt, metavar) for lopt in option._long_opts + ] + else: short_opts = option._short_opts long_opts = option._long_opts - if self.short_first: - opts = short_opts + long_opts - else: - opts = long_opts + short_opts - + opts = short_opts + long_opts if self.short_first else long_opts + short_opts return ", ".join(opts) def Parser(version): @@ -646,7 +642,7 @@ def opt_invalid(group, value, options): config_options = ["auto", "force" ,"cache"] def opt_config(option, opt, value, parser, c_options=config_options): - if not value in c_options: + if value not in c_options: raise OptionValueError(opt_invalid('config', value, c_options)) setattr(parser.values, option.dest, value) @@ -721,7 +717,7 @@ def opt_diskcheck(option, opt, value, parser): metavar="TYPE") def opt_duplicate(option, opt, value, parser): - if not value in SCons.Node.FS.Valid_Duplicates: + if value not in SCons.Node.FS.Valid_Duplicates: raise OptionValueError(opt_invalid('duplication', value, SCons.Node.FS.Valid_Duplicates)) setattr(parser.values, option.dest, value) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConscript.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConscript.py index 3b68f028e7..2a99c26b25 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConscript.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Script/SConscript.py @@ -522,11 +522,7 @@ def SConscript(self, *ls, **kw): msg = """The build_dir keyword has been deprecated; use the variant_dir keyword instead.""" SCons.Warnings.warn(SCons.Warnings.DeprecatedBuildDirWarning, msg) def subst_element(x, subst=self.subst): - if SCons.Util.is_List(x): - x = list(map(subst, x)) - else: - x = subst(x) - return x + return list(map(subst, x)) if SCons.Util.is_List(x) else subst(x) ls = list(map(subst_element, ls)) subst_kw = {} for key, val in kw.items(): diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Subst.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Subst.py index 1246e36882..1655b1cf5f 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Subst.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Subst.py @@ -100,10 +100,7 @@ def __init__(self, lstr, for_signature=None): canonical string we return from for_signature(). Else we will simply return lstr.""" self.lstr = lstr - if for_signature: - self.forsig = for_signature - else: - self.forsig = lstr + self.forsig = for_signature if for_signature else lstr def __str__(self): return self.lstr @@ -345,7 +342,7 @@ def get_src_subst_proxy(node): def _rm_list(list): #return [ l for l in list if not l in ('$(', '$)') ] - return [l for l in list if not l in ('$(', '$)')] + return [l for l in list if l not in ('$(', '$)')] def _remove_list(list): result = [] @@ -755,46 +752,47 @@ def add_to_current_word(self, x): inherits the object attributes of x (in particular, the escape function) by wrapping it as CmdStringHolder.""" - if not self.in_strip or self.mode != SUBST_SIG: + if self.in_strip and self.mode == SUBST_SIG: + return + try: + current_word = self[-1][-1] + except IndexError: + self.add_new_word(x) + else: + # All right, this is a hack and it should probably + # be refactored out of existence in the future. + # The issue is that we want to smoosh words together + # and make one file name that gets escaped if + # we're expanding something like foo$EXTENSION, + # but we don't want to smoosh them together if + # it's something like >$TARGET, because then we'll + # treat the '>' like it's part of the file name. + # So for now, just hard-code looking for the special + # command-line redirection characters... try: - current_word = self[-1][-1] + last_char = str(current_word)[-1] except IndexError: + last_char = '\0' + if last_char in '<>|': self.add_new_word(x) else: - # All right, this is a hack and it should probably - # be refactored out of existence in the future. - # The issue is that we want to smoosh words together - # and make one file name that gets escaped if - # we're expanding something like foo$EXTENSION, - # but we don't want to smoosh them together if - # it's something like >$TARGET, because then we'll - # treat the '>' like it's part of the file name. - # So for now, just hard-code looking for the special - # command-line redirection characters... - try: - last_char = str(current_word)[-1] - except IndexError: - last_char = '\0' - if last_char in '<>|': - self.add_new_word(x) - else: - y = current_word + x - - # We used to treat a word appended to a literal - # as a literal itself, but this caused problems - # with interpreting quotes around space-separated - # targets on command lines. Removing this makes - # none of the "substantive" end-to-end tests fail, - # so we'll take this out but leave it commented - # for now in case there's a problem not covered - # by the test cases and we need to resurrect this. - #literal1 = self.literal(self[-1][-1]) - #literal2 = self.literal(x) - y = self.conv(y) - if is_String(y): - #y = CmdStringHolder(y, literal1 or literal2) - y = CmdStringHolder(y, None) - self[-1][-1] = y + y = current_word + x + + # We used to treat a word appended to a literal + # as a literal itself, but this caused problems + # with interpreting quotes around space-separated + # targets on command lines. Removing this makes + # none of the "substantive" end-to-end tests fail, + # so we'll take this out but leave it commented + # for now in case there's a problem not covered + # by the test cases and we need to resurrect this. + #literal1 = self.literal(self[-1][-1]) + #literal2 = self.literal(x) + y = self.conv(y) + if is_String(y): + #y = CmdStringHolder(y, literal1 or literal2) + y = CmdStringHolder(y, None) + self[-1][-1] = y def add_new_word(self, x): if not self.in_strip or self.mode != SUBST_SIG: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Taskmaster.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Taskmaster.py index 1a0a629a95..4ec64f4cac 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Taskmaster.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Taskmaster.py @@ -1036,8 +1036,7 @@ def cleanup(self): if cycle: desc = desc + " " + " -> ".join(map(str, cycle)) + "\n" else: - desc = desc + \ - " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ + desc += " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ (node, repr(node), StateString[node.get_state()]) raise SCons.Errors.UserError(desc) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/GettextCommon.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/GettextCommon.py index faa68b8378..6adc544fa6 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/GettextCommon.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/GettextCommon.py @@ -169,20 +169,20 @@ class _POFileBuilder(BuilderBase): # After that it calls emitter (which is quite too late). The emitter is # also called in each iteration, what makes things yet worse. def __init__(self, env, **kw): - if not 'suffix' in kw: - kw['suffix'] = '$POSUFFIX' - if not 'src_suffix' in kw: - kw['src_suffix'] = '$POTSUFFIX' - if not 'src_builder' in kw: - kw['src_builder'] = '_POTUpdateBuilder' - if not 'single_source' in kw: - kw['single_source'] = True + if 'suffix' not in kw: + kw['suffix'] = '$POSUFFIX' + if 'src_suffix' not in kw: + kw['src_suffix'] = '$POTSUFFIX' + if 'src_builder' not in kw: + kw['src_builder'] = '_POTUpdateBuilder' + if 'single_source' not in kw: + kw['single_source'] = True alias = None if 'target_alias' in kw: alias = kw['target_alias'] del kw['target_alias'] - if not 'target_factory' in kw: - kw['target_factory'] = _POTargetFactory(env, alias=alias).File + if 'target_factory' not in kw: + kw['target_factory'] = _POTargetFactory(env, alias=alias).File BuilderBase.__init__(self, **kw) def _execute(self, env, target, source, *args, **kw): @@ -229,8 +229,7 @@ def _translate(env, target=None, source=SCons.Environment._null, *args, **kw): """ Function for `Translate()` pseudo-builder """ if target is None: target = [] pot = env.POTUpdate(None, source, *args, **kw) - po = env.POUpdate(target, pot, *args, **kw) - return po + return env.POUpdate(target, pot, *args, **kw) ############################################################################# ############################################################################# @@ -341,10 +340,7 @@ def relpath(path, start=curdir): def _init_po_files(target, source, env): """ Action function for `POInit` builder. """ nop = lambda target, source, env : 0 - if env.has_key('POAUTOINIT'): - autoinit = env['POAUTOINIT'] - else: - autoinit = False + autoinit = env['POAUTOINIT'] if env.has_key('POAUTOINIT') else False # Well, if everything outside works well, this loop should do single # iteration. Otherwise we are rebuilding all the targets even, if just # one has changed (but is this out fault?). @@ -371,7 +367,6 @@ def _detect_xgettext(env): if xgettext: return xgettext raise SCons.Errors.StopError(XgettextNotFound,"Could not detect xgettext") - return None ############################################################################# def _xgettext_exists(env): return _detect_xgettext(env) @@ -386,7 +381,6 @@ def _detect_msginit(env): if msginit: return msginit raise SCons.Errors.StopError(MsginitNotFound, "Could not detect msginit") - return None ############################################################################# def _msginit_exists(env): return _detect_msginit(env) @@ -401,7 +395,6 @@ def _detect_msgmerge(env): if msgmerge: return msgmerge raise SCons.Errors.StopError(MsgmergeNotFound, "Could not detect msgmerge") - return None ############################################################################# def _msgmerge_exists(env): return _detect_msgmerge(env) @@ -416,7 +409,6 @@ def _detect_msgfmt(env): if msgfmt: return msgfmt raise SCons.Errors.StopError(MsgfmtNotFound, "Could not detect msgfmt") - return None ############################################################################# def _msgfmt_exists(env): return _detect_msgfmt(env) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/common.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/common.py index 6d8d555969..5e4ee76031 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/common.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/common.py @@ -117,7 +117,7 @@ def normalize_env(env, keys, force=False): normenv[k] = copy.deepcopy(env[k]).encode('mbcs') for k in keys: - if k in os.environ and (force or not k in normenv): + if k in os.environ and (force or k not in normenv): normenv[k] = os.environ[k].encode('mbcs') # This shouldn't be necessary, since the default environment should include system32, diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/sdk.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/sdk.py index b3a53d9de0..7702966f26 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/sdk.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/sdk.py @@ -386,8 +386,8 @@ def mssdk_setup_env(env): mssdk = get_sdk_by_version(sdk_version) if not mssdk: mssdk = get_default_sdk() - if not mssdk: - return + if not mssdk: + return sdk_dir = mssdk.get_sdk_dir() debug('sdk.py:mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir) else: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vc.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vc.py index 2ed77d6bb1..c2fe307d3f 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vc.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vc.py @@ -349,19 +349,19 @@ def get_default_version(env): debug('get_default_version(): msvc_version:%s msvs_version:%s'%(msvc_version,msvs_version)) - if msvs_version and not msvc_version: - SCons.Warnings.warn( - SCons.Warnings.DeprecatedWarning, - "MSVS_VERSION is deprecated: please use MSVC_VERSION instead ") - return msvs_version - elif msvc_version and msvs_version: - if not msvc_version == msvs_version: + if msvs_version: + if not msvc_version: SCons.Warnings.warn( - SCons.Warnings.VisualVersionMismatch, - "Requested msvc version (%s) and msvs version (%s) do " \ - "not match: please use MSVC_VERSION only to request a " \ - "visual studio version, MSVS_VERSION is deprecated" \ - % (msvc_version, msvs_version)) + SCons.Warnings.DeprecatedWarning, + "MSVS_VERSION is deprecated: please use MSVC_VERSION instead ") + else: + if msvc_version != msvs_version: + SCons.Warnings.warn( + SCons.Warnings.VisualVersionMismatch, + "Requested msvc version (%s) and msvs version (%s) do " \ + "not match: please use MSVC_VERSION only to request a " \ + "visual studio version, MSVS_VERSION is deprecated" \ + % (msvc_version, msvs_version)) return msvs_version if not msvc_version: installed_vcs = cached_get_installed_vcs() diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vs.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vs.py index b2c8e994ce..c88590faa2 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vs.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/MSCommon/vs.py @@ -98,11 +98,7 @@ def find_vs_dir(self): """ - if True: - vs_dir=self.find_vs_dir_by_reg() - return vs_dir - else: - return self.find_vs_dir_by_vc() + return self.find_vs_dir_by_reg() def find_executable(self): vs_dir = self.get_vs_dir() @@ -514,7 +510,7 @@ def get_default_arch(env): if not msvs: arch = 'x86' - elif not arch in msvs.get_supported_arch(): + elif arch not in msvs.get_supported_arch(): fmt = "Visual Studio version %s does not support architecture %s" raise SCons.Errors.UserError(fmt % (env['MSVS_VERSION'], arch)) @@ -556,8 +552,7 @@ def query_versions(): """Query the system to get available versions of VS. A version is considered when a batfile is found.""" msvs_list = get_installed_visual_studios() - versions = [msvs.version for msvs in msvs_list] - return versions + return [msvs.version for msvs in msvs_list] # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/PharLapCommon.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/PharLapCommon.py index 63c5a028d4..d3ded2f4a5 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/PharLapCommon.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/PharLapCommon.py @@ -95,15 +95,12 @@ def addPathIfNotExists(env_dict, key, path, sep=os.pathsep): try: is_list = 1 paths = env_dict[key] - if not SCons.Util.is_List(env_dict[key]): + if not SCons.Util.is_List(paths): paths = paths.split(sep) is_list = 0 if os.path.normcase(path) not in list(map(os.path.normcase, paths)): paths = [ path ] + paths - if is_list: - env_dict[key] = paths - else: - env_dict[key] = sep.join(paths) + env_dict[key] = paths if is_list else sep.join(paths) except KeyError: env_dict[key] = path diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/cc.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/cc.py index 5b5ab05ce2..546d9b3a4e 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/cc.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/cc.py @@ -54,7 +54,7 @@ def add_common_cc_variables(env): env['FRAMEWORKS'] = SCons.Util.CLVar('') env['FRAMEWORKPATH'] = SCons.Util.CLVar('') if env['PLATFORM'] == 'darwin': - env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH' + env['_CCCOMCOM'] += ' $_FRAMEWORKPATH' if 'CCFLAGS' not in env: env['CCFLAGS'] = SCons.Util.CLVar('') diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/docbook/__init__.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/docbook/__init__.py index 07a4ff2eab..8d1acc8f0e 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/docbook/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/docbook/__init__.py @@ -142,10 +142,7 @@ def __create_output_dir(base_dir): root, tail = os.path.split(base_dir) dir = None if tail: - if base_dir.endswith('/'): - dir = base_dir - else: - dir = root + dir = base_dir if base_dir.endswith('/') else root else: if base_dir.endswith('/'): dir = base_dir @@ -329,11 +326,7 @@ def __build_lxml(target, source, env): doc = etree.parse(str(source[0])) # Support for additional parameters parampass = {} - if parampass: - result = transform(doc, **parampass) - else: - result = transform(doc) - + result = transform(doc, **parampass) if parampass else transform(doc) try: of = open(str(target[0]), "w") of.write(of.write(etree.tostring(result, pretty_print=True))) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/filesystem.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/filesystem.py index ad018e9319..fc97bf5a24 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/filesystem.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/filesystem.py @@ -44,7 +44,7 @@ def copyto_emitter(target, source, env): n_target = [] for t in target: - n_target = n_target + [t.File( str( s ) ) for s in source] + n_target += [t.File( str( s ) ) for s in source] return (n_target, source) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/g++.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/g++.py index d59a650805..a77393ab34 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/g++.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/g++.py @@ -60,9 +60,7 @@ def generate(env): env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -mminimal-toc') env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['SHOBJSUFFIX'] = '$OBJSUFFIX' - elif env['PLATFORM'] == 'hpux': - env['SHOBJSUFFIX'] = '.pic.o' - elif env['PLATFORM'] == 'sunos': + elif env['PLATFORM'] in ['hpux', 'sunos']: env['SHOBJSUFFIX'] = '.pic.o' # determine compiler version version = gcc.detect_version(env, env['CXX']) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/install.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/install.py index 171674bed0..06d61f8fa2 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/install.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/install.py @@ -269,10 +269,7 @@ def stringFunc(target, source, env): return env.subst_target_source(installstr, 0, target, source) target = str(target[0]) source = str(source[0]) - if os.path.isdir(source): - type = 'directory' - else: - type = 'file' + type = 'directory' if os.path.isdir(source) else 'file' return 'Install %s: "%s" as "%s"' % (type, source, target) # diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/intelc.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/intelc.py index b39518b68c..a86a78a98c 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/intelc.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/intelc.py @@ -66,9 +66,7 @@ def uniquify(s): """Return a sequence containing only one copy of each unique element from input sequence s. Does not preserve order. Input sequence must be hashable (i.e. must be usable as a dictionary key).""" - u = {} - for x in s: - u[x] = 1 + u = {x: 1 for x in s} return list(u.keys()) def linux_ver_normalize(vstr): @@ -85,11 +83,8 @@ def linux_ver_normalize(vstr): return float(vmaj) * 10. + float(vmin) + float(build) / 1000.; else: f = float(vstr) - if is_windows: - return f - else: - if f < 60: return f * 10.0 - else: return f + if not is_windows and f < 60: return f * 10.0 + else: return f def check_abi(abi): """Check for valid ABI (application binary interface) name, @@ -593,9 +588,7 @@ def exists(env): # try env.Detect, maybe that will work if is_windows: return env.Detect('icl') - elif is_linux: - return env.Detect('icc') - elif is_mac: + else: return env.Detect('icc') return detected diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mingw.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mingw.py index 508ac9a24d..6bfc035c94 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mingw.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mingw.py @@ -90,7 +90,7 @@ def shlib_generator(target, source, env, 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: \ + if insert_def not in ['', '0', 0] and def_target: \ cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) return [cmd] diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msginit.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msginit.py index 6492e8014d..4139fbb74d 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msginit.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msginit.py @@ -35,10 +35,7 @@ def _optional_no_translator_flag(env): """ Return '--no-translator' flag if we run *msginit(1)* in non-interactive mode.""" import SCons.Util - if env.has_key('POAUTOINIT'): - autoinit = env['POAUTOINIT'] - else: - autoinit = False + autoinit = env['POAUTOINIT'] if env.has_key('POAUTOINIT') else False if autoinit: return [SCons.Util.CLVar('--no-translator')] else: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mslink.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mslink.py index 6919585160..5890afb4e8 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mslink.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/mslink.py @@ -106,8 +106,9 @@ def _dllEmitter(target, source, env, paramtp): raise SCons.Errors.UserError('A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp)) insert_def = env.subst("$WINDOWS_INSERT_DEF") - if not insert_def in ['', '0', 0] and \ - not env.FindIxes(source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX"): + if insert_def not in ['', '0', 0] and not env.FindIxes( + source, "WINDOWSDEFPREFIX", "WINDOWSDEFSUFFIX" + ): # append a def file to the list of sources extrasources.append( diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvc.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvc.py index b236d8941e..d601c3c141 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvc.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvc.py @@ -146,7 +146,12 @@ def msvc_batch_key(action, env, target, source): # Note we need to do the env.subst so $MSVC_BATCH can be a reference to # another construction variable, which is why we test for False and 0 # as strings. - if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None): + if 'MSVC_BATCH' not in env or env.subst('$MSVC_BATCH') in ( + '0', + 'False', + '', + None, + ): # We're not using batching; return no key. return None t = target[0] @@ -172,7 +177,12 @@ def msvc_output_flag(target, source, env, for_signature): # len(source)==1 as batch mode can compile only one file # (and it also fixed problem with compiling only one changed file # with batch mode enabled) - if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None): + if 'MSVC_BATCH' not in env or env.subst('$MSVC_BATCH') in ( + '0', + 'False', + '', + None, + ): return '/Fo$TARGET' else: # The Visual C/C++ compiler requires a \ at the end of the /Fo diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvs.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvs.py index d2d0b23847..0fecd8b3a9 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvs.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/msvs.py @@ -132,7 +132,7 @@ def relpath(path, start=os.path.curdir): return os.path.curdir return os.path.join(*rel_list) -if not "relpath" in os.path.__all__: +if "relpath" not in os.path.__all__: os.path.relpath = relpath # This is how we re-invoke SCons from inside MSVS Project files. @@ -636,10 +636,7 @@ def __init__(self, dspfile, source, env): self.dspheader = V8DSPHeader self.dspconfiguration = V8DSPConfiguration else: - if self.version_num >= 7.1: - self.versionstr = '7.10' - else: - self.versionstr = '7.00' + self.versionstr = '7.10' if self.version_num >= 7.1 else '7.00' self.dspheader = V7DSPHeader self.dspconfiguration = V7DSPConfiguration self.file = None @@ -691,6 +688,7 @@ def PrintProject(self): self.file.write('\t\n') confkeys = sorted(self.configs.keys()) + starting = 'echo Starting SCons && ' for kind in confkeys: variant = self.configs[kind].variant platform = self.configs[kind].platform @@ -703,11 +701,7 @@ def PrintProject(self): if not env_has_buildtarget: self.env['MSVSBUILDTARGET'] = buildtarget - starting = 'echo Starting SCons && ' - if cmdargs: - cmdargs = ' ' + cmdargs - else: - cmdargs = '' + cmdargs = ' ' + cmdargs if cmdargs else '' buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs) rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs) cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs) @@ -774,8 +768,10 @@ def PrintSourceFiles(self): self.file.write('\t\n') - cats = sorted([k for k in categories.keys() if self.sources[k]], - key=lambda a: a.lower()) + cats = sorted( + [k for k in categories if self.sources[k]], key=lambda a: a.lower() + ) + for kind in cats: if len(cats) > 1: self.file.write('\t\t\n') @@ -1293,7 +1291,7 @@ def Parse(self): line = dswfile.readline() datas = line - while line: + while datas: line = dswfile.readline() datas = datas + line @@ -1337,7 +1335,6 @@ def PrintSolution(self): env = self.env if 'MSVS_SCC_PROVIDER' in env: scc_number_of_projects = len(self.dspfiles) + 1 - slnguid = self.slnguid scc_provider = env.get('MSVS_SCC_PROVIDER', '').replace(' ', r'\u0020') scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '').replace(' ', r'\u0020') scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir) @@ -1353,6 +1350,7 @@ def PrintSolution(self): self.file.write('\t\tSccProjectFilePathRelativizedFromConnection0 = %s\\\\\n' % sln_relative_path_from_scc.replace('\\', '\\\\')) if self.version_num < 8.0: + slnguid = self.slnguid # When present, SolutionUniqueID is automatically removed by VS 2005 # TODO: check for Visual Studio versions newer than 2005 self.file.write('\t\tSolutionUniqueID = %s\n' % slnguid) @@ -1380,7 +1378,7 @@ def PrintSolution(self): self.file.write('\t\t%s|%s = %s|%s\n' % (variant, platform, variant, platform)) else: self.file.write('\t\tConfigName.%d = %s\n' % (cnt, variant)) - cnt = cnt + 1 + cnt += 1 self.file.write('\tEndGlobalSection\n') if self.version_num <= 7.1: self.file.write('\tGlobalSection(ProjectDependencies) = postSolution\n' @@ -1393,14 +1391,12 @@ def PrintSolution(self): for name in confkeys: variant = self.configs[name].variant platform = self.configs[name].platform - if self.version_num >= 8.0: - for dspinfo in self.dspfiles_info: - guid = dspinfo['GUID'] + for dspinfo in self.dspfiles_info: + guid = dspinfo['GUID'] + if self.version_num >= 8.0: self.file.write('\t\t%s.%s|%s.ActiveCfg = %s|%s\n' '\t\t%s.%s|%s.Build.0 = %s|%s\n' % (guid,variant,platform,variant,platform,guid,variant,platform,variant,platform)) - else: - for dspinfo in self.dspfiles_info: - guid = dspinfo['GUID'] + else: self.file.write('\t\t%s.%s.ActiveCfg = %s|%s\n' '\t\t%s.%s.Build.0 = %s|%s\n' %(guid,variant,variant,platform,guid,variant,variant,platform)) @@ -1488,13 +1484,12 @@ def GenerateDSP(dspfile, source, env): version_num, suite = msvs_parse_version(env['MSVS_VERSION']) if version_num >= 10.0: g = _GenerateV10DSP(dspfile, source, env) - g.Build() elif version_num >= 7.0: g = _GenerateV7DSP(dspfile, source, env) - g.Build() else: g = _GenerateV6DSP(dspfile, source, env) - g.Build() + + g.Build() def GenerateDSW(dswfile, source, env): """Generates a Solution/Workspace file based on the version of MSVS that is being used""" @@ -1504,10 +1499,10 @@ def GenerateDSW(dswfile, source, env): version_num, suite = msvs_parse_version(env['MSVS_VERSION']) if version_num >= 7.0: g = _GenerateV7DSW(dswfile, source, env) - g.Build() else: g = _GenerateV6DSW(dswfile, source, env) - g.Build() + + g.Build() ############################################################################## @@ -1573,56 +1568,60 @@ def projectEmitter(target, source, env): if not source: source = 'prj_inputs:' - source = source + env.subst('$MSVSSCONSCOM', 1) - source = source + env.subst('$MSVSENCODING', 1) + source += env.subst('$MSVSSCONSCOM', 1) + source += env.subst('$MSVSENCODING', 1) # Project file depends on CPPDEFINES and CPPPATH preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', [])))) includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None) includepath = xmlify(';'.join([str(x) for x in includepath_Dirs])) - source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) + source += "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) if 'buildtarget' in env and env['buildtarget'] != None: if SCons.Util.is_String(env['buildtarget']): - source = source + ' "%s"' % env['buildtarget'] + source += ' "%s"' % env['buildtarget'] elif SCons.Util.is_List(env['buildtarget']): for bt in env['buildtarget']: if SCons.Util.is_String(bt): - source = source + ' "%s"' % bt + source += ' "%s"' % bt else: - try: source = source + ' "%s"' % bt.get_abspath() + try: + source += ' "%s"' % bt.get_abspath() except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") else: - try: source = source + ' "%s"' % env['buildtarget'].get_abspath() + try: + source += ' "%s"' % env['buildtarget'].get_abspath() except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") if 'outdir' in env and env['outdir'] != None: if SCons.Util.is_String(env['outdir']): - source = source + ' "%s"' % env['outdir'] + source += ' "%s"' % env['outdir'] elif SCons.Util.is_List(env['outdir']): for s in env['outdir']: if SCons.Util.is_String(s): - source = source + ' "%s"' % s + source += ' "%s"' % s else: - try: source = source + ' "%s"' % s.get_abspath() + try: + source += ' "%s"' % s.get_abspath() except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") else: - try: source = source + ' "%s"' % env['outdir'].get_abspath() + try: + source += ' "%s"' % env['outdir'].get_abspath() except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") if 'name' in env: if SCons.Util.is_String(env['name']): - source = source + ' "%s"' % env['name'] + source += ' "%s"' % env['name'] else: raise SCons.Errors.InternalError("name must be a string") if 'variant' in env: if SCons.Util.is_String(env['variant']): - source = source + ' "%s"' % env['variant'] + source += ' "%s"' % env['variant'] elif SCons.Util.is_List(env['variant']): for variant in env['variant']: if SCons.Util.is_String(variant): - source = source + ' "%s"' % variant + source += ' "%s"' % variant else: raise SCons.Errors.InternalError("name must be a string or a list of strings") else: @@ -1633,17 +1632,17 @@ def projectEmitter(target, source, env): for s in _DSPGenerator.srcargs: if s in env: if SCons.Util.is_String(env[s]): - source = source + ' "%s' % env[s] + source += ' "%s' % env[s] elif SCons.Util.is_List(env[s]): for t in env[s]: if SCons.Util.is_String(t): - source = source + ' "%s"' % t + source += ' "%s"' % t else: raise SCons.Errors.InternalError(s + " must be a string or a list of strings") else: raise SCons.Errors.InternalError(s + " must be a string or a list of strings") - source = source + ' "%s"' % str(target[0]) + source += ' "%s"' % str(target[0]) source = [SCons.Node.Python.Value(source)] targetlist = [target[0]] @@ -1652,7 +1651,7 @@ def projectEmitter(target, source, env): if env.get('auto_build_solution', 1): env['projects'] = [env.File(t).srcnode() for t in targetlist] t, s = solutionEmitter(target, target, env) - targetlist = targetlist + t + targetlist += t # Beginning with Visual Studio 2010 for each project file (.vcxproj) we have additional file (.vcxproj.filters) if float(env['MSVS_VERSION']) >= 10.0: @@ -1679,17 +1678,17 @@ def solutionEmitter(target, source, env): if 'name' in env: if SCons.Util.is_String(env['name']): - source = source + ' "%s"' % env['name'] + source += ' "%s"' % env['name'] else: raise SCons.Errors.InternalError("name must be a string") if 'variant' in env: if SCons.Util.is_String(env['variant']): - source = source + ' "%s"' % env['variant'] + source += ' "%s"' % env['variant'] elif SCons.Util.is_List(env['variant']): for variant in env['variant']: if SCons.Util.is_String(variant): - source = source + ' "%s"' % variant + source += ' "%s"' % variant else: raise SCons.Errors.InternalError("name must be a string or a list of strings") else: @@ -1699,19 +1698,19 @@ def solutionEmitter(target, source, env): if 'slnguid' in env: if SCons.Util.is_String(env['slnguid']): - source = source + ' "%s"' % env['slnguid'] + source += ' "%s"' % env['slnguid'] else: raise SCons.Errors.InternalError("slnguid must be a string") if 'projects' in env: if SCons.Util.is_String(env['projects']): - source = source + ' "%s"' % env['projects'] + source += ' "%s"' % env['projects'] elif SCons.Util.is_List(env['projects']): for t in env['projects']: if SCons.Util.is_String(t): - source = source + ' "%s"' % t + source += ' "%s"' % t - source = source + ' "%s"' % str(target[0]) + source += ' "%s"' % str(target[0]) source = [SCons.Node.Python.Value(source)] return ([target[0]], source) @@ -1782,11 +1781,7 @@ def generate(env): env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' env['MSVS']['SOLUTIONSUFFIX'] = '.sln' - if (version_num >= 10.0): - env['MSVSENCODING'] = 'utf-8' - else: - env['MSVSENCODING'] = 'Windows-1252' - + env['MSVSENCODING'] = 'utf-8' if (version_num >= 10.0) else 'Windows-1252' env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}' diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/rmic.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/rmic.py index 0539a502f3..ccb04de316 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/rmic.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/rmic.py @@ -58,11 +58,7 @@ class files to be created from a set of class files. except AttributeError: classdir = '.' classdir = env.Dir(classdir).rdir() - if str(classdir) == '.': - c_ = None - else: - c_ = str(classdir) + os.sep - + c_ = None if str(classdir) == '.' else str(classdir) + os.sep slist = [] for src in source: try: diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/sunc++.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/sunc++.py index 3fbccad009..c4b8a877a7 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/sunc++.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/sunc++.py @@ -93,11 +93,7 @@ def get_package_info(package_name, pkginfo, pkgchk): # version of it is installed def get_cppc(env): cxx = env.subst('$CXX') - if cxx: - cppcPath = os.path.dirname(cxx) - else: - cppcPath = None - + cppcPath = os.path.dirname(cxx) if cxx else None cppcVersion = None pkginfo = env.subst('$PKGINFO') diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/xgettext.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/xgettext.py index 216b05a0fc..d9271b810e 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/xgettext.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Tool/xgettext.py @@ -63,8 +63,7 @@ def strfunction(self, target, source, env): comstr = self.commandstr if env.subst(comstr, target = target, source = source) == "": comstr = self.command - s = env.subst(comstr, target = target, source = source) - return s + return env.subst(comstr, target = target, source = source) ############################################################################# ############################################################################# @@ -139,12 +138,12 @@ def _update_pot_file(target, source, env): f = open(str(target[0]),"w") f.write(new_content) f.close() - return 0 else: # Print message employing SCons.Action.Action for that. msg = "Not writting " + repr(str(target[0])) + " (" + explain + ")" env.Execute(SCons.Action.Action(nop, msg)) - return 0 + + return 0 ############################################################################# ############################################################################# @@ -175,10 +174,7 @@ def _scan_xgettext_from_files(target, source, env, files = None, path = None): files = [ files ] if path is None: - if env.has_key('XGETTEXTPATH'): - path = env['XGETTEXTPATH'] - else: - path = [] + path = env['XGETTEXTPATH'] if env.has_key('XGETTEXTPATH') else [] if not SCons.Util.is_List(path): path = [ path ] diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py index 7669698d6a..b1c61a184f 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/Util.py @@ -184,11 +184,7 @@ def render_tree(root, child_func, prune=0, margin=[0], visited={}): children = child_func(root) retval = "" for pipe in margin[:-1]: - if pipe: - retval = retval + "| " - else: - retval = retval + " " - + retval += "| " if pipe else " " if rname in visited: return retval + "+-[" + rname + "]\n" @@ -199,8 +195,8 @@ def render_tree(root, child_func, prune=0, margin=[0], visited={}): for i in range(len(children)): margin.append(i len(other): # Fast check for obvious cases return False - for elt in filterfalse(other._data.has_key, self): + for _ in filterfalse(other._data.has_key, self): return False return True @@ -298,7 +295,7 @@ def issuperset(self, other): self._binary_sanity_check(other) if len(self) < len(other): # Fast check for obvious cases return False - for elt in filterfalse(self._data.has_key, other): + for _ in filterfalse(self._data.has_key, other): return False return True diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/compat/_scons_subprocess.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/compat/_scons_subprocess.py index eebe53d345..5d2b23d0ce 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/compat/_scons_subprocess.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/compat/_scons_subprocess.py @@ -673,21 +673,20 @@ def communicate(self, input=None): # Optimization: If we are only using one pipe, or no pipe at # all, using select() or threads is unnecessary. - if [self.stdin, self.stdout, self.stderr].count(None) >= 2: - stdout = None - stderr = None - if self.stdin: - if input: - self.stdin.write(input) - self.stdin.close() - elif self.stdout: - stdout = self.stdout.read() - elif self.stderr: - stderr = self.stderr.read() - self.wait() - return (stdout, stderr) - - return self._communicate(input) + if [self.stdin, self.stdout, self.stderr].count(None) < 2: + return self._communicate(input) + stdout = None + stderr = None + if self.stdin: + if input: + self.stdin.write(input) + self.stdin.close() + elif self.stdout: + stdout = self.stdout.read() + elif self.stderr: + stderr = self.stderr.read() + self.wait() + return (stdout, stderr) if mswindows: @@ -860,9 +859,11 @@ def _execute_child(self, args, executable, preexec_fn, close_fds, def poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" - if self.returncode is None: - if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0: - self.returncode = GetExitCodeProcess(self._handle) + if ( + self.returncode is None + and WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0 + ): + self.returncode = GetExitCodeProcess(self._handle) return self.returncode @@ -1171,7 +1172,7 @@ def _communicate(self, input): # blocking. POSIX defines PIPE_BUF >= 512 m = memoryview(input)[input_offset:input_offset+512] bytes_written = os.write(self.stdin.fileno(), m) - input_offset = input_offset + bytes_written + input_offset += bytes_written if input_offset >= len(input): self.stdin.close() write_set.remove(self.stdin) diff --git a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/cpp.py b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/cpp.py index 35acf84728..6d353c1e5d 100644 --- a/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/cpp.py +++ b/nuitka/build/inline_copy/lib/scons-2.3.2/SCons/cpp.py @@ -208,7 +208,7 @@ def __call__(self, *values): parts = [] for s in self.expansion: - if not s in self.args: + if s not in self.args: s = repr(s) parts.append(s) statement = ' + '.join(parts) @@ -370,10 +370,7 @@ def find_include_file(self, t): """ fname = t[2] for d in self.searchpath[t[1]]: - if d == os.curdir: - f = fname - else: - f = os.path.join(d, fname) + f = fname if d == os.curdir else os.path.join(d, fname) if os.path.isfile(f): return f return None @@ -546,7 +543,7 @@ def resolve_include(self, t): where FILE is a #define somewhere else. """ s = t[1] - while not s[0] in '<"': + while s[0] not in '<"': #print "s =", s try: s = self.cpp_namespace[s] diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Action.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Action.py index b4310f6e40..bfb2f56963 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Action.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Action.py @@ -324,8 +324,7 @@ def _function_contents(func): contents.append(bytearray(b',').join(closure_contents)) contents.append(b')') - retval = bytearray(b'').join(contents) - return retval + return bytearray(b'').join(contents) def _object_instance_content(obj): @@ -477,10 +476,7 @@ def _do_create_action(act, kw): del kw['generator'] except KeyError: gen = 0 - if gen: - action_type = CommandGeneratorAction - else: - action_type = FunctionAction + action_type = CommandGeneratorAction if gen else FunctionAction return action_type(act, kw) # Catch a common error case with a nice message: @@ -654,8 +650,8 @@ def __call__(self, target, source, env, if presub is _null: presub = self.presub - if presub is _null: - presub = print_actions_presub + if presub is _null: + presub = print_actions_presub if exitstatfunc is _null: exitstatfunc = self.exitstatfunc if show is _null: show = print_actions if execute is _null: execute = execute_actions @@ -847,10 +843,9 @@ def __init__(self, cmd, **kw): if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandAction') _ActionAction.__init__(self, **kw) - if is_List(cmd): - if [c for c in cmd if is_List(c)]: - raise TypeError("CommandAction should be given only " - "a single command") + if is_List(cmd) and [c for c in cmd if is_List(c)]: + raise TypeError("CommandAction should be given only " + "a single command") self.cmd_list = cmd def __str__(self): @@ -966,10 +961,7 @@ def get_presig(self, target, source, env, executor=None): """ from SCons.Subst import SUBST_SIG cmd = self.cmd_list - if is_List(cmd): - cmd = ' '.join(map(str, cmd)) - else: - cmd = str(cmd) + cmd = ' '.join(map(str, cmd)) if is_List(cmd) else str(cmd) if executor: return env.subst_target_source(cmd, SUBST_SIG, executor=executor) else: @@ -1103,10 +1095,7 @@ def get_parent_class(self, env): return CommandGeneratorAction def _generate_cache(self, env): - if env: - c = env.get(self.var, '') - else: - c = '' + c = env.get(self.var, '') if env else '' gen_cmd = Action(c, **self.gen_kw) if not gen_cmd: raise SCons.Errors.UserError("$%s value %s cannot be used to create an Action." % (self.var, repr(c))) @@ -1395,8 +1384,7 @@ def __init__(self, actfunc, strfunc, convert=lambda x: x): def __call__(self, *args, **kw): ac = ActionCaller(self, args, kw) - action = Action(ac, strfunction=ac.strfunction) - return action + return Action(ac, strfunction=ac.strfunction) # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Builder.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Builder.py index e4e521542c..2e3bfed993 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Builder.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Builder.py @@ -120,7 +120,7 @@ def match_splitext(path, suffixes = []): if suffixes: matchsuf = [S for S in suffixes if path[-len(S):] == S] if matchsuf: - suf = max([(len(_f),_f) for _f in matchsuf])[1] + suf = max((len(_f),_f) for _f in matchsuf)[1] return [path[:-len(suf)], path[-len(suf):]] return SCons.Util.splitext(path) @@ -460,10 +460,7 @@ def __eq__(self, other): def splitext(self, path, env=None): if not env: env = self.env - if env: - suffixes = self.src_suffixes(env) - else: - suffixes = [] + suffixes = self.src_suffixes(env) if env else [] return match_splitext(path, suffixes) def _adjustixes(self, files, pre, suf, ensure_suffix=False): @@ -651,7 +648,7 @@ def prependDirIfRelative(f, srcdir=kw['srcdir']): return self._execute(env, target, source, OverrideWarner(kw), ekw) def adjust_suffix(self, suff): - if suff and not suff[0] in [ '.', '_', '$' ]: + if suff and suff[0] not in ['.', '_', '$']: return '.' + suff return suff diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/CacheDir.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/CacheDir.py index 20a7df4b89..5b9ec0d879 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/CacheDir.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/CacheDir.py @@ -138,7 +138,7 @@ def CachePushFunc(target, source, env): # Nasty hack to cut down to one warning for each cachedir path that needs # upgrading. -warned = dict() +warned = {} class CacheDir(object): @@ -156,7 +156,7 @@ def __init__(self, path): self.path = path self.current_cache_debug = None self.debugFP = None - self.config = dict() + self.config = {} if path is None: return diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Conftest.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Conftest.py index c24adf8c3f..e5ac50c171 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Conftest.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Conftest.py @@ -666,10 +666,7 @@ def CheckLib(context, libs, func_name = None, header = None, l = [ lib_name ] if extra_libs: l.extend(extra_libs) - if append: - oldLIBS = context.AppendLIBS(l) - else: - oldLIBS = context.PrependLIBS(l) + oldLIBS = context.AppendLIBS(l) if append else context.PrependLIBS(l) sym = "HAVE_LIB" + lib_name else: oldLIBS = -1 @@ -756,11 +753,7 @@ def _Have(context, key, have, comment = None): else: line = "#define %s %s\n" % (key_up, str(have)) - if comment is not None: - lines = "\n/* %s */\n" % comment + line - else: - lines = "\n" + line - + lines = "\n/* %s */\n" % comment + line if comment is not None else "\n" + line if context.headerfilename: f = open(context.headerfilename, "a") f.write(lines) @@ -782,7 +775,7 @@ def _LogFailed(context, text, msg): n = 1 for line in lines: context.Log("%d: %s\n" % (n, line)) - n = n + 1 + n += 1 if LogErrorMessages: context.Log("Error message: %s\n" % msg) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Debug.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Debug.py index ef7dfffe8f..6df00e6abd 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Debug.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Debug.py @@ -75,10 +75,7 @@ def listLoggedInstances(classes, file=sys.stdout): for classname in string_to_classes(classes): file.write('\n%s:\n' % classname) for ref in tracked_classes[classname]: - if inspect.isclass(ref): - obj = ref() - else: - obj = ref + obj = ref() if inspect.isclass(ref) else ref if obj is not None: file.write(' %s\n' % repr(obj)) @@ -197,11 +194,7 @@ def func_shorten(func_tuple): TraceFP = {} -if sys.platform == 'win32': - TraceDefault = 'con' -else: - TraceDefault = '/dev/tty' - +TraceDefault = 'con' if sys.platform == 'win32' else '/dev/tty' TimeStampDefault = None StartTime = time.time() PreviousTime = StartTime diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Defaults.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Defaults.py index a1522d2498..e5985d869d 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Defaults.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Defaults.py @@ -110,7 +110,7 @@ def SharedObjectEmitter(target, source, env): def SharedFlagChecker(source, target, env): same = env.subst('$STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME') - if same == '0' or same == '' or same == 'False': + if same in ['0', '', 'False']: for src in source: try: shared = src.attributes.shared @@ -163,9 +163,7 @@ def SharedFlagChecker(source, target, env): def get_paths_str(dest): # If dest is a list, we need to manually call str() on each element if SCons.Util.is_List(dest): - elem_strs = [] - for element in dest: - elem_strs.append('"' + str(element) + '"') + elem_strs = ['"' + str(element) + '"' for element in dest] return '[' + ', '.join(elem_strs) + ']' else: return '"' + str(dest) + '"' @@ -219,17 +217,17 @@ def chmod_func(dest, mode): for u in user: for p in permission: try: - new_perm = new_perm | permission_dic[u][p] + new_perm |= permission_dic[u][p] except KeyError: raise SyntaxError("Unrecognized user or permission format") for element in dest: curr_perm = os.stat(str(element)).st_mode - if operator == "=": - os.chmod(str(element), new_perm) - elif operator == "+": + if operator == "+": os.chmod(str(element), curr_perm | new_perm) elif operator == "-": os.chmod(str(element), curr_perm & ~new_perm) + elif operator == "=": + os.chmod(str(element), new_perm) def chmod_strfunc(dest, mode): import SCons.Util diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Environment.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Environment.py index c51df4009e..301b00b193 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Environment.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Environment.py @@ -375,9 +375,7 @@ def __init__(self, **kw): def _init_special(self): """Initial the dispatch tables for special handling of special construction variables.""" - self._special_del = {} - self._special_del['SCANNERS'] = _del_SCANNERS - + self._special_del = {'SCANNERS': _del_SCANNERS} self._special_set = {} for key in reserved_construction_var_names: self._special_set[key] = _set_reserved @@ -830,7 +828,7 @@ def MergeFlags(self, args, unique=1, dict=None): else: if not orig: orig = value - elif value: + else: # Add orig and value. The logic here was lifted from # part of env.Append() (see there for a lot of comments # about the order in which things are tried) and is @@ -943,8 +941,8 @@ def __init__(self, if platform is None: platform = self._dict.get('PLATFORM', None) - if platform is None: - platform = SCons.Platform.Platform() + if platform is None: + platform = SCons.Platform.Platform() if SCons.Util.is_String(platform): platform = SCons.Platform.Platform(platform) self._dict['PLATFORM'] = str(platform) @@ -969,7 +967,7 @@ def __init__(self, self.Replace(**kw) keys = list(kw.keys()) if variables: - keys = keys + list(variables.keys()) + keys += list(variables.keys()) variables.Update(self) save = {} @@ -985,8 +983,8 @@ def __init__(self, if tools is None: tools = self._dict.get('TOOLS', None) - if tools is None: - tools = ['default'] + if tools is None: + tools = ['default'] apply_tools(self, tools, toolpath) # Now restore the passed-in and customized variables @@ -1339,10 +1337,9 @@ def AppendUnique(self, delete_existing=0, **kw): val = [(val,)] if delete_existing: dk = list(filter(lambda x, val=val: x not in val, dk)) - self._dict[key] = dk + val else: dk = [x for x in dk if x not in val] - self._dict[key] = dk + val + self._dict[key] = dk + val else: # By elimination, val is not a list. Since dk is a # list, wrap val in a list first. @@ -1365,10 +1362,7 @@ def AppendUnique(self, delete_existing=0, **kw): tmp.append((k,)) dk = tmp if SCons.Util.is_String(val): - if val in dk: - val = [] - else: - val = [val] + val = [] if val in dk else [val] elif SCons.Util.is_Dict(val): tmp = [] for i,j in val.items(): @@ -1527,11 +1521,7 @@ def Dump(self, key=None): """ import pprint pp = pprint.PrettyPrinter(indent=2) - if key: - cvars = self.Dictionary(key) - else: - cvars = self.Dictionary() - + cvars = self.Dictionary(key) if key else self.Dictionary() # TODO: pprint doesn't do a nice job on path-style values # if the paths contain spaces (i.e. Windows), because the # algorithm tries to break lines on spaces, while breaking @@ -1952,7 +1942,7 @@ def Clean(self, targets, files): def Configure(self, *args, **kw): nargs = [self] if args: - nargs = nargs + self.subst_list(args)[0] + nargs += self.subst_list(args)[0] nkw = self.subst_kw(kw) nkw['_depth'] = kw.get('_depth', 0) + 1 try: diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Executor.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Executor.py index 5c95e95c54..186c932b41 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Executor.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Executor.py @@ -188,10 +188,7 @@ def __init__(self, action, env=None, overridelist=[{}], self.post_actions = [] self.env = env self.overridelist = overridelist - if targets or sources: - self.batches = [Batch(targets[:], sources[:])] - else: - self.batches = [] + self.batches = [Batch(targets[:], sources[:])] if targets or sources else [] self.builder_kw = builder_kw self._do_execute = 1 self._execute_str = 1 @@ -538,9 +535,7 @@ def get_unignored_sources(self, node, ignore=()): else: sourcelist = self.get_all_sources() if ignore: - idict = {} - for i in ignore: - idict[i] = 1 + idict = {i: 1 for i in ignore} sourcelist = [s for s in sourcelist if s not in idict] memo_dict[key] = sourcelist diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Job.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Job.py index 214a0c9fb8..01ffcdda0b 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Job.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Job.py @@ -393,7 +393,7 @@ def start(self): if task.needs_execute(): # dispatch task self.tp.put(task) - jobs = jobs + 1 + jobs += 1 else: task.executed() task.postprocess() @@ -404,7 +404,7 @@ def start(self): # back and put the next batch of tasks on the queue. while True: task, ok = self.tp.get() - jobs = jobs - 1 + jobs -= 1 if ok: task.executed() diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/FS.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/FS.py index 65d1ac1429..b38cb1d0cd 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/FS.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/FS.py @@ -242,10 +242,7 @@ def _hardlink_func(fs, src, dst): # hard-link the final destination file. while fs.islink(src): link = fs.readlink(src) - if not os.path.isabs(link): - src = link - else: - src = os.path.join(os.path.dirname(src), link) + src = os.path.join(os.path.dirname(src), link) if os.path.isabs(link) else link fs.link(src, dst) else: _hardlink_func = None @@ -285,10 +282,9 @@ def set_duplicate(duplicate): raise SCons.Errors.InternalError("The argument of set_duplicate " "should be in Valid_Duplicates") global Link_Funcs - Link_Funcs = [] - for func in duplicate.split('-'): - if link_dict[func]: - Link_Funcs.append(link_dict[func]) + Link_Funcs = [ + link_dict[func] for func in duplicate.split('-') if link_dict[func] + ] def LinkFunc(target, source, env): """ @@ -392,10 +388,7 @@ def __init__(self, type, do, ignore): def __call__(self, *args, **kw): return self.func(*args, **kw) def set(self, list): - if self.type in list: - self.func = self.do - else: - self.func = self.ignore + self.func = self.do if self.type in list else self.ignore def do_diskcheck_match(node, predicate, errorfmt): result = predicate() @@ -1163,10 +1156,7 @@ def __init__(self, path = None): self.max_drift = default_max_drift self.Top = None - if path is None: - self.pathTop = os.getcwd() - else: - self.pathTop = path + self.pathTop = os.getcwd() if path is None else path self.defaultDrive = _my_normcase(_my_splitdrive(self.pathTop)[0]) self.Top = self.Dir(self.pathTop) @@ -1276,10 +1266,7 @@ def _lookup(self, p, directory, fsclass, create=1): # structure similar to the one found on drive C:. if do_splitdrive: drive, p = _my_splitdrive(p) - if drive: - root = self.get_root(drive) - else: - root = directory.root + root = self.get_root(drive) if drive else directory.root else: root = directory.root @@ -1331,11 +1318,7 @@ def _lookup(self, p, directory, fsclass, create=1): else: p = directory.get_labspath() + '/' + p - if drive: - root = self.get_root(drive) - else: - root = directory.root - + root = self.get_root(drive) if drive else directory.root if needs_normpath is not None: # Normalize a pathname. Will return the same result for # equivalent paths. @@ -1459,8 +1442,8 @@ def variant_dir_target_climb(self, orig, dir, tail): message = None fmt = "building associated VariantDir targets: %s" start_dir = dir - while dir: - for bd in dir.variant_dirs: + while start_dir: + for bd in start_dir.variant_dirs: if start_dir.is_under(bd): # If already in the build-dir location, don't reflect return [orig], fmt % str(orig) @@ -1677,10 +1660,7 @@ def get_all_rdirs(self): while dir: for rep in dir.getRepositories(): result.append(rep.Dir(fname)) - if fname == '.': - fname = dir.name - else: - fname = dir.name + OS_SEP + fname + fname = dir.name if fname == '.' else dir.name + OS_SEP + fname dir = dir.up() self._memo['get_all_rdirs'] = list(result) @@ -1956,7 +1936,7 @@ def entry_exists_on_disk(self, name): for entry in map(_my_normcase, entries): d[entry] = True self.on_disk_entries = d - if sys.platform == 'win32' or sys.platform == 'cygwin': + if sys.platform in ['win32', 'cygwin']: name = _my_normcase(name) result = d.get(name) if result is None: @@ -2590,12 +2570,13 @@ def prepare_dependencies(self): setattr(self, nattr, nodes) def format(self, names=0): - result = [] bkids = self.bsources + self.bdepends + self.bimplicit bkidsigs = self.bsourcesigs + self.bdependsigs + self.bimplicitsigs - for bkid, bkidsig in zip(bkids, bkidsigs): - result.append(str(bkid) + ': ' + - ' '.join(bkidsig.format(names=names))) + result = [ + str(bkid) + ': ' + ' '.join(bkidsig.format(names=names)) + for bkid, bkidsig in zip(bkids, bkidsigs) + ] + if not hasattr(self,'bact'): self.bact = "none" result.append('%s [%s]' % (self.bactsig, self.bact)) @@ -2741,11 +2722,7 @@ def get_size(self): except KeyError: pass - if self.rexists(): - size = self.rfile().getsize() - else: - size = 0 - + size = self.rfile().getsize() if self.rexists() else 0 self._memo['get_size'] = size return size @@ -2757,11 +2734,7 @@ def get_timestamp(self): except KeyError: pass - if self.rexists(): - timestamp = self.rfile().getmtime() - else: - timestamp = 0 - + timestamp = self.rfile().getmtime() if self.rexists() else 0 self._memo['get_timestamp'] = timestamp return timestamp diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/Python.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/Python.py index ec23b3fc18..1d2b0bc47d 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/Python.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/Python.py @@ -133,7 +133,7 @@ def get_text_contents(self): ###TODO: something reasonable about universal newlines contents = str(self.value) for kid in self.children(None): - contents = contents + kid.get_contents().decode() + contents += kid.get_contents().decode() return contents def get_contents(self): diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/__init__.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/__init__.py index 32f4bbaa77..1941d46d40 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Node/__init__.py @@ -211,9 +211,11 @@ def get_contents_entry(node): def get_contents_dir(node): """Return content signatures and names of all our children separated by new-lines. Ensure that the nodes are sorted.""" - contents = [] - for n in sorted(node.children(), key=lambda t: t.name): - contents.append('%s %s\n' % (n.get_csig(), n.name)) + contents = [ + '%s %s\n' % (n.get_csig(), n.name) + for n in sorted(node.children(), key=lambda t: t.name) + ] + return ''.join(contents) def get_contents_file(node): @@ -1128,8 +1130,7 @@ def env_set(self, env, safe=0): BuildInfo = BuildInfoBase def new_ninfo(self): - ninfo = self.NodeInfo() - return ninfo + return self.NodeInfo() def get_ninfo(self): if self.ninfo is not None: @@ -1138,8 +1139,7 @@ def get_ninfo(self): return self.ninfo def new_binfo(self): - binfo = self.BuildInfo() - return binfo + return self.BuildInfo() def get_binfo(self): """ @@ -1274,10 +1274,7 @@ def add_dependency(self, depend): self._add_child(self.depends, self.depends_set, depend) except TypeError as e: e = e.args[0] - if SCons.Util.is_List(e): - s = list(map(str, e)) - else: - s = str(e) + s = list(map(str, e)) if SCons.Util.is_List(e) else str(e) raise SCons.Errors.UserError("attempted to add a non-Node dependency to %s:\n\t%s is a %s, not a Node" % (str(self), s, type(e))) def add_prerequisite(self, prerequisite): @@ -1293,10 +1290,7 @@ def add_ignore(self, depend): self._add_child(self.ignore, self.ignore_set, depend) except TypeError as e: e = e.args[0] - if SCons.Util.is_List(e): - s = list(map(str, e)) - else: - s = str(e) + s = list(map(str, e)) if SCons.Util.is_List(e) else str(e) raise SCons.Errors.UserError("attempted to ignore a non-Node dependency of %s:\n\t%s is a %s, not a Node" % (str(self), s, type(e))) def add_source(self, source): @@ -1307,10 +1301,7 @@ def add_source(self, source): self._add_child(self.sources, self.sources_set, source) except TypeError as e: e = e.args[0] - if SCons.Util.is_List(e): - s = list(map(str, e)) - else: - s = str(e) + s = list(map(str, e)) if SCons.Util.is_List(e) else str(e) raise SCons.Errors.UserError("attempted to add a non-Node as source of %s:\n\t%s is a %s, not a Node" % (str(self), s, type(e))) def _add_child(self, collection, set, child): @@ -1367,10 +1358,7 @@ def _children_get(self): if self.ignore_set: iter = chain.from_iterable([_f for _f in [self.sources, self.depends, self.implicit] if _f]) - children = [] - for i in iter: - if i not in self.ignore_set: - children.append(i) + children = [i for i in iter if i not in self.ignore_set] else: children = self.all_children(scan=0) @@ -1501,9 +1489,7 @@ def changed(self, node=None, allowcache=False): if t: Trace(': bactsig %s != newsig %s' % (bi.bactsig, newsig)) result = True - if not result: - if t: Trace(': up to date') - + if not result and t: Trace(': up to date') if t: Trace('\n') return result @@ -1528,7 +1514,7 @@ def children_are_up_to_date(self): s = kid.get_state() if s and (not state or s > state): state = s - return (state == 0 or state == SCons.Node.up_to_date) + return state in [0, SCons.Node.up_to_date] def is_literal(self): """Always pass the string representation of a Node to @@ -1759,10 +1745,7 @@ def get_next(self): node = self.stack.pop() del self.history[node] if node: - if self.stack: - parent = self.stack[-1] - else: - parent = None + parent = self.stack[-1] if self.stack else None self.eval_func(node, parent) return node return None diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/PathList.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/PathList.py index ad029369f3..0c0151700b 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/PathList.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/PathList.py @@ -108,10 +108,7 @@ def __init__(self, pathlist): except (AttributeError, TypeError): type = TYPE_OBJECT else: - if not found: - type = TYPE_STRING_NO_SUBST - else: - type = TYPE_STRING_SUBST + type = TYPE_STRING_NO_SUBST if not found else TYPE_STRING_SUBST pl.append((type, p)) self.pathlist = tuple(pl) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/__init__.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/__init__.py index 2e3d6cd9b3..9291e2b05e 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/__init__.py @@ -286,8 +286,7 @@ def Platform(name = platform_default()): """Select a canned Platform specification. """ module = platform_module(name) - spec = PlatformSpec(name, module.generate) - return spec + return PlatformSpec(name, module.generate) # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/aix.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/aix.py index c5964b6458..586361e8ca 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/aix.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/aix.py @@ -69,8 +69,6 @@ def get_xlc(env, xlc=None, packages=[]): or ('/' not in xlc and filename.endswith('/' + xlc)): xlcVersion = fileset.split()[1] xlcPath, sep, xlc = filename.rpartition('/') - pass - pass return (xlcPath, xlc, xlcVersion) def generate(env): diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/virtualenv.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/virtualenv.py index 3416b4153d..cd91d23dff 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/virtualenv.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/virtualenv.py @@ -61,7 +61,7 @@ def _is_path_in(path, base): if not path or not base: # empty path may happen, base too return False rp = os.path.relpath(path, base) - return ((not rp.startswith(os.path.pardir)) and (not rp == os.path.curdir)) + return not rp.startswith(os.path.pardir) and rp != os.path.curdir def _inject_venv_variables(env): diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/win32.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/win32.py index b386aface4..c2d5c67207 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/win32.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Platform/win32.py @@ -245,10 +245,7 @@ def exec_spawn(l, env): except KeyError: result = 127 if len(l) > 2: - if len(l[2]) < 1000: - command = ' '.join(l[0:3]) - else: - command = l[0] + command = ' '.join(l[0:3]) if len(l[2]) < 1000 else l[0] else: command = l[0] sys.stderr.write("scons: unknown OSError exception code %d - '%s': %s\n" % (e.errno, command, e.strerror)) @@ -324,8 +321,6 @@ def get_program_files_dir(): val, tok = SCons.Util.RegQueryValueEx(k, 'ProgramFilesDir') except SCons.Util.RegError: val = '' - pass - if val == '': # A reasonable default if we can't read the registry # (Actually, it's pretty reasonable even if we can :-) @@ -418,13 +413,13 @@ def generate(env): if 'PATHEXT' in os.environ: tmp_pathext = os.environ['PATHEXT'] cmd_interp = SCons.Util.WhereIs('cmd', tmp_path, tmp_pathext) - if not cmd_interp: - cmd_interp = SCons.Util.WhereIs('command', tmp_path, tmp_pathext) + if not cmd_interp: + cmd_interp = SCons.Util.WhereIs('command', tmp_path, tmp_pathext) if not cmd_interp: cmd_interp = env.Detect('cmd') - if not cmd_interp: - cmd_interp = env.Detect('command') + if not cmd_interp: + cmd_interp = env.Detect('command') if 'ENV' not in env: env['ENV'] = {} diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/SConf.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/SConf.py index e714636d6a..2d5452a06f 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/SConf.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/SConf.py @@ -121,10 +121,7 @@ def _stringConfigH(target, source, env): def NeedConfigHBuilder(): - if len(_ac_config_hs) == 0: - return False - else: - return True + return len(_ac_config_hs) != 0 def CreateConfigHBuilder(env): """Called if necessary just before the building targets phase begins.""" @@ -278,8 +275,9 @@ def collect_node_states(self): t.set_state(SCons.Node.up_to_date) if T: Trace(': set_state(up_to-date)') else: - if T: Trace(': get_state() %s' % t.get_state()) - if T: Trace(': changed() %s' % t.changed()) + if T: + Trace(': get_state() %s' % t.get_state()) + Trace(': changed() %s' % t.changed()) if (t.get_state() != SCons.Node.up_to_date and t.changed()): changed = True if T: Trace(': changed %s' % changed) @@ -521,19 +519,18 @@ def BuildNodes(self, nodes): n.attributes = SCons.Node.Node.Attrs() n.attributes.keep_targetinfo = 1 - if True: - # Some checkers have intermediate files (for example anything that compiles a c file into a program to run - # Those files need to be set to not release their target info, otherwise taskmaster will throw a - # Nonetype not callable - for c in n.children(scan=False): - # Keep debug code here. - # print("Checking [%s] for builders and then setting keep_targetinfo"%c) - if c.has_builder(): - n.store_info = 0 - if not hasattr(c, 'attributes'): - c.attributes = SCons.Node.Node.Attrs() - c.attributes.keep_targetinfo = 1 - # pass + # Some checkers have intermediate files (for example anything that compiles a c file into a program to run + # Those files need to be set to not release their target info, otherwise taskmaster will throw a + # Nonetype not callable + for c in n.children(scan=False): + # Keep debug code here. + # print("Checking [%s] for builders and then setting keep_targetinfo"%c) + if c.has_builder(): + n.store_info = 0 + if not hasattr(c, 'attributes'): + c.attributes = SCons.Node.Node.Attrs() + c.attributes.keep_targetinfo = 1 + # pass ret = 1 @@ -623,11 +620,7 @@ def TryBuild(self, builder, text = None, extension = ""): self.env['SPAWN'] = save_spawn _ac_build_counter = _ac_build_counter + 1 - if result: - self.lastTarget = nodes[0] - else: - self.lastTarget = None - + self.lastTarget = nodes[0] if result else None return result def TryAction(self, action, text = None, extension = ""): @@ -668,15 +661,15 @@ def TryRun(self, text, extension ): is saved in self.lastTarget (for further processing). """ ok = self.TryLink(text, extension) - if( ok ): + if ( ok ): prog = self.lastTarget pname = prog.get_internal_path() output = self.confdir.File(os.path.basename(pname)+'.out') node = self.env.Command(output, prog, [ [ pname, ">", "${TARGET}"] ]) ok = self.BuildNodes(node) - if ok: - outputStr = SCons.Util.to_str(output.get_contents()) - return( 1, outputStr) + if ok: + outputStr = SCons.Util.to_str(output.get_contents()) + return( 1, outputStr) return (0, "") class TestWrapper(object): @@ -708,11 +701,10 @@ def AddTests(self, tests): def _createDir( self, node ): dirName = str(node) - if dryrun: - if not os.path.isdir( dirName ): + if not os.path.isdir( dirName ): + if dryrun: raise ConfigureDryRunError(dirName) - else: - if not os.path.isdir( dirName ): + else: os.makedirs( dirName ) def _startup(self): @@ -971,15 +963,13 @@ def createIncludesFromHeaders(headers, leaveLast, include_quotes = '""'): # statements from the specified header (list) if not SCons.Util.is_List(headers): headers = [headers] - l = [] if leaveLast: lastHeader = headers[-1] headers = headers[:-1] else: lastHeader = None - for s in headers: - l.append("#include %s%s%s\n" - % (include_quotes[0], s, include_quotes[1])) + l = ["#include %s%s%s\n" + % (include_quotes[0], s, include_quotes[1]) for s in headers] return ''.join(l), lastHeader def CheckHeader(context, header, include_quotes = '<>', language = None): diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/C.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/C.py index 32e0499a7e..68d1a74484 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/C.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/C.py @@ -97,8 +97,8 @@ def __call__(self, node, env, path = ()): cpppath = path, dict = dictify_CPPDEFINES(env)) result = cpp(node) + fmt = "No dependency generated for file: %s (included from: %s) -- file not found" for included, includer in cpp.missing: - fmt = "No dependency generated for file: %s (included from: %s) -- file not found" SCons.Warnings.warn(SCons.Warnings.DependencyWarning, fmt % (included, includer)) return result @@ -118,11 +118,12 @@ def CScanner(): # right configurability to let users pick between the scanners. #return SConsCPPScannerWrapper("CScanner", "CPPPATH") - cs = SCons.Scanner.ClassicCPP("CScanner", - "$CPPSUFFIXES", - "CPPPATH", - '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")') - return cs + return SCons.Scanner.ClassicCPP( + "CScanner", + "$CPPSUFFIXES", + "CPPPATH", + '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")', + ) # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/Prog.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/Prog.py index 5f9015d2e5..ca3279d161 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/Prog.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/Prog.py @@ -35,8 +35,7 @@ def ProgramScanner(**kw): """Return a prototype Scanner instance for scanning executable files for static-lib dependencies""" kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') - ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) - return ps + return SCons.Scanner.Base(scan, "ProgramScanner", **kw) def _subst_libs(env, libs): """ diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/RC.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/RC.py index 47c6ca26ec..71ccb9ddfb 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/RC.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/RC.py @@ -51,13 +51,11 @@ def RCScan(): r'.*?\s+(?:ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)' \ r'\s*.*?)' \ r'\s*(<|"| )([^>"\s]+)(?:[>"\s])*$' - resScanner = SCons.Scanner.ClassicCPP("ResourceScanner", + return SCons.Scanner.ClassicCPP("ResourceScanner", "$RCSUFFIXES", "CPPPATH", res_re, recursive=no_tlb) - - return resScanner # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/__init__.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/__init__.py index 98845332e9..ff8132d3eb 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Scanner/__init__.py @@ -171,10 +171,7 @@ def __init__(self, self.argument = argument if skeys is _null: - if SCons.Util.is_Dict(function): - skeys = list(function.keys()) - else: - skeys = [] + skeys = list(function.keys()) if SCons.Util.is_Dict(function) else [] self.skeys = skeys self.node_class = node_class diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Interactive.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Interactive.py index b2c134c84b..d4870006ed 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Interactive.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Interactive.py @@ -121,10 +121,7 @@ def __init__(self, **kw): for key, val in kw.items(): setattr(self, key, val) - if sys.platform == 'win32': - self.shell_variable = 'COMSPEC' - else: - self.shell_variable = 'SHELL' + self.shell_variable = 'COMSPEC' if sys.platform == 'win32' else 'SHELL' def default(self, argv): print("*** Unknown command: %s" % argv[0]) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Main.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Main.py index 5cae6bd049..02bdea607e 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Main.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/Main.py @@ -143,7 +143,7 @@ def erase_previous(self): if self.prev: length = len(self.prev) if self.prev[-1] in ('\n', '\r'): - length = length - 1 + length -= 1 self.write(' ' * length + '\r') self.prev = '' @@ -442,10 +442,7 @@ def get_derived_children(self, node): children = node.all_children(None) return [x for x in children if x.has_builder()] def display(self, t): - if self.derived: - func = self.get_derived_children - else: - func = self.get_all_children + func = self.get_derived_children if self.derived else self.get_all_children s = self.status and 2 or 0 SCons.Util.print_tree(t, func, prune=self.prune, showtags=s) @@ -484,8 +481,7 @@ def add_local_option(self, *args, **kw): def AddOption(*args, **kw): if 'default' not in kw: kw['default'] = None - result = OptionsParser.add_local_option(*args, **kw) - return result + return OptionsParser.add_local_option(*args, **kw) def GetOption(name): return getattr(OptionsParser.values, name) @@ -522,7 +518,7 @@ def do_print(self): for s in self.stats: for n, c in s: stats_table[n][i] = c - i = i + 1 + i += 1 self.outfp.write("Object counts:\n") pre = [" "] post = [" %s\n"] @@ -531,8 +527,8 @@ def do_print(self): fmt2 = ''.join(pre + [' %7d']*l + post) labels = self.labels[:l] labels.append(("", "Class")) - self.outfp.write(fmt1 % tuple([x[0] for x in labels])) - self.outfp.write(fmt1 % tuple([x[1] for x in labels])) + self.outfp.write(fmt1 % tuple(x[0] for x in labels)) + self.outfp.write(fmt1 % tuple(x[1] for x in labels)) for k in sorted(stats_table.keys()): r = stats_table[k][:l] + [k] self.outfp.write(fmt2 % tuple(r)) @@ -691,10 +687,7 @@ def _set_debug_values(options): def _create_path(plist): path = '.' for d in plist: - if os.path.isabs(d): - path = d - else: - path = path + '/' + d + path = d if os.path.isabs(d) else path + '/' + d return path def _load_site_scons_dir(topdir, site_dir_name=None): @@ -714,7 +707,6 @@ def _load_site_scons_dir(topdir, site_dir_name=None): return site_init_filename = "site_init.py" - site_init_modname = "site_init" site_tools_dirname = "site_tools" # prepend to sys.path sys.path = [os.path.abspath(site_dir)] + sys.path @@ -722,6 +714,7 @@ def _load_site_scons_dir(topdir, site_dir_name=None): site_tools_dir = os.path.join(site_dir, site_tools_dirname) if os.path.exists(site_init_file): import imp, re + site_init_modname = "site_init" try: try: fp, pathname, description = imp.find_module(site_init_modname, diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConsOptions.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConsOptions.py index e7a3fc1800..6ad6cdf1f5 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConsOptions.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConsOptions.py @@ -207,7 +207,7 @@ def convert_value(self, opt, value): if self.nargs in (1, '?'): return self.check_value(opt, value) else: - return tuple([self.check_value(opt, v) for v in value]) + return tuple(self.check_value(opt, v) for v in value) def process(self, opt, value, values, parser): @@ -297,10 +297,7 @@ def _process_long_opt(self, rargs, values): if option.takes_value(): nargs = option.nargs if nargs == '?': - if had_explicit_value: - value = rargs.pop(0) - else: - value = option.const + value = rargs.pop(0) if had_explicit_value else option.const elif len(rargs) < nargs: if nargs == 1: if not option.choices: @@ -378,7 +375,7 @@ def reparse_local_options(self): # Not known yet, so reject for now largs_restore.append('='.join(lopt)) else: - if l == "--" or l == "-": + if l in ["--", "-"]: # Stop normal processing and don't # process the rest of the command-line opts largs_restore.append(l) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConscript.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConscript.py index 97073ba4c2..eea328c7f2 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConscript.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Script/SConscript.py @@ -140,11 +140,7 @@ def Return(*vars, **kw): except KeyError as x: raise SCons.Errors.UserError("Return of non-existent variable '%s'"%x) - if len(retval) == 1: - call_stack[-1].retval = retval[0] - else: - call_stack[-1].retval = tuple(retval) - + call_stack[-1].retval = retval[0] if len(retval) == 1 else tuple(retval) stop = kw.get('stop', True) if stop: @@ -176,11 +172,11 @@ def handle_missing_SConscript(f, must_exist=None): msg = "Calling missing SConscript without error is deprecated.\n" + \ "Transition by adding must_exist=0 to SConscript calls.\n" + \ "Missing SConscript '%s'" % f.get_internal_path() - SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) SCons.Script._warn_missing_sconscript_deprecated = False else: msg = "Ignoring missing SConscript '%s'" % f.get_internal_path() - SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) + + SCons.Warnings.warn(SCons.Warnings.MissingSConscriptWarning, msg) def _SConscript(fs, *files, **kw): top = fs.Top @@ -197,10 +193,7 @@ def _SConscript(fs, *files, **kw): if fn == "-": exec(sys.stdin.read(), call_stack[-1].globals) else: - if isinstance(fn, SCons.Node.Node): - f = fn - else: - f = fs.File(str(fn)) + f = fn if isinstance(fn, SCons.Node.Node) else fs.File(str(fn)) _file_ = None # Change directory to the top of the source @@ -544,10 +537,7 @@ def Import(self, *vars): globals.update(global_exports) globals.update(exports) else: - if v in exports: - globals[v] = exports[v] - else: - globals[v] = global_exports[v] + globals[v] = exports[v] if v in exports else global_exports[v] except KeyError as x: raise SCons.Errors.UserError("Import of non-existent variable '%s'"%x) @@ -578,11 +568,7 @@ def SConscript(self, *ls, **kw): """ def subst_element(x, subst=self.subst): - if SCons.Util.is_List(x): - x = list(map(subst, x)) - else: - x = subst(x) - return x + return list(map(subst, x)) if SCons.Util.is_List(x) else subst(x) ls = list(map(subst_element, ls)) subst_kw = {} for key, val in kw.items(): diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Subst.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Subst.py index 23030f45c9..8f01f26056 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Subst.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Subst.py @@ -103,10 +103,7 @@ def __init__(self, lstr, for_signature=None): canonical string we return from for_signature(). Else we will simply return lstr.""" self.lstr = lstr - if for_signature: - self.forsig = for_signature - else: - self.forsig = lstr + self.forsig = for_signature if for_signature else lstr def __str__(self): return self.lstr @@ -775,46 +772,47 @@ def add_to_current_word(self, x): inherits the object attributes of x (in particular, the escape function) by wrapping it as CmdStringHolder.""" - if not self.in_strip or self.mode != SUBST_SIG: + if self.in_strip and self.mode == SUBST_SIG: + return + try: + current_word = self[-1][-1] + except IndexError: + self.add_new_word(x) + else: + # All right, this is a hack and it should probably + # be refactored out of existence in the future. + # The issue is that we want to smoosh words together + # and make one file name that gets escaped if + # we're expanding something like foo$EXTENSION, + # but we don't want to smoosh them together if + # it's something like >$TARGET, because then we'll + # treat the '>' like it's part of the file name. + # So for now, just hard-code looking for the special + # command-line redirection characters... try: - current_word = self[-1][-1] + last_char = str(current_word)[-1] except IndexError: + last_char = '\0' + if last_char in '<>|': self.add_new_word(x) else: - # All right, this is a hack and it should probably - # be refactored out of existence in the future. - # The issue is that we want to smoosh words together - # and make one file name that gets escaped if - # we're expanding something like foo$EXTENSION, - # but we don't want to smoosh them together if - # it's something like >$TARGET, because then we'll - # treat the '>' like it's part of the file name. - # So for now, just hard-code looking for the special - # command-line redirection characters... - try: - last_char = str(current_word)[-1] - except IndexError: - last_char = '\0' - if last_char in '<>|': - self.add_new_word(x) - else: - y = current_word + x - - # We used to treat a word appended to a literal - # as a literal itself, but this caused problems - # with interpreting quotes around space-separated - # targets on command lines. Removing this makes - # none of the "substantive" end-to-end tests fail, - # so we'll take this out but leave it commented - # for now in case there's a problem not covered - # by the test cases and we need to resurrect this. - #literal1 = self.literal(self[-1][-1]) - #literal2 = self.literal(x) - y = self.conv(y) - if is_String(y): - #y = CmdStringHolder(y, literal1 or literal2) - y = CmdStringHolder(y, None) - self[-1][-1] = y + y = current_word + x + + # We used to treat a word appended to a literal + # as a literal itself, but this caused problems + # with interpreting quotes around space-separated + # targets on command lines. Removing this makes + # none of the "substantive" end-to-end tests fail, + # so we'll take this out but leave it commented + # for now in case there's a problem not covered + # by the test cases and we need to resurrect this. + #literal1 = self.literal(self[-1][-1]) + #literal2 = self.literal(x) + y = self.conv(y) + if is_String(y): + #y = CmdStringHolder(y, literal1 or literal2) + y = CmdStringHolder(y, None) + self[-1][-1] = y def add_new_word(self, x): if not self.in_strip or self.mode != SUBST_SIG: diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Taskmaster.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Taskmaster.py index 60d2ac396c..5b46506462 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Taskmaster.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Taskmaster.py @@ -416,14 +416,13 @@ def make_ready_current(self): self.out_of_date.append(t) needs_executing = True - if needs_executing: - for t in self.targets: + for t in self.targets: + if needs_executing: t.set_state(NODE_EXECUTING) for s in t.side_effects: # add disambiguate here to mirror the call on targets in first loop above s.disambiguate().set_state(NODE_EXECUTING) - else: - for t in self.targets: + else: # We must invoke visited() to ensure that the node # information has been computed before allowing the # parent nodes to execute. (That could occur in a @@ -1069,8 +1068,7 @@ def cleanup(self): if cycle: desc = desc + " " + " -> ".join(map(str, cycle)) + "\n" else: - desc = desc + \ - " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ + desc += " Internal Error: no cycle found for node %s (%s) in state %s\n" % \ (node, repr(node), StateString[node.get_state()]) raise SCons.Errors.UserError(desc) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/GettextCommon.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/GettextCommon.py index f03c256c9c..464a2cdafe 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/GettextCommon.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/GettextCommon.py @@ -262,8 +262,7 @@ def _translate(env, target=None, source=SCons.Environment._null, *args, **kw): """ Function for `Translate()` pseudo-builder """ if target is None: target = [] pot = env.POTUpdate(None, source, *args, **kw) - po = env.POUpdate(target, pot, *args, **kw) - return po + return env.POUpdate(target, pot, *args, **kw) ############################################################################# @@ -362,10 +361,7 @@ def __call__(self, nodes, *args, **kw): def _init_po_files(target, source, env): """ Action function for `POInit` builder. """ nop = lambda target, source, env: 0 - if 'POAUTOINIT' in env: - autoinit = env['POAUTOINIT'] - else: - autoinit = False + autoinit = env['POAUTOINIT'] if 'POAUTOINIT' in env else False # Well, if everything outside works well, this loop should do single # iteration. Otherwise we are rebuilding all the targets even, if just # one has changed (but is this our fault?). @@ -394,7 +390,6 @@ def _detect_xgettext(env): if xgettext: return xgettext raise SCons.Errors.StopError(XgettextNotFound, "Could not detect xgettext") - return None ############################################################################# @@ -413,7 +408,6 @@ def _detect_msginit(env): if msginit: return msginit raise SCons.Errors.StopError(MsginitNotFound, "Could not detect msginit") - return None ############################################################################# @@ -432,7 +426,6 @@ def _detect_msgmerge(env): if msgmerge: return msgmerge raise SCons.Errors.StopError(MsgmergeNotFound, "Could not detect msgmerge") - return None ############################################################################# @@ -451,7 +444,6 @@ def _detect_msgfmt(env): if msgfmt: return msgfmt raise SCons.Errors.StopError(MsgfmtNotFound, "Could not detect msgfmt") - return None ############################################################################# diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/sdk.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/sdk.py index 811ee24d1c..30151cd7ec 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/sdk.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/sdk.py @@ -385,8 +385,8 @@ def mssdk_setup_env(env): mssdk = get_sdk_by_version(sdk_version) if not mssdk: mssdk = get_default_sdk() - if not mssdk: - return + if not mssdk: + return sdk_dir = mssdk.get_sdk_dir() debug('mssdk_setup_env: Using MSVS_VERSION:%s'%sdk_dir) else: diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vc.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vc.py index 6d0a7ecd99..3f8ae954e6 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vc.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vc.py @@ -257,7 +257,7 @@ def msvc_version_to_maj_min(msvc_version): msvc_version_numeric = get_msvc_version_numeric(msvc_version) t = msvc_version_numeric.split(".") - if not len(t) == 2: + if len(t) != 2: raise ValueError("Unrecognized version %s (%s)" % (msvc_version,msvc_version_numeric)) try: maj = int(t[0]) @@ -509,7 +509,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') return True - elif ver_num <= 14 and ver_num >= 8: + elif ver_num >= 8: # Set default value to be -1 as "" which is the value for x86/x86 yields true when tested # if not host_trgt_dir @@ -541,7 +541,7 @@ def _check_cl_exists_in_vc_dir(env, vc_dir, msvc_version): debug('_check_cl_exists_in_vc_dir(): found ' + _CL_EXE_NAME + '!') return True - elif ver_num < 8 and ver_num >= 6: + elif ver_num >= 6: # not sure about these versions so if a walk the VC dir (could be slow) for root, _, files in os.walk(vc_dir): if _CL_EXE_NAME in files: @@ -657,19 +657,19 @@ def get_default_version(env): debug('get_default_version(): msvc_version:%s msvs_version:%s'%(msvc_version,msvs_version)) - if msvs_version and not msvc_version: - SCons.Warnings.warn( - SCons.Warnings.DeprecatedWarning, - "MSVS_VERSION is deprecated: please use MSVC_VERSION instead ") - return msvs_version - elif msvc_version and msvs_version: - if not msvc_version == msvs_version: + if msvs_version: + if not msvc_version: SCons.Warnings.warn( - SCons.Warnings.VisualVersionMismatch, - "Requested msvc version (%s) and msvs version (%s) do " \ - "not match: please use MSVC_VERSION only to request a " \ - "visual studio version, MSVS_VERSION is deprecated" \ - % (msvc_version, msvs_version)) + SCons.Warnings.DeprecatedWarning, + "MSVS_VERSION is deprecated: please use MSVC_VERSION instead ") + else: + if msvc_version != msvs_version: + SCons.Warnings.warn( + SCons.Warnings.VisualVersionMismatch, + "Requested msvc version (%s) and msvs version (%s) do " \ + "not match: please use MSVC_VERSION only to request a " \ + "visual studio version, MSVS_VERSION is deprecated" \ + % (msvc_version, msvs_version)) return msvs_version if not msvc_version: installed_vcs = cached_get_installed_vcs(env) @@ -735,10 +735,9 @@ def msvc_find_valid_batch_script(env, version): # Get just version numbers maj, min = msvc_version_to_maj_min(version) # VS2015+ - if maj >= 14: - if env.get('MSVC_UWP_APP') == '1': - # Initialize environment variables with store/universal paths - arg += ' store' + if maj >= 14 and env.get('MSVC_UWP_APP') == '1': + # Initialize environment variables with store/universal paths + arg += ' store' # Try to locate a batch file for this host/target platform combo try: @@ -765,17 +764,18 @@ def msvc_find_valid_batch_script(env, version): debug('msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) vc_script=None continue - if not vc_script and sdk_script: - debug('msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) - try: - d = script_env(sdk_script) - found = sdk_script - except BatchFileExecutionError as e: - debug('msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) + if not vc_script: + if sdk_script: + debug('msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) + try: + d = script_env(sdk_script) + found = sdk_script + except BatchFileExecutionError as e: + debug('msvc_find_valid_batch_script() use_script 5: failed running SDK script %s: Error:%s'%(repr(sdk_script),e)) + continue + else: + debug('msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') continue - elif not vc_script and not sdk_script: - debug('msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') - continue debug("msvc_find_valid_batch_script() Found a working script/target: %s/%s"%(repr(found),arg)) break # We've found a working target_platform, so stop looking diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vs.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vs.py index 972c4f8d20..a0a2ae4e8f 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vs.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/MSCommon/vs.py @@ -76,7 +76,7 @@ def find_vs_dir_by_reg(self): root = 'Software\\' if is_win64(): - root = root + 'Wow6432Node\\' + root += 'Wow6432Node\\' for key in self.hkeys: if key=='use_dir': return self.find_vs_dir_by_vc() @@ -573,8 +573,7 @@ def query_versions(): """Query the system to get available versions of VS. A version is considered when a batfile is found.""" msvs_list = get_installed_visual_studios() - versions = [msvs.version for msvs in msvs_list] - return versions + return [msvs.version for msvs in msvs_list] # Local Variables: # tab-width:4 diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/__init__.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/__init__.py index eb3aaa8853..bc0925f97e 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/__init__.py @@ -381,7 +381,6 @@ def _call_linker_cb(env, callback, args, result=None): except (KeyError, TypeError): if Verbose: print('_call_linker_cb: env["LINKCALLBACKS"][%r] not found or can not be used' % callback) - pass else: if Verbose: print('_call_linker_cb: env["LINKCALLBACKS"][%r] found' % callback) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/cc.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/cc.py index ffcb6e84cc..754cd8dfb2 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/cc.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/cc.py @@ -54,7 +54,7 @@ def add_common_cc_variables(env): env['FRAMEWORKS'] = SCons.Util.CLVar('') env['FRAMEWORKPATH'] = SCons.Util.CLVar('') if env['PLATFORM'] == 'darwin': - env['_CCCOMCOM'] = env['_CCCOMCOM'] + ' $_FRAMEWORKPATH' + env['_CCCOMCOM'] += ' $_FRAMEWORKPATH' if 'CCFLAGS' not in env: env['CCFLAGS'] = SCons.Util.CLVar('') diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/clangxx.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/clangxx.py index 9292c21bd3..87aa6364f6 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/clangxx.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/clangxx.py @@ -64,9 +64,7 @@ def generate(env): env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -mminimal-toc') env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['SHOBJSUFFIX'] = '$OBJSUFFIX' - elif env['PLATFORM'] == 'hpux': - env['SHOBJSUFFIX'] = '.pic.o' - elif env['PLATFORM'] == 'sunos': + elif env['PLATFORM'] in ['hpux', 'sunos']: env['SHOBJSUFFIX'] = '.pic.o' elif env['PLATFORM'] == 'win32': # Ensure that we have a proper path for clang++ @@ -83,7 +81,7 @@ def generate(env): stdout=subprocess.PIPE) if pipe.wait() != 0: return - + # clang -dumpversion is of no use with pipe.stdout: line = pipe.stdout.readline() diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/docbook/__init__.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/docbook/__init__.py index 147556d626..72f3851f5d 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/docbook/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/docbook/__init__.py @@ -144,10 +144,7 @@ def __create_output_dir(base_dir): root, tail = os.path.split(base_dir) dir = None if tail: - if base_dir.endswith('/'): - dir = base_dir - else: - dir = root + dir = base_dir if base_dir.endswith('/') else root else: if base_dir.endswith('/'): dir = base_dir @@ -180,22 +177,23 @@ def __detect_cl_tool(env, chainkey, cdict, cpriority=None): Helper function, picks a command line tool from the list and initializes its environment variables. """ - if env.get(chainkey,'') == '': - clpath = '' - - if cpriority is None: - cpriority = cdict.keys() - for cltool in cpriority: + if env.get(chainkey, '') != '': + return + clpath = '' + + if cpriority is None: + cpriority = cdict.keys() + for cltool in cpriority: + if __debug_tool_location: + print("DocBook: Looking for %s"%cltool) + clpath = env.WhereIs(cltool) + if clpath: if __debug_tool_location: - print("DocBook: Looking for %s"%cltool) - clpath = env.WhereIs(cltool) - if clpath: - if __debug_tool_location: - print("DocBook: Found:%s"%cltool) - env[chainkey] = clpath - if not env[chainkey + 'COM']: - env[chainkey + 'COM'] = cdict[cltool] - break + print("DocBook: Found:%s"%cltool) + env[chainkey] = clpath + if not env[chainkey + 'COM']: + env[chainkey + 'COM'] = cdict[cltool] + break def _detect(env): """ @@ -346,11 +344,7 @@ def __build_lxml(target, source, env): doc = etree.parse(str(source[0])) # Support for additional parameters parampass = {} - if parampass: - result = transform(doc, **parampass) - else: - result = transform(doc) - + result = transform(doc, **parampass) if parampass else transform(doc) try: with open(str(target[0]), "wb") as of: of.write(etree.tostring(result, pretty_print=True)) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py index ea16abf95f..aafe5a08ed 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/filesystem.py @@ -44,7 +44,7 @@ def copyto_emitter(target, source, env): n_target = [] for t in target: - n_target = n_target + [t.File( str( s ) ) for s in source] + n_target += [t.File( str( s ) ) for s in source] return (n_target, source) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/gxx.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/gxx.py index 2eb678dcb8..a2b1e55be3 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/gxx.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/gxx.py @@ -60,9 +60,7 @@ def generate(env): env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS -mminimal-toc') env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 env['SHOBJSUFFIX'] = '$OBJSUFFIX' - elif env['PLATFORM'] == 'hpux': - env['SHOBJSUFFIX'] = '.pic.o' - elif env['PLATFORM'] == 'sunos': + elif env['PLATFORM'] in ['hpux', 'sunos']: env['SHOBJSUFFIX'] = '.pic.o' # determine compiler version version = gcc.detect_version(env, env['CXX']) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/install.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/install.py index f998baac4d..4bcdccc735 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/install.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/install.py @@ -215,10 +215,7 @@ def stringFunc(target, source, env): return env.subst_target_source(installstr, 0, target, source) target = str(target[0]) source = str(source[0]) - if os.path.isdir(source): - type = 'directory' - else: - type = 'file' + type = 'directory' if os.path.isdir(source) else 'file' return 'Install %s: "%s" as "%s"' % (type, source, target) # diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/intelc.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/intelc.py index c45c71a10d..d967093794 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/intelc.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/intelc.py @@ -76,11 +76,8 @@ def linux_ver_normalize(vstr): return float(vmaj) * 10. + float(vmin) + float(build) / 1000. else: f = float(vstr) - if is_windows: - return f - else: - if f < 60: return f * 10.0 - else: return f + if not is_windows and f < 60: return f * 10.0 + else: return f def check_abi(abi): """Check for valid ABI (application binary interface) name, @@ -403,11 +400,8 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): if is_windows: SCons.Tool.msvc.generate(env) - elif is_linux: - SCons.Tool.gcc.generate(env) - elif is_mac: + else: SCons.Tool.gcc.generate(env) - # if version is unspecified, use latest vlist = get_all_compiler_versions() if not version: @@ -429,16 +423,9 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): if is_mac or is_linux: # Check if we are on 64-bit linux, default to 64 then. uname_m = os.uname()[4] - if uname_m == 'x86_64': - abi = 'x86_64' - else: - abi = 'ia32' + abi = 'x86_64' if uname_m == 'x86_64' else 'ia32' else: - if is_win64: - abi = 'em64t' - else: - abi = 'ia32' - + abi = 'em64t' if is_win64 else 'ia32' if version and not topdir: try: topdir = get_intel_compiler_top(version, abi) @@ -557,8 +544,6 @@ class ICLTopDirWarning(SCons.Warnings.Warning): reglicdir = SCons.Util.RegQueryValueEx(k, "w_cpp")[0] except (AttributeError, SCons.Util.RegError): reglicdir = "" - defaultlicdir = r'C:\Program Files\Common Files\Intel\Licenses' - licdir = None for ld in [envlicdir, reglicdir]: # If the string contains an '@', then assume it's a network @@ -567,16 +552,22 @@ class ICLTopDirWarning(SCons.Warnings.Warning): licdir = ld break if not licdir: + defaultlicdir = r'C:\Program Files\Common Files\Intel\Licenses' + licdir = defaultlicdir if not os.path.exists(licdir): + class ICLLicenseDirWarning(SCons.Warnings.Warning): pass SCons.Warnings.enableWarningClass(ICLLicenseDirWarning) - SCons.Warnings.warn(ICLLicenseDirWarning, - "Intel license dir was not found." - " Tried using the INTEL_LICENSE_FILE environment variable (%s), the registry (%s) and the default path (%s)." - " Using the default path as a last resort." - % (envlicdir, reglicdir, defaultlicdir)) + SCons.Warnings.warn( + ICLLicenseDirWarning, + "Intel license dir was not found." + " Tried using the INTEL_LICENSE_FILE environment variable (%s), the registry (%s) and the default path (%s)." + " Using the default path as a last resort." + % (envlicdir, reglicdir, licdir), + ) + env['ENV']['INTEL_LICENSE_FILE'] = licdir def exists(env): @@ -593,9 +584,7 @@ def exists(env): # try env.Detect, maybe that will work if is_windows: return env.Detect('icl') - elif is_linux: - return env.Detect('icc') - elif is_mac: + else: return env.Detect('icc') return detected diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/mingw.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/mingw.py index 2b80f712ce..4893b0c690 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/mingw.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/mingw.py @@ -129,9 +129,7 @@ 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 + return glob.glob(r"C:\mingw-w64\*\mingw64\bin") def generate(env): diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msginit.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msginit.py index 8ce9f02a1b..debd1081e4 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msginit.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msginit.py @@ -35,10 +35,7 @@ def _optional_no_translator_flag(env): """ Return '--no-translator' flag if we run *msginit(1)* in non-interactive mode.""" import SCons.Util - if 'POAUTOINIT' in env: - autoinit = env['POAUTOINIT'] - else: - autoinit = False + autoinit = env['POAUTOINIT'] if 'POAUTOINIT' in env else False if autoinit: return [SCons.Util.CLVar('--no-translator')] else: diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msvs.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msvs.py index 4a4b3903d8..e18f7bfe4b 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msvs.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/msvs.py @@ -210,7 +210,7 @@ def __init__(self, dspfile, source, env): dbg_settings = [] if len(dbg_settings) == 1: - dbg_settings = dbg_settings * len(variants) + dbg_settings *= len(variants) self.createfile = self.usrhead and self.usrdebg and self.usrconf and \ dbg_settings and bool([ds for ds in dbg_settings if ds]) @@ -219,9 +219,11 @@ def __init__(self, dspfile, source, env): dbg_settings = dict(list(zip(variants, dbg_settings))) for var, src in dbg_settings.items(): # Update only expected keys - trg = {} - for key in [k for k in list(self.usrdebg.keys()) if k in src]: - trg[key] = str(src[key]) + trg = { + key: str(src[key]) + for key in [k for k in list(self.usrdebg.keys()) if k in src] + } + self.configs[var].debug = trg def UserHeader(self): @@ -862,10 +864,7 @@ def __init__(self, dspfile, source, env): self.dspheader = V8DSPHeader self.dspconfiguration = V8DSPConfiguration else: - if self.version_num >= 7.1: - self.versionstr = '7.10' - else: - self.versionstr = '7.00' + self.versionstr = '7.10' if self.version_num >= 7.1 else '7.00' self.dspheader = V7DSPHeader self.dspconfiguration = V7DSPConfiguration self.file = None @@ -919,6 +918,7 @@ def PrintProject(self): self.file.write('\t\n') confkeys = sorted(self.configs.keys()) + starting = 'echo Starting SCons && ' for kind in confkeys: variant = self.configs[kind].variant platform = self.configs[kind].platform @@ -933,11 +933,7 @@ def PrintProject(self): if not env_has_buildtarget: self.env['MSVSBUILDTARGET'] = buildtarget - starting = 'echo Starting SCons && ' - if cmdargs: - cmdargs = ' ' + cmdargs - else: - cmdargs = '' + cmdargs = ' ' + cmdargs if cmdargs else '' buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs) rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs) cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs) @@ -1238,6 +1234,7 @@ def PrintProject(self): self.file.write('\t\n') self.file.write('\t<_ProjectFileVersion>10.0.30319.1\n') + starting = 'echo Starting SCons && ' for kind in confkeys: variant = self.configs[kind].variant platform = self.configs[kind].platform @@ -1252,11 +1249,7 @@ def PrintProject(self): if not env_has_buildtarget: self.env['MSVSBUILDTARGET'] = buildtarget - starting = 'echo Starting SCons && ' - if cmdargs: - cmdargs = ' ' + cmdargs - else: - cmdargs = '' + cmdargs = ' ' + cmdargs if cmdargs else '' buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs) rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs) cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs) @@ -1548,7 +1541,7 @@ def Parse(self): line = dswfile.readline() datas = line - while line: + while datas: line = dswfile.readline() datas = datas + line dswfile.close() @@ -1601,7 +1594,6 @@ def PrintSolution(self): env = self.env if 'MSVS_SCC_PROVIDER' in env: scc_number_of_projects = len(self.dspfiles) + 1 - slnguid = self.slnguid scc_provider = env.get('MSVS_SCC_PROVIDER', '').replace(' ', r'\u0020') scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '').replace(' ', r'\u0020') scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir) @@ -1617,6 +1609,7 @@ def PrintSolution(self): self.file.write('\t\tSccProjectFilePathRelativizedFromConnection0 = %s\\\\\n' % sln_relative_path_from_scc.replace('\\', '\\\\')) if self.version_num < 8.0: + slnguid = self.slnguid # When present, SolutionUniqueID is automatically removed by VS 2005 # TODO: check for Visual Studio versions newer than 2005 self.file.write('\t\tSolutionUniqueID = %s\n' % slnguid) @@ -1644,7 +1637,7 @@ def PrintSolution(self): self.file.write('\t\t%s|%s = %s|%s\n' % (variant, platform, variant, platform)) else: self.file.write('\t\tConfigName.%d = %s\n' % (cnt, variant)) - cnt = cnt + 1 + cnt += 1 self.file.write('\tEndGlobalSection\n') if self.version_num <= 7.1: self.file.write('\tGlobalSection(ProjectDependencies) = postSolution\n' @@ -1657,13 +1650,12 @@ def PrintSolution(self): for name in confkeys: variant = self.configs[name].variant platform = self.configs[name].platform - if self.version_num >= 8.0: - for dspinfo in self.dspfiles_info: + for dspinfo in self.dspfiles_info: + if self.version_num >= 8.0: guid = dspinfo['GUID'] self.file.write('\t\t%s.%s|%s.ActiveCfg = %s|%s\n' '\t\t%s.%s|%s.Build.0 = %s|%s\n' % (guid,variant,platform,variant,platform,guid,variant,platform,variant,platform)) - else: - for dspinfo in self.dspfiles_info: + else: guid = dspinfo['GUID'] self.file.write('\t\t%s.%s.ActiveCfg = %s|%s\n' '\t\t%s.%s.Build.0 = %s|%s\n' %(guid,variant,variant,platform,guid,variant,variant,platform)) @@ -1753,13 +1745,12 @@ def GenerateDSP(dspfile, source, env): version_num, suite = msvs_parse_version(env['MSVS_VERSION']) if version_num >= 10.0: g = _GenerateV10DSP(dspfile, source, env) - g.Build() elif version_num >= 7.0: g = _GenerateV7DSP(dspfile, source, env) - g.Build() else: g = _GenerateV6DSP(dspfile, source, env) - g.Build() + + g.Build() def GenerateDSW(dswfile, source, env): """Generates a Solution/Workspace file based on the version of MSVS that is being used""" @@ -1769,10 +1760,10 @@ def GenerateDSW(dswfile, source, env): version_num, suite = msvs_parse_version(env['MSVS_VERSION']) if version_num >= 7.0: g = _GenerateV7DSW(dswfile, source, env) - g.Build() else: g = _GenerateV6DSW(dswfile, source, env) - g.Build() + + g.Build() ############################################################################## @@ -1840,55 +1831,59 @@ def projectEmitter(target, source, env): if not source: source = 'prj_inputs:' - source = source + env.subst('$MSVSSCONSCOM', 1) - source = source + env.subst('$MSVSENCODING', 1) + source += env.subst('$MSVSSCONSCOM', 1) + source += env.subst('$MSVSENCODING', 1) # Project file depends on CPPDEFINES and CPPPATH preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', [])))) includepath = xmlify(';'.join(processIncludes(env.get('CPPPATH', []), env, None, None))) - source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) + source += "; ppdefs:%s incpath:%s"%(preprocdefs, includepath) if 'buildtarget' in env and env['buildtarget'] is not None: if SCons.Util.is_String(env['buildtarget']): - source = source + ' "%s"' % env['buildtarget'] + source += ' "%s"' % env['buildtarget'] elif SCons.Util.is_List(env['buildtarget']): for bt in env['buildtarget']: if SCons.Util.is_String(bt): - source = source + ' "%s"' % bt + source += ' "%s"' % bt else: - try: source = source + ' "%s"' % bt.get_abspath() + try: + source += ' "%s"' % bt.get_abspath() except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") else: - try: source = source + ' "%s"' % env['buildtarget'].get_abspath() + try: + source += ' "%s"' % env['buildtarget'].get_abspath() except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None") if 'outdir' in env and env['outdir'] is not None: if SCons.Util.is_String(env['outdir']): - source = source + ' "%s"' % env['outdir'] + source += ' "%s"' % env['outdir'] elif SCons.Util.is_List(env['outdir']): for s in env['outdir']: if SCons.Util.is_String(s): - source = source + ' "%s"' % s + source += ' "%s"' % s else: - try: source = source + ' "%s"' % s.get_abspath() + try: + source += ' "%s"' % s.get_abspath() except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") else: - try: source = source + ' "%s"' % env['outdir'].get_abspath() + try: + source += ' "%s"' % env['outdir'].get_abspath() except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None") if 'name' in env: if SCons.Util.is_String(env['name']): - source = source + ' "%s"' % env['name'] + source += ' "%s"' % env['name'] else: raise SCons.Errors.InternalError("name must be a string") if 'variant' in env: if SCons.Util.is_String(env['variant']): - source = source + ' "%s"' % env['variant'] + source += ' "%s"' % env['variant'] elif SCons.Util.is_List(env['variant']): for variant in env['variant']: if SCons.Util.is_String(variant): - source = source + ' "%s"' % variant + source += ' "%s"' % variant else: raise SCons.Errors.InternalError("name must be a string or a list of strings") else: @@ -1899,17 +1894,17 @@ def projectEmitter(target, source, env): for s in _DSPGenerator.srcargs: if s in env: if SCons.Util.is_String(env[s]): - source = source + ' "%s' % env[s] + source += ' "%s' % env[s] elif SCons.Util.is_List(env[s]): for t in env[s]: if SCons.Util.is_String(t): - source = source + ' "%s"' % t + source += ' "%s"' % t else: raise SCons.Errors.InternalError(s + " must be a string or a list of strings") else: raise SCons.Errors.InternalError(s + " must be a string or a list of strings") - source = source + ' "%s"' % str(target[0]) + source += ' "%s"' % str(target[0]) source = [SCons.Node.Python.Value(source)] targetlist = [target[0]] @@ -1918,7 +1913,7 @@ def projectEmitter(target, source, env): if env.get('auto_build_solution', 1): env['projects'] = [env.File(t).srcnode() for t in targetlist] t, s = solutionEmitter(target, target, env) - targetlist = targetlist + t + targetlist += t # Beginning with Visual Studio 2010 for each project file (.vcxproj) we have additional file (.vcxproj.filters) version_num = 6.0 @@ -1948,17 +1943,17 @@ def solutionEmitter(target, source, env): if 'name' in env: if SCons.Util.is_String(env['name']): - source = source + ' "%s"' % env['name'] + source += ' "%s"' % env['name'] else: raise SCons.Errors.InternalError("name must be a string") if 'variant' in env: if SCons.Util.is_String(env['variant']): - source = source + ' "%s"' % env['variant'] + source += ' "%s"' % env['variant'] elif SCons.Util.is_List(env['variant']): for variant in env['variant']: if SCons.Util.is_String(variant): - source = source + ' "%s"' % variant + source += ' "%s"' % variant else: raise SCons.Errors.InternalError("name must be a string or a list of strings") else: @@ -1968,19 +1963,19 @@ def solutionEmitter(target, source, env): if 'slnguid' in env: if SCons.Util.is_String(env['slnguid']): - source = source + ' "%s"' % env['slnguid'] + source += ' "%s"' % env['slnguid'] else: raise SCons.Errors.InternalError("slnguid must be a string") if 'projects' in env: if SCons.Util.is_String(env['projects']): - source = source + ' "%s"' % env['projects'] + source += ' "%s"' % env['projects'] elif SCons.Util.is_List(env['projects']): for t in env['projects']: if SCons.Util.is_String(t): - source = source + ' "%s"' % t + source += ' "%s"' % t - source = source + ' "%s"' % str(target[0]) + source += ' "%s"' % str(target[0]) source = [SCons.Node.Python.Value(source)] return ([target[0]], source) @@ -2057,11 +2052,7 @@ def generate(env): env['MSVS']['PROJECTSUFFIX'] = '.vcxproj' env['MSVS']['SOLUTIONSUFFIX'] = '.sln' - if (version_num >= 10.0): - env['MSVSENCODING'] = 'utf-8' - else: - env['MSVSENCODING'] = 'Windows-1252' - + env['MSVSENCODING'] = 'utf-8' if (version_num >= 10.0) else 'Windows-1252' env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}' diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/rmic.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/rmic.py index 9ff16745e3..aaf9457780 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/rmic.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/rmic.py @@ -61,11 +61,7 @@ class files to be created from a set of class files. except AttributeError: classdir = '.' classdir = env.Dir(classdir).rdir() - if str(classdir) == '.': - c_ = None - else: - c_ = str(classdir) + os.sep - + c_ = None if str(classdir) == '.' else str(classdir) + os.sep slist = [] for src in source: try: diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/suncxx.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/suncxx.py index 0c70b680d0..cfc7ed3fab 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/suncxx.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/suncxx.py @@ -114,11 +114,7 @@ def get_package_info(package_name, pkginfo, pkgchk): # version of it is installed def get_cppc(env): cxx = env.subst('$CXX') - if cxx: - cppcPath = os.path.dirname(cxx) - else: - cppcPath = None - + cppcPath = os.path.dirname(cxx) if cxx else None cppcVersion = None pkginfo = env.subst('$PKGINFO') diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/textfile.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/textfile.py index 906c1ac4d4..545d5c552e 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/textfile.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/textfile.py @@ -56,11 +56,7 @@ from SCons.Util import is_String, is_Sequence, is_Dict, to_bytes, PY3 -if PY3: - TEXTFILE_FILE_WRITE_MODE = 'w' -else: - TEXTFILE_FILE_WRITE_MODE = 'wb' - +TEXTFILE_FILE_WRITE_MODE = 'w' if PY3 else 'wb' LINESEP = '\n' def _do_subst(node, subs): @@ -110,18 +106,13 @@ def _action(target, source, env): subst_dict = env['SUBST_DICT'] if is_Dict(subst_dict): subst_dict = list(subst_dict.items()) - elif is_Sequence(subst_dict): - pass - else: + elif not is_Sequence(subst_dict): raise SCons.Errors.UserError('SUBST_DICT must be dict or sequence') subs = [] for (k, value) in subst_dict: if callable(value): value = value() - if is_String(value): - value = env.subst(value) - else: - value = str(value) + value = env.subst(value) if is_String(value) else str(value) subs.append((k, value)) # write the file diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/xgettext.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/xgettext.py index 1544a62ccf..2f8e9c5f87 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/xgettext.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Tool/xgettext.py @@ -77,8 +77,7 @@ def strfunction(self, target, source, env): comstr = self.commandstr if env.subst(comstr, target=target, source=source) == "": comstr = self.command - s = env.subst(comstr, target=target, source=source) - return s + return env.subst(comstr, target=target, source=source) ############################################################################# @@ -152,12 +151,12 @@ def _update_pot_file(target, source, env): f = open(str(target[0]), "w") f.write(new_content) f.close() - return 0 else: # Print message employing SCons.Action.Action for that. msg = "Not writing " + repr(str(target[0])) + " (" + explain + ")" env.Execute(SCons.Action.Action(nop, msg)) - return 0 + + return 0 ############################################################################# @@ -186,10 +185,7 @@ def _scan_xgettext_from_files(target, source, env, files=None, path=None): files = [files] if path is None: - if 'XGETTEXTPATH' in env: - path = env['XGETTEXTPATH'] - else: - path = [] + path = env['XGETTEXTPATH'] if 'XGETTEXTPATH' in env else [] if not SCons.Util.is_List(path): path = [path] diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Util.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Util.py index 2bc129a0ba..76d39fd235 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Util.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Util.py @@ -251,11 +251,7 @@ def render_tree(root, child_func, prune=0, margin=[0], visited=None): children = child_func(root) retval = "" for pipe in margin[:-1]: - if pipe: - retval = retval + "| " - else: - retval = retval + " " - + retval += "| " if pipe else " " if rname in visited: return retval + "+-[" + rname + "]\n" @@ -266,7 +262,7 @@ def render_tree(root, child_func, prune=0, margin=[0], visited=None): for i in range(len(children)): margin.append(i < len(children)-1) - retval = retval + render_tree(children[i], child_func, prune, margin, visited) + retval += render_tree(children[i], child_func, prune, margin, visited) margin.pop() return retval @@ -839,7 +835,7 @@ def PrependPath(oldpath, newpath, sep = os.pathsep, orig = oldpath is_list = 1 paths = orig - if not is_List(orig) and not is_Tuple(orig): + if not is_List(paths) and not is_Tuple(paths): paths = paths.split(sep) is_list = 0 @@ -853,14 +849,25 @@ def PrependPath(oldpath, newpath, sep = os.pathsep, if canonicalize: newpaths=list(map(canonicalize, newpaths)) - if not delete_existing: + normpaths = [] + if delete_existing: + newpaths = newpaths + paths # prepend new paths + + paths = [] + # now we add them only if they are unique + for path in newpaths: + normpath = os.path.normpath(os.path.normcase(path)) + if path and normpath not in normpaths: + paths.append(path) + normpaths.append(normpath) + + else: # First uniquify the old paths, making sure to # preserve the first instance (in Unix/Linux, # the first one wins), and remembering them in normpaths. # Then insert the new paths at the head of the list # if they're not already in the normpaths list. result = [] - normpaths = [] for path in paths: if not path: continue @@ -878,18 +885,6 @@ def PrependPath(oldpath, newpath, sep = os.pathsep, normpaths.append(normpath) paths = result - else: - newpaths = newpaths + paths # prepend new paths - - normpaths = [] - paths = [] - # now we add them only if they are unique - for path in newpaths: - normpath = os.path.normpath(os.path.normcase(path)) - if path and normpath not in normpaths: - paths.append(path) - normpaths.append(normpath) - if is_list: return paths else: @@ -934,6 +929,7 @@ def AppendPath(oldpath, newpath, sep = os.pathsep, if canonicalize: newpaths=list(map(canonicalize, newpaths)) + normpaths = [] if not delete_existing: # add old paths to result, then # add new paths if not already present @@ -941,7 +937,6 @@ def AppendPath(oldpath, newpath, sep = os.pathsep, # but it's not clear hashing the strings would be faster # than linear searching these typically short lists.) result = [] - normpaths = [] for path in paths: if not path: continue @@ -961,7 +956,6 @@ def AppendPath(oldpath, newpath, sep = os.pathsep, newpaths = paths + newpaths # append new paths newpaths.reverse() - normpaths = [] paths = [] # now we add them only if they are unique for path in newpaths: @@ -986,15 +980,12 @@ def AddPathIfNotExists(env_dict, key, path, sep=os.pathsep): try: is_list = 1 paths = env_dict[key] - if not is_List(env_dict[key]): + if not is_List(paths): paths = paths.split(sep) is_list = 0 if os.path.normcase(path) not in list(map(os.path.normcase, paths)): paths = [ path ] + paths - if is_list: - env_dict[key] = paths - else: - env_dict[key] = sep.join(paths) + env_dict[key] = paths if is_list else sep.join(paths) except KeyError: env_dict[key] = path @@ -1245,8 +1236,7 @@ def __init__(self, fileobj): self.fileobj = fileobj def readlines(self): - result = [l for l in logical_lines(self.fileobj)] - return result + return [l for l in logical_lines(self.fileobj)] class UniqueList(UserList): @@ -1371,11 +1361,7 @@ def make_path_relative(path): drive_s,path = os.path.splitdrive(path) import re - if not drive_s: - path=re.compile("/*(.*)").findall(path)[0] - else: - path=path[1:] - + path = re.compile("/*(.*)").findall(path)[0] if not drive_s else path[1:] assert( not os.path.isabs( path ) ), path return path diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/BoolVariable.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/BoolVariable.py index 629faaf44e..cf22907328 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/BoolVariable.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/BoolVariable.py @@ -67,7 +67,7 @@ def _validator(key, val, env): This is usable as 'validator' for SCons' Variables. """ - if not env[key] in (True, False): + if env[key] not in (True, False): raise SCons.Errors.UserError( 'Invalid value for boolean option %s: %s' % (key, env[key])) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/__init__.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/__init__.py index 31d6621085..3585de29ca 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/__init__.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/Variables/__init__.py @@ -65,10 +65,7 @@ def __init__(self, files=None, args=None, is_global=1): self.options = [] self.args = args if not SCons.Util.is_List(files): - if files: - files = [ files ] - else: - files = [] + files = [ files ] if files else [] self.files = files self.unknown = {} @@ -300,10 +297,7 @@ def GenerateHelpText(self, env, sort=None): options = self.options def format(opt, self=self, env=env): - if opt.key in env: - actual = env.subst('${%s}' % opt.key) - else: - actual = None + actual = env.subst('${%s}' % opt.key) if opt.key in env else None return self.FormatVariableHelpText(env, opt.key, opt.help, opt.default, actual, opt.aliases) lines = [_f for _f in map(format, options) if _f] @@ -315,7 +309,7 @@ def format(opt, self=self, env=env): def FormatVariableHelpText(self, env, key, help, default, actual, aliases=[]): # Don't display the key name itself as an alias. aliases = [a for a in aliases if a != key] - if len(aliases)==0: + if not aliases: return self.format % (key, help, default, actual) else: return self.format_ % (key, help, default, actual, aliases) diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/cpp.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/cpp.py index 17a92e1b29..528826ad81 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/cpp.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/cpp.py @@ -372,10 +372,7 @@ def find_include_file(self, t): """ fname = t[2] for d in self.searchpath[t[1]]: - if d == os.curdir: - f = fname - else: - f = os.path.join(d, fname) + f = fname if d == os.curdir else os.path.join(d, fname) if os.path.isfile(f): return f return None @@ -551,7 +548,7 @@ def resolve_include(self, t): where FILE is a #define somewhere else.""" s = t[1] - while not s[0] in '<"': + while s[0] not in '<"': #print("s =", s) try: s = self.cpp_namespace[s] diff --git a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/dblite.py b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/dblite.py index 14bd93dc32..928919a5ff 100644 --- a/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/dblite.py +++ b/nuitka/build/inline_copy/lib/scons-3.1.2/SCons/dblite.py @@ -131,8 +131,9 @@ def __init__(self, file_base_name, flag, mode): # Note how we catch KeyErrors too here, which might happen # when we don't have cPickle available (default pickle # throws it). - if (ignore_corrupt_dbfiles == 0): raise - if (ignore_corrupt_dbfiles == 1): + if ignore_corrupt_dbfiles == 0: + raise + elif ignore_corrupt_dbfiles == 1: corruption_warning(self._file_name) def close(self): diff --git a/nuitka/build/inline_copy/pefile/pefile.py b/nuitka/build/inline_copy/pefile/pefile.py index b829610393..18b98e097f 100644 --- a/nuitka/build/inline_copy/pefile/pefile.py +++ b/nuitka/build/inline_copy/pefile/pefile.py @@ -586,7 +586,6 @@ def parse_strings(data, counter, l): l[counter] = b(data[i: i + len_ * 2]).decode('utf-16le') except UnicodeDecodeError: error_count += 1 - pass if error_count >= 3: break i += len_ * 2 @@ -613,10 +612,7 @@ def set_flags(obj, flag_field, flags): """ for flag, value in flags: - if value & flag_field: - obj.__dict__[flag] = True - else: - obj.__dict__[flag] = False + obj.__dict__[flag] = True if value & flag_field else False def power_of_two(val): @@ -736,7 +732,7 @@ class Dump(object): """Convenience class for dumping the PE information.""" def __init__(self): - self.text = list() + self.text = [] def add_lines(self, txt, indent=0): """Adds a list of lines. @@ -793,15 +789,12 @@ def __init__(self, format, name=None, file_offset=None): self.__format__ = '<' self.__keys__ = [] self.__format_length__ = 0 - self.__field_offsets__ = dict() + self.__field_offsets__ = {} self.__unpacked_data_elms__ = [] self.__set_format__(format[1]) self.__all_zeroes__ = False self.__file_offset__ = file_offset - if name: - self.name = name - else: - self.name = format[0] + self.name = name if name else format[0] def __get_format__(self): @@ -924,9 +917,7 @@ def __repr__(self): def dump(self, indentation=0): """Returns a string representation of the structure.""" - dump = [] - - dump.append('[{0}]'.format(self.name)) + dump = ['[{0}]'.format(self.name)] printable_bytes = [ord(i) for i in string.printable if i not in string.whitespace] @@ -937,11 +928,8 @@ def dump(self, indentation=0): val = getattr(self, key) if isinstance(val, (int, long)): - if key.startswith('Signature_'): - val_str = '%-8X' % (val) - else: - val_str = '0x%-8X' % (val) - if key == 'TimeDateStamp' or key == 'dwTimeStamp': + val_str = '%-8X' % (val) if key.startswith('Signature_') else '0x%-8X' % (val) + if key in ['TimeDateStamp', 'dwTimeStamp']: try: val_str += ' [%s UTC]' % time.asctime(time.gmtime(val)) except ValueError as e: @@ -965,9 +953,7 @@ def dump(self, indentation=0): def dump_dict(self): """Returns a dictionary representation of the structure.""" - dump_dict = dict() - - dump_dict['Structure'] = self.name + dump_dict = {'Structure': self.name} # Refer to the __set_format__ method for an explanation # of the following construct. @@ -976,7 +962,7 @@ def dump_dict(self): val = getattr(self, key) if isinstance(val, (int, long)): - if key == 'TimeDateStamp' or key == 'dwTimeStamp': + if key in ['TimeDateStamp', 'dwTimeStamp']: try: val = '0x%-8X [%s UTC]' % (val, time.asctime(time.gmtime(val))) except ValueError as e: @@ -1025,10 +1011,7 @@ def get_data(self, start=None, length=None): else: offset = ( start - VirtualAddress_adj ) + PointerToRawData_adj - if length is not None: - end = offset + length - else: - end = offset + self.SizeOfRawData + end = offset + length if length is not None else offset + self.SizeOfRawData # PointerToRawData is not adjusted here as we might want to read any possible extra bytes # that might get cut off by aligning the start (and hence cutting something off the end) # @@ -2074,11 +2057,7 @@ def __parse__(self, fname, data, fast_load): self.OPTIONAL_HEADER.FileAlignment ) for s in self.sections if s.PointerToRawData>0 ] - if len(rawDataPointers) > 0: - lowest_section_offset = min(rawDataPointers) - else: - lowest_section_offset = None - + lowest_section_offset = min(rawDataPointers) if rawDataPointers else None if not lowest_section_offset or lowest_section_offset < offset: self.header = self.__data__[:offset] else: @@ -2255,27 +2234,26 @@ def write(self, filename=None): offset = structure.get_file_offset() file_data[offset:offset+len(struct_data)] = struct_data - if hasattr(self, 'VS_VERSIONINFO'): - if hasattr(self, 'FileInfo'): - for finfo in self.FileInfo: - for entry in finfo: - if hasattr(entry, 'StringTable'): - for st_entry in entry.StringTable: - for key, entry in list(st_entry.entries.items()): - - # Offsets and lengths of the keys and values. - # Each value in the dictionary is a tuple: - # (key length, value length) - # The lengths are in characters, not in bytes. - offsets = st_entry.entries_offsets[key] - lengths = st_entry.entries_lengths[key] - - if len( entry ) > lengths[1]: - l = entry.decode('utf-8').encode('utf-16le') - file_data[offsets[1]:offsets[1]+lengths[1]*2 ] = l[:lengths[1]*2] - else: - encoded_data = entry.decode('utf-8').encode('utf-16le') - file_data[offsets[1]:offsets[1]+len(encoded_data)] = encoded_data + if hasattr(self, 'VS_VERSIONINFO') and hasattr(self, 'FileInfo'): + for finfo in self.FileInfo: + for entry in finfo: + if hasattr(entry, 'StringTable'): + for st_entry in entry.StringTable: + for key, entry in list(st_entry.entries.items()): + + # Offsets and lengths of the keys and values. + # Each value in the dictionary is a tuple: + # (key length, value length) + # The lengths are in characters, not in bytes. + offsets = st_entry.entries_offsets[key] + lengths = st_entry.entries_lengths[key] + + if len( entry ) > lengths[1]: + l = entry.decode('utf-8').encode('utf-16le') + file_data[offsets[1]:offsets[1]+lengths[1]*2 ] = l[:lengths[1]*2] + else: + encoded_data = entry.decode('utf-8').encode('utf-16le') + file_data[offsets[1]:offsets[1]+len(encoded_data)] = encoded_data new_file_data = file_data if not filename: @@ -2446,9 +2424,8 @@ def parse_data_directories(self, directories=None, ('IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT', self.parse_delay_import_directory), ('IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT', self.parse_directory_bound_imports) ) - if directories is not None: - if not isinstance(directories, (tuple, list)): - directories = [directories] + if directories is not None and not isinstance(directories, (tuple, list)): + directories = [directories] for entry in directory_parsing: # OC Patch: @@ -2462,18 +2439,18 @@ def parse_data_directories(self, directories=None, # Only process all the directories if no individual ones have # been chosen # - if directories is None or directory_index in directories: + if ( + directories is None or directory_index in directories + ) and dir_entry.VirtualAddress: + if forwarded_exports_only and entry[0] == 'IMAGE_DIRECTORY_ENTRY_EXPORT': + value = entry[1](dir_entry.VirtualAddress, dir_entry.Size, forwarded_only=True) + elif import_dllnames_only and entry[0] == 'IMAGE_DIRECTORY_ENTRY_IMPORT': + value = entry[1](dir_entry.VirtualAddress, dir_entry.Size, dllnames_only=True) - if dir_entry.VirtualAddress: - if forwarded_exports_only and entry[0] == 'IMAGE_DIRECTORY_ENTRY_EXPORT': - value = entry[1](dir_entry.VirtualAddress, dir_entry.Size, forwarded_only=True) - elif import_dllnames_only and entry[0] == 'IMAGE_DIRECTORY_ENTRY_IMPORT': - value = entry[1](dir_entry.VirtualAddress, dir_entry.Size, dllnames_only=True) - - else: - value = entry[1](dir_entry.VirtualAddress, dir_entry.Size) - if value: - setattr(self, entry[0][6:], value) + else: + value = entry[1](dir_entry.VirtualAddress, dir_entry.Size) + if value: + setattr(self, entry[0][6:], value) if (directories is not None) and isinstance(directories, list) and (entry[0] in directories): directories.remove(directory_index) @@ -2534,7 +2511,7 @@ def parse_directory_bound_imports(self, rva, size): forwarder_refs = [] # 8 is the size of __IMAGE_BOUND_IMPORT_DESCRIPTOR_format__ - for idx in range(min(bnd_descr.NumberOfModuleForwarderRefs, + for _ in range(min(bnd_descr.NumberOfModuleForwarderRefs, int(safety_boundary / 8))): # Both structures IMAGE_BOUND_IMPORT_DESCRIPTOR and # IMAGE_BOUND_FORWARDER_REF have the same size. @@ -3135,12 +3112,10 @@ def parse_resources_directory(self, rva, size=0, base_rva = None, level = 0, dir for idx, s in enumerate(strings_to_postprocess): s.render_pascal_16() - resource_directory_data = ResourceDirData( + return ResourceDirData( struct = resource_dir, entries = dir_entries) - return resource_directory_data - def parse_resource_data_entry(self, rva): """Parse a data entry from the resources directory.""" diff --git a/nuitka/codegen/CallCodes.py b/nuitka/codegen/CallCodes.py index 35a4fbcf5e..c64d2d5d05 100644 --- a/nuitka/codegen/CallCodes.py +++ b/nuitka/codegen/CallCodes.py @@ -600,9 +600,7 @@ def getCallsDecls(): def getCallsCode(): - result = [] - - result.append(template_helper_impl_decl % {}) + result = [template_helper_impl_decl % {}] for quick_call_used in sorted(quick_calls_used.union(quick_instance_calls_used)): result.append( diff --git a/nuitka/codegen/CodeHelpers.py b/nuitka/codegen/CodeHelpers.py index 2dac780ad2..f9503ada8e 100644 --- a/nuitka/codegen/CodeHelpers.py +++ b/nuitka/codegen/CodeHelpers.py @@ -296,6 +296,4 @@ def pickCodeHelper( if source_ref is not None and ideal_helper not in nonhelpers: onMissingHelper(ideal_helper, source_ref) - fallback_helper = "%s_%s_%s%s" % (prefix, "OBJECT", "OBJECT", suffix) - - return fallback_helper + return "%s_%s_%s%s" % (prefix, "OBJECT", "OBJECT", suffix) diff --git a/nuitka/codegen/CodeObjectCodes.py b/nuitka/codegen/CodeObjectCodes.py index 02e8904f2f..7c28980b5b 100644 --- a/nuitka/codegen/CodeObjectCodes.py +++ b/nuitka/codegen/CodeObjectCodes.py @@ -129,8 +129,10 @@ def getCodeObjectsInitCode(context): statements.append(code) - if context.getOwner().getFullName() == "__main__": - if code_object_key[1] == "": - statements.append("codeobj_main = %s;" % code_identifier) + if ( + context.getOwner().getFullName() == "__main__" + and code_object_key[1] == "" + ): + statements.append("codeobj_main = %s;" % code_identifier) return statements diff --git a/nuitka/codegen/ComparisonCodes.py b/nuitka/codegen/ComparisonCodes.py index 6811559fd0..86d17dfe1b 100644 --- a/nuitka/codegen/ComparisonCodes.py +++ b/nuitka/codegen/ComparisonCodes.py @@ -98,12 +98,11 @@ def generateComparisonExpressionCode(to_name, expression, emit, context): comparator = expression.getComparator() type_name = "PyObject *" - if comparator in ("Is", "IsNot"): - if ( - left.getTypeShape() is ShapeTypeBool - and right.getTypeShape() is ShapeTypeBool - ): - type_name = "nuitka_bool" + if comparator in ("Is", "IsNot") and ( + left.getTypeShape() is ShapeTypeBool + and right.getTypeShape() is ShapeTypeBool + ): + type_name = "nuitka_bool" left_name = context.allocateTempName("compexpr_left", type_name=type_name) right_name = context.allocateTempName("compexpr_right", type_name=type_name) diff --git a/nuitka/codegen/ConditionalCodes.py b/nuitka/codegen/ConditionalCodes.py index 15c0345191..1045e5fd21 100644 --- a/nuitka/codegen/ConditionalCodes.py +++ b/nuitka/codegen/ConditionalCodes.py @@ -53,11 +53,7 @@ def generateConditionalAndOrCode(to_name, expression, emit, context): # This is a complex beast, handling both "or" and "and" expressions, # and it needs to micro manage details. # pylint: disable=too-many-locals - if expression.isExpressionConditionalOr(): - prefix = "or_" - else: - prefix = "and_" - + prefix = "or_" if expression.isExpressionConditionalOr() else "and_" true_target = context.allocateLabel(prefix + "left") false_target = context.allocateLabel(prefix + "right") end_target = context.allocateLabel(prefix + "end") diff --git a/nuitka/codegen/ConstantCodes.py b/nuitka/codegen/ConstantCodes.py index acedb154c2..141758e1af 100644 --- a/nuitka/codegen/ConstantCodes.py +++ b/nuitka/codegen/ConstantCodes.py @@ -401,11 +401,9 @@ def __addConstantInitCode( % (constant_identifier, constant_value) ) - return elif 0 > constant_value >= min_signed_long: emit("%s = PyLong_FromLong(%sl);" % (constant_identifier, constant_value)) - return elif constant_value == min_signed_long - 1: # There are compilers out there, that give warnings for the literal # MININT when used. We work around that warning here. @@ -422,7 +420,6 @@ def __addConstantInitCode( ) ) - return else: getMarshalCode( constant_identifier=constant_identifier, @@ -430,12 +427,11 @@ def __addConstantInitCode( emit=emit, ) - return + return elif constant_type is int: if constant_value >= min_signed_long: emit("%s = PyInt_FromLong(%sl);" % (constant_identifier, constant_value)) - return else: # There are compilers out there, that give warnings for the literal # MININT when used. We work around that warning here. @@ -453,8 +449,7 @@ def __addConstantInitCode( ) ) - return - + return if constant_type is unicode: try: encoded = constant_value.encode("utf-8") @@ -465,7 +460,7 @@ def __addConstantInitCode( % (constant_identifier, stream_data.getStreamDataCode(encoded)) ) else: - if str is not bytes and len(constant_value) == len(encoded): + if len(constant_value) == len(encoded): emit( "%s = UNSTREAM_STRING_ASCII(%s, %d);" % ( diff --git a/nuitka/codegen/Contexts.py b/nuitka/codegen/Contexts.py index fa923adb15..630c79a82e 100644 --- a/nuitka/codegen/Contexts.py +++ b/nuitka/codegen/Contexts.py @@ -91,9 +91,7 @@ def allocateTempName(self, base_name, type_name="PyObject *", unique=False): result = self.variable_storage.getVariableDeclarationTop(formatted_name) if result is None: - if base_name == "outline_return_value": - init_value = "NULL" - elif base_name == "return_value": + if base_name in ["outline_return_value", "return_value"]: init_value = "NULL" elif base_name == "generator_return": init_value = "false" @@ -180,11 +178,7 @@ def allocateExceptionKeeperVariables(self): # use, the NULL init is needed. debug = Options.isDebug() and python_version >= 300 - if debug: - keeper_obj_init = "NULL" - else: - keeper_obj_init = None - + keeper_obj_init = "NULL" if debug else None return ( self.variable_storage.addVariableDeclarationTop( "PyObject *", @@ -223,11 +217,7 @@ def addExceptionPreserverVariables(self, preserver_id): debug = Options.isDebug() and python_version >= 300 - if debug: - preserver_obj_init = "NULL" - else: - preserver_obj_init = None - + preserver_obj_init = "NULL" if debug else None self.preserver_variable_declaration[preserver_id] = ( self.variable_storage.addVariableDeclarationTop( "PyObject *", @@ -374,9 +364,8 @@ def setCurrentSourceCodeReference(self, value): return result def getLastSourceCodeReference(self): - result = self.last_source_ref # self.last_source_ref = None - return result + return self.last_source_ref def getInplaceLeftName(self): return self.allocateTempName("inplace_orig", "PyObject *", True) @@ -749,39 +738,14 @@ def getConstantCode(self, constant): elif type(constant) is type: # TODO: Maybe make this a mapping in nuitka.Builtins - if constant is None: - key = "(PyObject *)Py_TYPE(Py_None)" - elif constant is object: - key = "(PyObject *)&PyBaseObject_Type" - elif constant is staticmethod: - key = "(PyObject *)&PyStaticMethod_Type" - elif constant is classmethod: - key = "(PyObject *)&PyClassMethod_Type" - elif constant is bytearray: - key = "(PyObject *)&PyByteArray_Type" - elif constant is enumerate: - key = "(PyObject *)&PyEnum_Type" - elif constant is frozenset: - key = "(PyObject *)&PyFrozenSet_Type" - elif python_version >= 270 and constant is memoryview: - key = "(PyObject *)&PyMemoryView_Type" - elif python_version < 300 and constant is basestring: - key = "(PyObject *)&PyBaseString_Type" - elif python_version < 300 and constant is xrange: - key = "(PyObject *)&PyRange_Type" - elif constant in builtin_anon_values: - key = "(PyObject *)" + builtin_anon_codes[builtin_anon_values[constant]] - elif constant in builtin_exception_values_list: - key = "(PyObject *)PyExc_%s" % constant.__name__ - else: - type_name = constant.__name__ + type_name = constant.__name__ - if constant is int and python_version >= 300: - type_name = "long" - elif constant is str: - type_name = "string" if python_version < 300 else "unicode" + if constant is int and python_version >= 300: + type_name = "long" + elif constant is str: + type_name = "string" if python_version < 300 else "unicode" - key = "(PyObject *)&Py%s_Type" % type_name.title() + key = "(PyObject *)&Py%s_Type" % type_name.title() else: key = "const_" + namifyConstant(constant) diff --git a/nuitka/codegen/FunctionCodes.py b/nuitka/codegen/FunctionCodes.py index 3bd2a9b2a5..48e27e1d12 100644 --- a/nuitka/codegen/FunctionCodes.py +++ b/nuitka/codegen/FunctionCodes.py @@ -100,11 +100,7 @@ def getFunctionQualnameObj(owner, context): NULL instead. """ - if owner.isExpressionFunctionBody(): - min_version = 300 - else: - min_version = 350 - + min_version = 300 if owner.isExpressionFunctionBody() else 350 if python_version < min_version: return "NULL" @@ -450,14 +446,12 @@ def getFunctionDirectDecl(function_identifier, closure_variables, file_scope, co variable_c_type.getVariableArgDeclarationCode(variable_declaration) ) - result = template_function_direct_declaration % { + return template_function_direct_declaration % { "file_scope": file_scope, "function_identifier": function_identifier, "direct_call_arg_spec": ", ".join(parameter_objects_decl), } - return result - def setupFunctionLocalVariables( context, parameters, closure_variables, user_variables, temp_variables diff --git a/nuitka/codegen/OperationCodes.py b/nuitka/codegen/OperationCodes.py index 1957413aea..eef9aa097e 100644 --- a/nuitka/codegen/OperationCodes.py +++ b/nuitka/codegen/OperationCodes.py @@ -701,12 +701,12 @@ def _getUnaryOperationCode( ): impl_helper, ref_count = OperatorCodes.unary_operator_codes[operator] - helper = "UNARY_OPERATION" - prefix_args = (impl_helper,) - with withObjectCodeTemporaryAssignment( - to_name, "op_%s_res" % operator.lower(), expression, emit, context - ) as value_name: + to_name, "op_%s_res" % operator.lower(), expression, emit, context + ) as value_name: + + helper = "UNARY_OPERATION" + prefix_args = (impl_helper,) emit( "%s = %s(%s);" diff --git a/nuitka/codegen/RaisingCodes.py b/nuitka/codegen/RaisingCodes.py index a4a2b6bc36..b6d38f1ef0 100644 --- a/nuitka/codegen/RaisingCodes.py +++ b/nuitka/codegen/RaisingCodes.py @@ -197,8 +197,7 @@ def generateRaiseExpressionCode(to_name, expression, emit, context): parent.isExpressionSideEffects() or parent.isExpressionConditional() or parent.isExpressionLocalsVariableRefOrFallback() - ), (expression, expression.parent, expression.asXmlText()) - + ), (expression, parent, expression.asXmlText()) with withObjectCodeTemporaryAssignment( to_name, "raise_exception_result", expression, emit, context ) as value_name: diff --git a/nuitka/codegen/SliceCodes.py b/nuitka/codegen/SliceCodes.py index b6c52b8b21..420328e51a 100644 --- a/nuitka/codegen/SliceCodes.py +++ b/nuitka/codegen/SliceCodes.py @@ -189,7 +189,6 @@ def generateAssignmentSliceCode(statement, emit, context): context=context, ) - context.setCurrentSourceCodeReference(old_source_ref) else: lower_name, upper_name = generateExpressionsCode( names=("sliceass_lower", "sliceass_upper"), @@ -213,7 +212,8 @@ def generateAssignmentSliceCode(statement, emit, context): context=context, ) - context.setCurrentSourceCodeReference(old_source_ref) + + context.setCurrentSourceCodeReference(old_source_ref) def generateDelSliceCode(statement, emit, context): @@ -248,7 +248,6 @@ def generateDelSliceCode(statement, emit, context): context=context, ) - context.setCurrentSourceCodeReference(old_source_ref) else: lower_name, upper_name = generateExpressionsCode( names=("slicedel_lower", "slicedel_upper"), @@ -271,7 +270,8 @@ def generateDelSliceCode(statement, emit, context): context=context, ) - context.setCurrentSourceCodeReference(old_source_ref) + + context.setCurrentSourceCodeReference(old_source_ref) def generateBuiltinSliceCode(to_name, expression, emit, context): diff --git a/nuitka/codegen/VariableCodes.py b/nuitka/codegen/VariableCodes.py index a55275fc89..a3cd24f639 100644 --- a/nuitka/codegen/VariableCodes.py +++ b/nuitka/codegen/VariableCodes.py @@ -320,11 +320,7 @@ def getVariableAssignmentCode( context, emit, variable, variable_trace, tmp_name, needs_release, in_place ): # For transfer of ownership. - if context.needsCleanup(tmp_name): - ref_count = 1 - else: - ref_count = 0 - + ref_count = 1 if context.needsCleanup(tmp_name) else 0 if variable.isModuleVariable(): variable_declaration = VariableDeclaration( "module_var", variable.getName(), None, None @@ -380,11 +376,7 @@ def _getVariableDelCode( if variable.isLocalVariable(): context.setVariableType(variable, variable_declaration_new) - if needs_check and not tolerant: - to_name = context.getBoolResName() - else: - to_name = None - + to_name = context.getBoolResName() if needs_check and not tolerant else None variable_declaration_old.getCType().getDeleteObjectCode( to_name=to_name, value_name=variable_declaration_old, diff --git a/nuitka/codegen/VariableDeclarations.py b/nuitka/codegen/VariableDeclarations.py index 33acf2e5a7..153f3ce502 100644 --- a/nuitka/codegen/VariableDeclarations.py +++ b/nuitka/codegen/VariableDeclarations.py @@ -67,7 +67,7 @@ def makeCStructDeclaration(self): return "%s%s%s%s;" % ( c_type, - " " if self.c_type[-1] != "*" else "", + " " if c_type[-1] != "*" else "", self.code_name, array_decl, ) diff --git a/nuitka/codegen/YieldCodes.py b/nuitka/codegen/YieldCodes.py index 91d0c1beee..01585427b9 100644 --- a/nuitka/codegen/YieldCodes.py +++ b/nuitka/codegen/YieldCodes.py @@ -36,11 +36,7 @@ def _getYieldPreserveCode( # Need not preserve it, if we are not going to use it for the purpose # of releasing it. - if type(value_name) is tuple: - value_names = value_name - else: - value_names = (value_name,) - + value_names = value_name if type(value_name) is tuple else (value_name, ) for name in value_names: if not context.needsCleanup(name): locals_preserved.remove(name) diff --git a/nuitka/codegen/c_types/CTypeNuitkaBools.py b/nuitka/codegen/c_types/CTypeNuitkaBools.py index 76257c0e44..95ac98ec6b 100644 --- a/nuitka/codegen/c_types/CTypeNuitkaBools.py +++ b/nuitka/codegen/c_types/CTypeNuitkaBools.py @@ -99,13 +99,10 @@ def getReleaseCode(cls, variable_code_name, needs_check, emit): def getDeleteObjectCode( cls, to_name, value_name, needs_check, tolerant, emit, context ): - if not needs_check: - emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) - elif tolerant: - emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) - else: + if needs_check and not tolerant: emit("%s = %s == NUITKA_BOOL_UNASSIGNED;" % (to_name, value_name)) - emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) + + emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) @classmethod def emitAssignmentCodeFromBoolCondition(cls, to_name, condition, emit): diff --git a/nuitka/codegen/c_types/CTypeNuitkaInts.py b/nuitka/codegen/c_types/CTypeNuitkaInts.py index e830d32471..70b8ac2f8e 100644 --- a/nuitka/codegen/c_types/CTypeNuitkaInts.py +++ b/nuitka/codegen/c_types/CTypeNuitkaInts.py @@ -112,11 +112,7 @@ def getReleaseCode(cls, variable_code_name, needs_check, emit): % variable_code_name ) - if needs_check: - template = template_release_unclear - else: - template = template_release_clear - + template = template_release_unclear if needs_check else template_release_clear emit(template % {"identifier": "%s.ilong_object" % variable_code_name}) emit("}") @@ -127,13 +123,10 @@ def getDeleteObjectCode( ): assert False, "TODO" - if not needs_check: - emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) - elif tolerant: - emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) - else: + if needs_check and not tolerant: emit("%s = %s == NUITKA_BOOL_UNASSIGNED;" % (to_name, value_name)) - emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) + + emit("%s = NUITKA_BOOL_UNASSIGNED;" % value_name) @classmethod def emitAssignmentCodeFromBoolCondition(cls, to_name, condition, emit): diff --git a/nuitka/codegen/c_types/CTypePyObjectPtrs.py b/nuitka/codegen/c_types/CTypePyObjectPtrs.py index e9a9a76ba0..98526e2a8f 100644 --- a/nuitka/codegen/c_types/CTypePyObjectPtrs.py +++ b/nuitka/codegen/c_types/CTypePyObjectPtrs.py @@ -93,11 +93,7 @@ def emitTruthCheckCode(cls, to_name, value_name, needs_check, emit, context): @classmethod def getReleaseCode(cls, variable_code_name, needs_check, emit): - if needs_check: - template = template_release_unclear - else: - template = template_release_clear - + template = template_release_unclear if needs_check else template_release_clear emit(template % {"identifier": variable_code_name}) @classmethod @@ -322,9 +318,5 @@ def getDeleteObjectCode( @classmethod def getReleaseCode(cls, variable_code_name, needs_check, emit): - if needs_check: - template = template_release_unclear - else: - template = template_release_clear - + template = template_release_unclear if needs_check else template_release_clear emit(template % {"identifier": variable_code_name}) diff --git a/nuitka/finalizations/FinalizeMarkups.py b/nuitka/finalizations/FinalizeMarkups.py index b949acf2cb..9b82e39534 100644 --- a/nuitka/finalizations/FinalizeMarkups.py +++ b/nuitka/finalizations/FinalizeMarkups.py @@ -65,8 +65,6 @@ def _onEnterNode(self, node): if node.isStatementReturn() or node.isStatementGeneratorReturn(): search = node - in_tried_block = False - # Search up to the containing function, and check for a try/finally # containing the "return" statement. search = search.getParentReturnConsumer() @@ -76,6 +74,8 @@ def _onEnterNode(self, node): or search.isExpressionCoroutineObjectBody() or search.isExpressionAsyncgenObjectBody() ): + in_tried_block = False + if in_tried_block: search.markAsNeedsGeneratorReturnHandling(2) else: @@ -87,16 +87,19 @@ def _onEnterNode(self, node): if module_name.isCompileTimeConstant(): imported_module_name = module_name.getCompileTimeConstant() - if type(imported_module_name) in (str, unicode): - if imported_module_name: - imported_names.add(imported_module_name) + if ( + type(imported_module_name) in (str, unicode) + and imported_module_name + ): + imported_names.add(imported_module_name) - if node.isExpressionFunctionCreation(): - if ( + if node.isExpressionFunctionCreation() and ( + ( not node.getParent().isExpressionFunctionCall() or node.getParent().getFunction() is not node - ): - node.getFunctionRef().getFunctionBody().markAsNeedsCreation() + ) + ): + node.getFunctionRef().getFunctionBody().markAsNeedsCreation() if node.isExpressionFunctionCall(): node.getFunction().getFunctionRef().getFunctionBody().markAsDirectlyCalled() @@ -119,9 +122,11 @@ def _onEnterNode(self, node): left_arg = assign_source.getLeft() if left_arg.isExpressionVariableRef(): - if assign_source.getLeft().getVariable() is target_var: - if assign_source.isInplaceSuspect(): - node.markAsInplaceSuspect() + if ( + assign_source.getLeft().getVariable() is target_var + and assign_source.isInplaceSuspect() + ): + node.markAsInplaceSuspect() elif left_arg.isExpressionLocalsVariableRefOrFallback(): assign_source.unmarkAsInplaceSuspect() @@ -134,25 +139,26 @@ def _onEnterNode(self, node): if python_version < 300 and node.isStatementPublishException(): node.getParentStatementsFrame().markAsFrameExceptionPreserving() - if python_version >= 300: - if ( + if python_version >= 300 and ( + ( node.isExpressionYield() or node.isExpressionYieldFrom() or node.isExpressionYieldFromWaitable() + ) + ): + search = node.getParent() + + while ( + not search.isExpressionGeneratorObjectBody() + and not search.isExpressionCoroutineObjectBody() + and not search.isExpressionAsyncgenObjectBody() ): - search = node.getParent() + last_search = search + search = search.getParent() - while ( - not search.isExpressionGeneratorObjectBody() - and not search.isExpressionCoroutineObjectBody() - and not search.isExpressionAsyncgenObjectBody() + if ( + search.isStatementTry() + and last_search == search.getBlockExceptHandler() ): - last_search = search - search = search.getParent() - - if ( - search.isStatementTry() - and last_search == search.getBlockExceptHandler() - ): - node.markAsExceptionPreserving() - break + node.markAsExceptionPreserving() + break diff --git a/nuitka/freezer/Standalone.py b/nuitka/freezer/Standalone.py index b50dcdb799..a7073bb361 100644 --- a/nuitka/freezer/Standalone.py +++ b/nuitka/freezer/Standalone.py @@ -85,15 +85,14 @@ def loadCodeObjectData(precompiled_filename): def _detectedPrecompiledFile(filename, module_name, result, user_provided, technical): - if filename.endswith(".pyc"): - if os.path.isfile(filename[:-1]): - return _detectedSourceFile( - filename=filename[:-1], - module_name=module_name, - result=result, - user_provided=user_provided, - technical=technical, - ) + if filename.endswith(".pyc") and os.path.isfile(filename[:-1]): + return _detectedSourceFile( + filename=filename[:-1], + module_name=module_name, + result=result, + user_provided=user_provided, + technical=technical, + ) if module_name in module_names: return @@ -301,9 +300,8 @@ def _detectImports(command, user_provided, technical): # Python3 started lying in "__name__" for the "_decimal" # calls itself "decimal", which then is wrong and also # clashes with "decimal" proper - if python_version >= 300: - if module_name == "decimal": - module_name = ModuleName("_decimal") + if python_version >= 300 and module_name == "decimal": + module_name = ModuleName("_decimal") detections.append((module_name, 2, "shlib", filename)) elif origin == b"dynamically": @@ -328,6 +326,8 @@ def _detectImports(command, user_provided, technical): user_provided=user_provided, technical=technical, ) + elif kind == "shlib": + _detectedShlibFile(filename=filename, module_name=module_name) elif kind == "sourcefile": _detectedSourceFile( filename=filename, @@ -336,8 +336,6 @@ def _detectImports(command, user_provided, technical): user_provided=user_provided, technical=technical, ) - elif kind == "shlib": - _detectedShlibFile(filename=filename, module_name=module_name) else: assert False, kind @@ -598,11 +596,7 @@ def _detectBinaryPathDLLsPosix(dll_filename): part = line.split(b" => ", 2)[1] - if b"(" in part: - filename = part[: part.rfind(b"(") - 1] - else: - filename = part - + filename = part[: part.rfind(b"(") - 1] if b"(" in part else part if not filename: continue @@ -696,11 +690,7 @@ def _detectBinaryPathDLLsMacOS(original_dir, binary_filename, keep_unresolved): continue filename = line.split(b" (")[0].strip() - stop = False - for w in system_paths: - if filename.startswith(w): - stop = True - break + stop = any(filename.startswith(w) for w in system_paths) if not stop: if python_version >= 300: filename = filename.decode("utf-8") @@ -708,18 +698,13 @@ def _detectBinaryPathDLLsMacOS(original_dir, binary_filename, keep_unresolved): # print("adding", filename) result.add(filename) - resolved_result = _resolveBinaryPathDLLsMacOS( + return _resolveBinaryPathDLLsMacOS( original_dir, binary_filename, result, keep_unresolved ) - return resolved_result def _resolveBinaryPathDLLsMacOS(original_dir, binary_filename, paths, keep_unresolved): - if keep_unresolved: - result = {} - else: - result = set() - + result = {} if keep_unresolved else set() rpaths = _detectBinaryRPathsMacOS(original_dir, binary_filename) for path in paths: @@ -1393,11 +1378,12 @@ def copyUsedDLLs(source_dir, dist_dir, standalone_entry_points): source_dir=source_dir, standalone_entry_points=standalone_entry_points, use_cache=not Options.shallNotUseDependsExeCachedResults() - and not Options.getWindowsDependencyTool() == "depends.exe", + and Options.getWindowsDependencyTool() != "depends.exe", update_cache=not Options.shallNotStoreDependsExeCachedResults() - and not Options.getWindowsDependencyTool() == "depends.exe", + and Options.getWindowsDependencyTool() != "depends.exe", ) + removed_dlls = set() # Fist make checks and remove some. diff --git a/nuitka/importing/ImportCache.py b/nuitka/importing/ImportCache.py index 4f4dbb66fc..0c24625168 100644 --- a/nuitka/importing/ImportCache.py +++ b/nuitka/importing/ImportCache.py @@ -55,11 +55,7 @@ def addImportedModule(imported_module): def isImportedModuleByPath(module_relpath): - for key in imported_modules: - if key[0] == module_relpath: - return True - - return False + return any(key[0] == module_relpath for key in imported_modules) def isImportedModuleByName(full_name): diff --git a/nuitka/importing/Importing.py b/nuitka/importing/Importing.py index 383973374c..fd3f0b988e 100644 --- a/nuitka/importing/Importing.py +++ b/nuitka/importing/Importing.py @@ -157,11 +157,7 @@ def warnAbout(importing, module_name, parent_package, level, tried_names): if key not in warned_about: warned_about.add(key) - if parent_package is None: - full_name = module_name - else: - full_name = module_name - + full_name = module_name if Plugins.suppressUnknownImportWarning(importing, full_name): return diff --git a/nuitka/importing/StandardLibrary.py b/nuitka/importing/StandardLibrary.py index db8cddb0c7..d50707ca53 100644 --- a/nuitka/importing/StandardLibrary.py +++ b/nuitka/importing/StandardLibrary.py @@ -123,8 +123,6 @@ def isStandardLibraryPath(path): if "dist-packages" in path or "site-packages" in path: return False - for candidate in getStandardLibraryPaths(): - if path.startswith(candidate): - return True - - return False + return any( + path.startswith(candidate) for candidate in getStandardLibraryPaths() + ) diff --git a/nuitka/importing/Whitelisting.py b/nuitka/importing/Whitelisting.py index 82043c30c2..4ecb5e2dec 100644 --- a/nuitka/importing/Whitelisting.py +++ b/nuitka/importing/Whitelisting.py @@ -432,11 +432,11 @@ def getModuleWhiteList(): def isWhiteListedNotExistingModule(module_name): - result = False - for white_listed in getModuleWhiteList(): - if module_name == white_listed or module_name.startswith(white_listed + "."): - result = True - break + result = any( + module_name == white_listed + or module_name.startswith(white_listed + ".") + for white_listed in getModuleWhiteList() + ) if not result and module_name in sys.builtin_module_names: warning( diff --git a/nuitka/nodes/AssignNodes.py b/nuitka/nodes/AssignNodes.py index 681a99b67b..dae88ca608 100644 --- a/nuitka/nodes/AssignNodes.py +++ b/nuitka/nodes/AssignNodes.py @@ -144,9 +144,8 @@ class StatementAssignmentVariable(StatementChildHavingBase): def __init__(self, source, variable, source_ref, version=None): assert source is not None, source_ref - if variable is not None: - if version is None: - version = variable.allocateTargetNumber() + if variable is not None and version is None: + version = variable.allocateTargetNumber() self.variable = variable self.variable_version = version @@ -448,9 +447,8 @@ def __init__(self, tolerant, source_ref, variable, version=None): tolerant = tolerant == "True" assert tolerant is True or tolerant is False, repr(tolerant) - if variable is not None: - if version is None: - version = variable.allocateTargetNumber() + if variable is not None and version is None: + version = variable.allocateTargetNumber() StatementBase.__init__(self, source_ref=source_ref) diff --git a/setup.py b/setup.py index 9f7abc2274..a9e84a4539 100644 --- a/setup.py +++ b/setup.py @@ -164,8 +164,7 @@ def get_args(cls, dist, header=None): args = cls._get_script_args( # pylint: disable=protected-access type_, name, header, script_text ) - for res in args: - yield res + yield from args try: @@ -177,9 +176,9 @@ def get_args(cls, dist, header=None): def get_script_args(dist, executable=os.path.normpath(sys.executable), wininst=False): """Yield write_script() argument tuples for a distribution's entrypoints""" header = easy_install.get_script_header("", executable, wininst) + script_text = runner_script_template for group in "console_scripts", "gui_scripts": for name, _ep in dist.get_entry_map(group).items(): - script_text = runner_script_template if sys.platform == "win32" or wininst: # On Windows/wininst, add a .py extension and an .exe launcher if group == "gui_scripts":