aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorVladimir Vukicevic <vladimir@pobox.com>2015-10-06 12:09:50 -0400
committerLars Bergstrom <lars@lars.com>2016-01-20 08:38:26 -0600
commit5b845cbf79a66353876ba82de769337b17f3faec (patch)
treee7d9bdd444d44bb8b18cd317e07ca91ad803b142 /python
parentee863fde5993f0f7bae2acf06e1fae21bd459c88 (diff)
downloadservo-5b845cbf79a66353876ba82de769337b17f3faec.tar.gz
servo-5b845cbf79a66353876ba82de769337b17f3faec.zip
win32: force PATH to be non-unicode on win32, if virtualenv munges it
Diffstat (limited to 'python')
-rw-r--r--python/servo/command_base.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/python/servo/command_base.py b/python/servo/command_base.py
index 83d3a77c0dd..650db517d48 100644
--- a/python/servo/command_base.py
+++ b/python/servo/command_base.py
@@ -224,6 +224,14 @@ class CommandBase(object):
def build_env(self, gonk=False, hosts_file_path=None):
"""Return an extended environment dictionary."""
env = os.environ.copy()
+ if sys.platform == "win32" and type(env['PATH']) == unicode:
+ # On win32, the virtualenv's activate_this.py script sometimes ends up
+ # turning os.environ['PATH'] into a unicode string. This doesn't work
+ # for passing env vars in to a process, so we force it back to ascii.
+ # We don't use UTF8 since that won't be correct anyway; if you actually
+ # have unicode stuff in your path, all this PATH munging would have broken
+ # it in any case.
+ env['PATH'] = env['PATH'].encode('ascii', 'ignore')
extra_path = []
extra_lib = []
if not self.config["tools"]["system-rust"] \