aboutsummaryrefslogtreecommitdiffstats
path: root/utils.py
diff options
context:
space:
mode:
authorRoman Lacko <backup.rlacko@gmail.com>2013-04-25 15:16:22 +0200
committerRoman Lacko <backup.rlacko@gmail.com>2013-04-25 15:16:22 +0200
commitf8ecd2380ff3d58429e9c99daacd7d913b14d7aa (patch)
tree14f33b133ced5eab301b5015863d09cda0ecfe82 /utils.py
parent465311e322830c8621f3b47e5635b2e490e82fad (diff)
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.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py11
1 files changed, 9 insertions, 2 deletions
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