def buildSconsCommand(quiet, options): scons_command = getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", Utils.joinpath(getSconsDataPath(), "SingleExe.scons"), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Option values to provide to scons. Find these in the caller. for key, value in options.items(): scons_command += [key + '=' + value] return scons_command
def runScons( options, quiet ): # For the scons file to find the static C++ files and include path. The scons file is # unable to use __file__ for the task. os.environ[ "NUITKA_SCONS" ] = getSconsDataPath() if os.name == "nt": # On Windows this Scons variable must be set by us. os.environ[ "SCONS_LIB_DIR" ] = Utils.joinpath( getSconsInlinePath(), "lib", "scons-2.0.1" ) # Also, for MinGW we can avoid the user having to add the path if he used the # default path or installed it on the same drive by appending to the PATH variable # before executing scons. os.environ[ "PATH" ] += r";\MinGW\bin;C:\MinGW\bin" scons_command = """%(python)s %(binary)s %(quiet)s -f %(scons_file)s --jobs %(job_limit)d %(options)s""" % { "python" : sys.executable if Utils.python_version < 300 else "python", "binary" : getSconsBinaryPath(), "quiet" : "--quiet" if quiet else "", "scons_file" : Utils.joinpath( getSconsDataPath(), "SingleExe.scons" ), "job_limit" : Options.getJobLimit(), "options" : " ".join( "%s=%s" % ( key, value ) for key, value in options.items() ) } if Options.isShowScons(): Tracing.printLine( "Scons command:", scons_command ) return 0 == os.system( scons_command )
def _buildSconsCommand(quiet, options): """ Build the scons command to run. The options are a dictionary to be passed to scons as a command line, and other scons stuff is set. """ scons_command = _getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", os.path.join( getSconsDataPath(), "SingleExe.scons" ), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Python2, encoding unicode values def encode(value): if str is bytes and type(value) is unicode: return value.encode("utf8") else: return value # Option values to provide to scons. Find these in the caller. for key, value in options.items(): scons_command.append( key + '=' + encode(value) ) # Python2, make argument encoding recognizable. if str is bytes: scons_command.append( "arg_encoding=utf8" ) return scons_command
def runScons(options, quiet): # For the scons file to find the static C++ files and include path. The # scons file is unable to use __file__ for the task. os.environ["NUITKA_SCONS"] = getSconsDataPath() if Utils.getOS() == "Windows": # On Windows this Scons variable must be set by us. os.environ["SCONS_LIB_DIR"] = Utils.joinpath( getSconsInlinePath(), "lib", "scons-2.3.0" ) # Also, for MinGW we can avoid the user having to add the path if he # used the default path or installed it on the same drive by appending # to the PATH variable before executing scons. os.environ["PATH"] += r";\MinGW\bin;C:\MinGW\bin" scons_command = getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", Utils.joinpath(getSconsDataPath(), "SingleExe.scons"), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecations of Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Option values to provide to scons. for key, value in options.items(): scons_command += [key + "=" + value] if Options.isShowScons(): Tracing.printLine("Scons command:", " ".join(scons_command)) return 0 == subprocess.call(scons_command)
def _buildSconsCommand(quiet, options, scons_filename): """Build the scons command to run. The options are a dictionary to be passed to scons as a command line, and other scons stuff is set. """ scons_command = _getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", getExternalUsePath(os.path.join(getSconsDataPath(), scons_filename)), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=stacktrace") # Python2, encoding unicode values def encode(value): if str is bytes and type(value) is unicode: return value.encode("utf8") else: return value # Option values to provide to scons. Find these in the caller. for key, value in options.items(): if value is None: Tracing.scons_logger.sysexit( "Error, failure to provide argument for '%s', please report bug." % key) scons_command.append(key + "=" + encode(value)) # Python2, make argument encoding recognizable. if str is bytes: scons_command.append("arg_encoding=utf8") return scons_command
def runScons(options, quiet): # For the scons file to find the static C++ files and include path. The scons file is # unable to use __file__ for the task. os.environ["NUITKA_SCONS"] = getSconsDataPath() if os.name == "nt": # On Windows this Scons variable must be set by us. os.environ["SCONS_LIB_DIR"] = Utils.joinpath(getSconsInlinePath(), "lib", "scons-2.0.1") # Also, for MinGW we can avoid the user having to add the path if he used the # default path or installed it on the same drive by appending to the PATH variable # before executing scons. os.environ["PATH"] += r";\MinGW\bin;C:\MinGW\bin" # Scons is Python2 only, so we need to make the system find a suitable Python binary. if Utils.python_version < 300: python_exe = sys.executable elif os.name == "nt": if os.path.exists(r"c:\Python27\python.exe"): python_exe = r"c:\Python27\python.exe" elif os.path.exists(r"c:\Python26\python.exe"): python_exe = r"c:\Python26\python.exe" else: sys.exit( """Error, need to find Python2 executable under C:\\Python26 or \ C:\\Python27 to execute scons which is not Python3 compatible.""") else: python_exe = "python" scons_command = """%(python)s %(binary)s %(quiet)s --warn=no-deprecated -f %(scons_file)s --jobs %(job_limit)d %(options)s""" % { "python": python_exe, "binary": getSconsBinaryPath(), "quiet": "--quiet" if quiet else "", "scons_file": Utils.joinpath(getSconsDataPath(), "SingleExe.scons"), "job_limit": Options.getJobLimit(), "options": " ".join("%s=%s" % (key, value) for key, value in options.items()) } if Options.isShowScons(): Tracing.printLine("Scons command:", scons_command) return 0 == os.system(scons_command)
def runScons(options, quiet): # For the scons file to find the static C++ files and include path. The # scons file is unable to use __file__ for the task. os.environ["NUITKA_SCONS"] = getSconsDataPath() if Utils.getOS() == "Windows": # On Windows this Scons variable must be set by us. os.environ["SCONS_LIB_DIR"] = Utils.joinpath( getSconsInlinePath(), "lib", "scons-2.3.2" ) scons_command = getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", Utils.joinpath(getSconsDataPath(), "SingleExe.scons"), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecations of Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Option values to provide to scons. for key, value in options.items(): scons_command += [key + "=" + value] if Options.isShowScons(): Tracing.printLine("Scons command:", " ".join(scons_command)) return 0 == subprocess.call(scons_command, shell = False)
def _buildSconsCommand(quiet, options): """ Build the scons command to run. The options are a dictionary to be passed to scons as a command line, and other scons stuff is set. """ scons_command = _getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", os.path.join(getSconsDataPath(), "SingleExe.scons"), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Python2, encoding unicode values def encode(value): if str is bytes and type(value) is unicode: return value.encode("utf8") else: return value # Option values to provide to scons. Find these in the caller. for key, value in options.items(): scons_command.append(key + "=" + encode(value)) # Python2, make argument encoding recognizable. if str is bytes: scons_command.append("arg_encoding=utf8") return scons_command
def runScons( options, quiet ): # For the scons file to find the static C++ files and include path. The scons file is # unable to use __file__ for the task. os.environ[ "NUITKA_SCONS" ] = getSconsDataPath() if os.name == "nt": # On Windows this Scons variable must be set by us. os.environ[ "SCONS_LIB_DIR" ] = Utils.joinpath( getSconsInlinePath(), "lib", "scons-2.0.1" ) # Also, for MinGW we can avoid the user having to add the path if he used the # default path or installed it on the same drive by appending to the PATH variable # before executing scons. os.environ[ "PATH" ] += r";\MinGW\bin;C:\MinGW\bin" # Scons is Python2 only, so we need to make the system find a suitable Python binary. if Utils.python_version < 300: python_exe = sys.executable elif os.name == "nt": if os.path.exists( r"c:\Python27\python.exe" ): python_exe = r"c:\Python27\python.exe" elif os.path.exists( r"c:\Python26\python.exe" ): python_exe = r"c:\Python26\python.exe" else: sys.exit( """Error, need to find Python2 executable under C:\\Python26 or \ C:\\Python27 to execute scons which is not Python3 compatible.""" ) else: python_exe = "python" scons_command = """%(python)s %(binary)s %(quiet)s --warn=no-deprecated -f %(scons_file)s --jobs %(job_limit)d %(options)s""" % { "python" : python_exe, "binary" : getSconsBinaryPath(), "quiet" : "--quiet" if quiet else "", "scons_file" : Utils.joinpath( getSconsDataPath(), "SingleExe.scons" ), "job_limit" : Options.getJobLimit(), "options" : " ".join( "%s=%s" % ( key, value ) for key, value in options.items() ) } if Options.isShowScons(): Tracing.printLine( "Scons command:", scons_command ) return 0 == os.system( scons_command )
def _buildSconsCommand(quiet, options): """ Build the scons command to run. The options are a dictionary to be passed to scons as a command line, and other scons stuff is set. """ scons_command = _getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", os.path.join( getSconsDataPath(), "SingleExe.scons" ), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Option values to provide to scons. Find these in the caller. for key, value in options.items(): scons_command += [key + '=' + value] return scons_command
def runScons(options, quiet): # For the scons file to find the static C++ files and include path. The # scons file is unable to use __file__ for the task. os.environ["NUITKA_SCONS"] = getSconsDataPath() if Utils.getOS() == "Windows": # On Windows this Scons variable must be set by us. os.environ["SCONS_LIB_DIR"] = Utils.joinpath( getSconsInlinePath(), "lib", "scons-2.3.2" ) scons_command = getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", Utils.joinpath(getSconsDataPath(), "SingleExe.scons"), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Option values to provide to scons. Find these in the caller. for key, value in options.items(): scons_command += [key + '=' + value] if Options.isShowScons(): Tracing.printLine("Scons command:", ' '.join(scons_command)) # Remove environment variables that can only harm if we have to switch # major Python versions, these cannot help Python2 to execute scons, this # is a bit of noise, but helpful, pylint: disable=R0912 if Utils.python_version >= 300: if "PYTHONPATH" in os.environ: old_pythonpath = os.environ["PYTHONPATH"] del os.environ["PYTHONPATH"] else: old_pythonpath = None if "PYTHONHOME" in os.environ: old_pythonhome = os.environ["PYTHONHOME"] del os.environ["PYTHONHOME"] else: old_pythonhome = None result = 0 == subprocess.call(scons_command, shell = False) if Utils.python_version >= 300: if old_pythonpath is not None: os.environ["PYTHONPATH"] = old_pythonpath if old_pythonhome is not None: os.environ["PYTHONHOME"] = old_pythonhome return result
def runScons(options, quiet): # For the scons file to find the static C++ files and include path. The # scons file is unable to use __file__ for the task. os.environ["NUITKA_SCONS"] = getSconsDataPath() if Utils.getOS() == "Windows": # On Windows this Scons variable must be set by us. os.environ["SCONS_LIB_DIR"] = Utils.joinpath(getSconsInlinePath(), "lib", "scons-2.3.2") scons_command = getSconsBinaryCall() if quiet: scons_command.append("--quiet") scons_command += [ # The scons file "-f", Utils.joinpath(getSconsDataPath(), "SingleExe.scons"), # Parallel compilation. "--jobs", str(Options.getJobLimit()), # Do not warn about deprecation from Scons "--warn=no-deprecated", # Don't load "site_scons" at all. "--no-site-dir", ] if Options.isShowScons(): scons_command.append("--debug=explain") # Option values to provide to scons. Find these in the caller. for key, value in options.items(): scons_command += [key + '=' + value] if Options.isShowScons(): Tracing.printLine("Scons command:", ' '.join(scons_command)) # Remove environment variables that can only harm if we have to switch # major Python versions, these cannot help Python2 to execute scons, this # is a bit of noise, but helpful, pylint: disable=R0912 if Utils.python_version >= 300: if "PYTHONPATH" in os.environ: old_pythonpath = os.environ["PYTHONPATH"] del os.environ["PYTHONPATH"] else: old_pythonpath = None if "PYTHONHOME" in os.environ: old_pythonhome = os.environ["PYTHONHOME"] del os.environ["PYTHONHOME"] else: old_pythonhome = None result = 0 == subprocess.call(scons_command, shell=False) if Utils.python_version >= 300: if old_pythonpath is not None: os.environ["PYTHONPATH"] = old_pythonpath if old_pythonhome is not None: os.environ["PYTHONHOME"] = old_pythonhome return result