From f8ecd2380ff3d58429e9c99daacd7d913b14d7aa Mon Sep 17 00:00:00 2001 From: Roman Lacko Date: Thu, 25 Apr 2013 15:16:22 +0200 Subject: Support for building windows binaries outside Visual Studio Command Prompt using the --msvc-version option. The MSVC environment is now properly initialized by setup script. --- utils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'utils.py') diff --git a/utils.py b/utils.py index 669314add..1a9f20bb8 100644 --- a/utils.py +++ b/utils.py @@ -175,7 +175,7 @@ def rmtree(dirname): shutil.rmtree(dirname, ignore_errors=False, onerror=handleRemoveReadonly) -def run_process(args, logger=None): +def run_process(args, logger=None, initial_env=None): def log(buffer, checkNewLine=False): endsWithNewLine = False if buffer.endswith('\n'): @@ -207,13 +207,16 @@ def run_process(args, logger=None): if sys.platform == "win32": shell = True + if initial_env is None: + initial_env = os.environ + proc = popenasync.Popen(args, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, universal_newlines = 1, shell = shell, - env = os.environ) + env = initial_env) log_buffer = None; while proc.poll() is None: @@ -263,6 +266,10 @@ def get_environment_from_batch_command(env_cmd, initial=None): proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, env=initial) # parse the output sent to stdout lines = proc.stdout + if sys.version_info[0] > 2: + # make sure the lines are strings + make_str = lambda s: s.decode() + lines = map(make_str, lines) # consume whatever output occurs until the tag is reached consume(itertools.takewhile(lambda l: tag not in l, lines)) # define a way to handle each KEY=VALUE line -- cgit v1.2.3