def shallTreatUninstalledPython(): """ *bool* = derived from Python installation and modes Notes: Not done for standalone mode obviously. Also not done for extension modules, they are loaded with a Python runtime available. Most often uninstalled Python versions are self compiled or from AnaConda. """ return not isStandaloneMode() and not shallMakeModule() and isUninstalledPython()
def shallTreatUninstalledPython(): """*bool* = derived from Python installation and modes Notes: Not done for standalone mode obviously. The Python DLL will be a dependency of the executable and treated that way. Also not done for extension modules, they are loaded with a Python runtime available. Most often uninstalled Python versions are self compiled or from Anaconda. """ if shallMakeModule() or isStandaloneMode(): return False return isUninstalledPython()
def runScons(main_module, quiet): # Scons gets transported many details, that we express as variables, and # have checks for them, leading to many branches and statements, # pylint: disable=too-many-branches,too-many-statements options = { "name" : os.path.basename( getTreeFilenameWithSuffix(main_module, "") ), "result_name" : getResultBasepath(main_module), "source_dir" : getSourceDirectoryPath(main_module), "debug_mode" : _asBoolStr(Options.isDebug()), "python_debug" : _asBoolStr(Options.isPythonDebug()), "unstripped_mode" : _asBoolStr(Options.isUnstripped()), "module_mode" : _asBoolStr(Options.shallMakeModule()), "full_compat" : _asBoolStr(Options.isFullCompat()), "experimental" : ','.join(Options.getExperimentalIndications()), "trace_mode" : _asBoolStr(Options.shallTraceExecution()), "python_version" : python_version_str, "target_arch" : Utils.getArchitecture(), "python_prefix" : sys.prefix, "nuitka_src" : SconsInterface.getSconsDataPath(), "nuitka_cache" : getCacheDir(), "module_count" : "%d" % ( 1 + \ len(ModuleRegistry.getDoneUserModules()) + \ len(ModuleRegistry.getUncompiledNonTechnicalModules()) ) } if not Options.shallMakeModule(): options["result_exe"] = getResultFullpath(main_module) # Ask Scons to cache on Windows, except where the directory is thrown # away. On non-Windows you can should use ccache instead. if not Options.isRemoveBuildDir() and Utils.getOS() == "Windows": options["cache_mode"] = "true" if Options.isLto(): options["lto_mode"] = "true" if Options.shallDisableConsoleWindow(): options["win_disable_console"] = "true" if Options.isStandaloneMode(): options["standalone_mode"] = "true" if not Options.isStandaloneMode() and \ not Options.shallMakeModule() and \ isUninstalledPython(): options["uninstalled_python"] = "true" if ModuleRegistry.getUncompiledTechnicalModules(): options["frozen_modules"] = str( len(ModuleRegistry.getUncompiledTechnicalModules()) ) if Options.isShowScons(): options["show_scons"] = "true" if Options.isMingw64(): options["mingw_mode"] = "true" if Options.getMsvcVersion(): msvc_version = Options.getMsvcVersion() msvc_version = msvc_version.replace("exp", "Exp") if '.' not in msvc_version: msvc_version += ".0" options["msvc_version"] = msvc_version if Options.isClang(): options["clang_mode"] = "true" if Options.getIconPath(): options["icon_path"] = Options.getIconPath() if Options.isProfile(): options["profile_mode"] = "true" if "no_warnings" in getPythonFlags(): options["no_python_warnings"] = "true" if python_version < 300 and sys.flags.py3k_warning: options["python_sysflag_py3k_warning"] = "true" if python_version < 300 and (sys.flags.division_warning or sys.flags.py3k_warning): options["python_sysflag_division_warning"] = "true" if sys.flags.bytes_warning: options["python_sysflag_bytes_warning"] = "true" if int(os.environ.get("NUITKA_SITE_FLAG", "no_site" in Options.getPythonFlags())): options["python_sysflag_no_site"] = "true" if "trace_imports" in Options.getPythonFlags(): options["python_sysflag_verbose"] = "true" if python_version < 300 and sys.flags.unicode: options["python_sysflag_unicode"] = "true" if python_version >= 370 and sys.flags.utf8_mode: options["python_sysflag_utf8"] = "true" abiflags = getPythonABI() if abiflags: options["abiflags"] = abiflags return SconsInterface.runScons(options, quiet), options
def runScons(main_module, quiet): # Scons gets transported many details, that we express as variables, and # have checks for them, leading to many branches, pylint: disable=R0912 python_version_str = "%d.%d" % (sys.version_info[0], sys.version_info[1]) if hasattr(sys, "abiflags"): if Options.isPythonDebug() or \ hasattr(sys, "getobjects"): if sys.abiflags.startswith('d'): python_version_str += sys.abiflags else: python_version_str += 'd' + sys.abiflags else: python_version_str += sys.abiflags def asBoolStr(value): return "true" if value else "false" options = { "name" : Utils.basename( getTreeFilenameWithSuffix(main_module, "") ), "result_name" : getResultBasepath(main_module), "source_dir" : getSourceDirectoryPath(main_module), "debug_mode" : asBoolStr(Options.isDebug()), "python_debug" : asBoolStr(Options.isPythonDebug()), "unstripped_mode" : asBoolStr(Options.isUnstripped()), "module_mode" : asBoolStr(Options.shallMakeModule()), "optimize_mode" : asBoolStr(Options.isOptimize()), "full_compat" : asBoolStr(Options.isFullCompat()), "experimental" : asBoolStr(Options.isExperimental()), "trace_mode" : asBoolStr(Options.shallTraceExecution()), "python_version" : python_version_str, "target_arch" : Utils.getArchitecture(), "python_prefix" : sys.prefix, "nuitka_src" : SconsInterface.getSconsDataPath(), "module_count" : "%d" % ( len(ModuleRegistry.getDoneUserModules()) + 1 ) } # Ask Scons to cache on Windows, except where the directory is thrown # away. On non-Windows you can should use ccache instead. if not Options.isRemoveBuildDir() and Utils.getOS() == "Windows": options["cache_mode"] = "true" if Options.isLto(): options["lto_mode"] = "true" if Options.shallDisableConsoleWindow(): options["win_disable_console"] = "true" if Options.isStandaloneMode(): options["standalone_mode"] = "true" if not Options.isStandaloneMode() and \ not Options.shallMakeModule() and \ isUninstalledPython(): options["uninstalled_python"] = "true" if ModuleRegistry.getUncompiledModules(): options["frozen_modules"] = str( len(ModuleRegistry.getUncompiledModules()) ) if Options.isShowScons(): options["show_scons"] = "true" if Options.isMingw(): options["mingw_mode"] = "true" if Options.getMsvcVersion(): msvc_version = Options.getMsvcVersion() msvc_version = msvc_version.replace("exp", "Exp") if '.' not in msvc_version: msvc_version += ".0" options["msvc_version"] = msvc_version if Options.isClang(): options["clang_mode"] = "true" if Options.getIconPath(): options["icon_path"] = Options.getIconPath() if Options.isProfile(): options["profile_mode"] = "true" return SconsInterface.runScons(options, quiet), options
def runScons(main_module, quiet): # Scons gets transported many details, that we express as variables, and # have checks for them, leading to many branches and statements, # pylint: disable=too-many-branches,too-many-statements options = { "name": os.path.basename(getTreeFilenameWithSuffix(main_module, "")), "result_name": getResultBasepath(main_module), "source_dir": getSourceDirectoryPath(main_module), "debug_mode": _asBoolStr(Options.isDebug()), "python_debug": _asBoolStr(Options.isPythonDebug()), "unstripped_mode": _asBoolStr(Options.isUnstripped()), "module_mode": _asBoolStr(Options.shallMakeModule()), "full_compat": _asBoolStr(Options.isFullCompat()), "experimental": ",".join(Options.getExperimentalIndications()), "trace_mode": _asBoolStr(Options.shallTraceExecution()), "python_version": python_version_str, "target_arch": Utils.getArchitecture(), "python_prefix": sys.prefix, "nuitka_src": SconsInterface.getSconsDataPath(), "nuitka_cache": getCacheDir(), "module_count": "%d" % ( 1 + len(ModuleRegistry.getDoneUserModules()) + len(ModuleRegistry.getUncompiledNonTechnicalModules()) ), } if not Options.shallMakeModule(): options["result_exe"] = getResultFullpath(main_module) # Ask Scons to cache on Windows, except where the directory is thrown # away. On non-Windows you can should use ccache instead. if not Options.isRemoveBuildDir() and Utils.getOS() == "Windows": options["cache_mode"] = "true" if Options.isLto(): options["lto_mode"] = "true" # For AnaConda default to trying static lib python library, which # normally is just not available or if it is even unusable. if "Anaconda" in sys.version: options["static_libpython"] = "true" if Options.shallDisableConsoleWindow(): options["win_disable_console"] = "true" if Options.isStandaloneMode(): options["standalone_mode"] = "true" if ( not Options.isStandaloneMode() and not Options.shallMakeModule() and isUninstalledPython() ): options["uninstalled_python"] = "true" if ModuleRegistry.getUncompiledTechnicalModules(): options["frozen_modules"] = str( len(ModuleRegistry.getUncompiledTechnicalModules()) ) if Options.isShowScons(): options["show_scons"] = "true" if Options.isMingw64(): options["mingw_mode"] = "true" if Options.getMsvcVersion(): msvc_version = Options.getMsvcVersion() msvc_version = msvc_version.replace("exp", "Exp") if "." not in msvc_version: msvc_version += ".0" options["msvc_version"] = msvc_version if Options.isClang(): options["clang_mode"] = "true" if Options.getIconPath(): options["icon_path"] = Options.getIconPath() if Options.isProfile(): options["profile_mode"] = "true" if "no_warnings" in getPythonFlags(): options["no_python_warnings"] = "true" if "no_asserts" in getPythonFlags(): options["python_sysflag_optimize"] = "true" if python_version < 300 and sys.flags.py3k_warning: options["python_sysflag_py3k_warning"] = "true" if python_version < 300 and (sys.flags.division_warning or sys.flags.py3k_warning): options["python_sysflag_division_warning"] = "true" if sys.flags.bytes_warning: options["python_sysflag_bytes_warning"] = "true" if int(os.environ.get("NUITKA_SITE_FLAG", "no_site" in Options.getPythonFlags())): options["python_sysflag_no_site"] = "true" if "trace_imports" in Options.getPythonFlags(): options["python_sysflag_verbose"] = "true" if python_version < 300 and sys.flags.unicode: options["python_sysflag_unicode"] = "true" if python_version >= 370 and sys.flags.utf8_mode: options["python_sysflag_utf8"] = "true" abiflags = getPythonABI() if abiflags: options["abiflags"] = abiflags return SconsInterface.runScons(options, quiet), options