servo: Merge #10618 - Ensure virtualenv activates (from zwn:fix-windows-build); r=larsbergstrom
authorZbynek Winkler <zbynek.winkler@gmail.com>
Sun, 17 Jul 2016 15:58:12 -0700
changeset 339311 e4d6e8f0dbc516b015993510a72dffe06e881c7f
parent 339310 40d7e6f72ce3dd8fe7c8fc94b2d807bfcfd02763
child 339312 dfe1e28673f01967eb9156244a4acce2707fa2cc
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslarsbergstrom
servo: Merge #10618 - Ensure virtualenv activates (from zwn:fix-windows-build); r=larsbergstrom Fixes #10595. For more info see #10595 or the commit message. Source-Repo: https://github.com/servo/servo Source-Revision: e7a55ae55ee0091095b8a460b3088440f352dd2e
servo/python/mach_bootstrap.py
--- a/servo/python/mach_bootstrap.py
+++ b/servo/python/mach_bootstrap.py
@@ -4,17 +4,16 @@
 
 from __future__ import print_function, unicode_literals
 
 import os
 import platform
 import subprocess
 import sys
 from distutils.spawn import find_executable
-from pipes import quote
 
 SEARCH_PATHS = [
     os.path.join("python", "tidy"),
     os.path.join("tests", "wpt"),
     os.path.join("tests", "wpt", "harness"),
 ]
 
 # Individual files providing mach commands.
@@ -116,17 +115,21 @@ def _activate_virtualenv(topdir):
             [virtualenv, "-p", python, virtualenv_path],
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE)
         process.wait()
         if process.returncode:
             sys.exit("Python virtualenv failed to execute properly: {}"
                      .format(process.communicate()[1]))
 
-    execfile(activate_path, dict(__file__=quote(activate_path)))
+    execfile(activate_path, dict(__file__=activate_path))
+
+    python = find_executable("python")
+    if python is None or not python.startswith(virtualenv_path):
+        sys.exit("Python virtualenv failed to activate.")
 
     # TODO: Right now, we iteratively install all the requirements by invoking
     # `pip install` each time. If it were the case that there were conflicting
     # requirements, we wouldn't know about them. Once
     # https://github.com/pypa/pip/issues/988 is addressed, then we can just
     # chain each of the requirements files into the same `pip install` call
     # and it will check for conflicts.
     requirements_paths = [