mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Revert "Revert "Auto merge of #7103 - frewsxcv:python-venv, r=metajack" for breaking web-platform-tests."
This reverts commit 47d6d958f5
.
This commit is contained in:
parent
759c52d7eb
commit
e38df50bbf
51 changed files with 51 additions and 5815 deletions
|
@ -6,7 +6,9 @@ from __future__ import print_function, unicode_literals
|
|||
|
||||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
import sys
|
||||
from distutils.spawn import find_executable
|
||||
|
||||
SEARCH_PATHS = [
|
||||
"python/mach",
|
||||
|
@ -73,6 +75,39 @@ CATEGORIES = {
|
|||
}
|
||||
|
||||
|
||||
def _get_exec(name, default=None):
|
||||
path = find_executable(name)
|
||||
if not path:
|
||||
return default
|
||||
return path
|
||||
|
||||
|
||||
def _activate_virtualenv(topdir):
|
||||
virtualenv_path = os.path.join(topdir, "python", "_virtualenv")
|
||||
python = _get_exec("python2", "python")
|
||||
|
||||
if not os.path.exists(virtualenv_path):
|
||||
virtualenv = _get_exec("virtualenv2", "virtualenv")
|
||||
subprocess.check_call([virtualenv, "-p", python, virtualenv_path])
|
||||
|
||||
activate_path = os.path.join(virtualenv_path, "bin", "activate_this.py")
|
||||
execfile(activate_path, dict(__file__=activate_path))
|
||||
|
||||
# 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 = [
|
||||
os.path.join(topdir, "python", "requirements.txt"),
|
||||
os.path.join(topdir, "tests", "wpt", "harness", "requirements.txt"),
|
||||
os.path.join(topdir, "tests", "wpt", "harness", "requirements_servo.txt"),
|
||||
]
|
||||
for path in requirements_paths:
|
||||
subprocess.check_call(["pip", "install", "-q", "-r", path])
|
||||
|
||||
|
||||
def bootstrap(topdir):
|
||||
topdir = os.path.abspath(topdir)
|
||||
|
||||
|
@ -84,6 +119,8 @@ def bootstrap(topdir):
|
|||
print('You are running Python', platform.python_version())
|
||||
sys.exit(1)
|
||||
|
||||
_activate_virtualenv(topdir)
|
||||
|
||||
def populate_context(context, key=None):
|
||||
if key is None:
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue