def _execute_c_compiler(self, cc, args, outname, cwd=None): # 'cc' can also contain some options for the C compiler; # e.g. it can be "gcc -m32". We handle it by splitting on ' '. cclist = cc.split() cc = cclist[0] args = cclist[1:] + args returncode, stdout, stderr = _run_subprocess(cc, args, self.c_environ, cwd) self._handle_error(returncode, stdout, stderr, outname)
def execute(self, executable, args=None, env=None, compilation_info=None): """ Execute a given executable with given args and env. Returns an instance of ExecutionResult """ if env is None: env = os.environ.copy() else: env = env.copy() # On Windows, %SystemRoot% must be present for most programs to start if (os.name == 'nt' and "SystemRoot" not in env and "SystemRoot" in os.environ): env["SystemRoot"] = os.environ["SystemRoot"] # Set LD_LIBRARY_PATH on posix platforms if os.name == 'posix' and compilation_info is not None: env['LD_LIBRARY_PATH'] = ':'.join( [str(i) for i in compilation_info.library_dirs]) returncode, stdout, stderr = _run_subprocess(str(executable), args, env) return ExecutionResult(returncode, stdout, stderr)