From 5b845cbf79a66353876ba82de769337b17f3faec Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Tue, 6 Oct 2015 12:09:50 -0400 Subject: [PATCH] win32: force PATH to be non-unicode on win32, if virtualenv munges it --- python/servo/command_base.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 83d3a77c0dd4..650db517d483 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -224,6 +224,14 @@ def get_binary_path(self, release, dev, android=False): 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"] \