mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Remove Gecko-specific Python bootstrap logic (#30041)
Servo is no longer completely vendored into Gecko. Instead parts of Gecko are vendored into Servo. This change removes Python mach bootstrap code that was written to accommodate the previous situation. It's no longer necessary.
This commit is contained in:
parent
25e2a6dfa1
commit
4127ffa3fc
1 changed files with 11 additions and 41 deletions
|
@ -13,6 +13,12 @@ from distutils.spawn import find_executable
|
|||
from subprocess import Popen
|
||||
from tempfile import TemporaryFile
|
||||
|
||||
SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
|
||||
TOP_DIR = os.path.abspath(os.path.join(SCRIPT_PATH, ".."))
|
||||
WPT_PATH = os.path.join(TOP_DIR, "tests", "wpt")
|
||||
WPT_RUNNER_PATH = os.path.join(WPT_PATH, "tests", "tools", "wptrunner")
|
||||
WPT_SERVE_PATH = os.path.join(WPT_PATH, "tests", "tools", "wptserve")
|
||||
|
||||
SEARCH_PATHS = [
|
||||
os.path.join("python", "mach"),
|
||||
]
|
||||
|
@ -125,30 +131,7 @@ def _process_exec(args):
|
|||
sys.exit(1)
|
||||
|
||||
|
||||
def wpt_path(is_firefox, topdir, *paths):
|
||||
if is_firefox:
|
||||
rel = os.path.join("..", "testing", "web-platform")
|
||||
else:
|
||||
rel = os.path.join("tests", "wpt")
|
||||
|
||||
return os.path.join(topdir, rel, *paths)
|
||||
|
||||
|
||||
def wptrunner_path(is_firefox, topdir, *paths):
|
||||
wpt_root = wpt_path(is_firefox, topdir)
|
||||
rel = os.path.join(wpt_root, "tests", "tools", "wptrunner")
|
||||
|
||||
return os.path.join(topdir, rel, *paths)
|
||||
|
||||
|
||||
def wptserve_path(is_firefox, topdir, *paths):
|
||||
wpt_root = wpt_path(is_firefox, topdir)
|
||||
rel = os.path.join(wpt_root, "tests", "tools", "wptserve")
|
||||
|
||||
return os.path.join(topdir, rel, *paths)
|
||||
|
||||
|
||||
def _activate_virtualenv(topdir, is_firefox):
|
||||
def _activate_virtualenv(topdir):
|
||||
virtualenv_path = os.path.join(topdir, "python", "_virtualenv%d.%d" % (sys.version_info[0], sys.version_info[1]))
|
||||
python = sys.executable # If there was no python, mach wouldn't have run at all!
|
||||
if not python:
|
||||
|
@ -184,8 +167,7 @@ def _activate_virtualenv(topdir, is_firefox):
|
|||
# and it will check for conflicts.
|
||||
requirements_paths = [
|
||||
os.path.join("python", "requirements.txt"),
|
||||
wptrunner_path(is_firefox, topdir, "requirements.txt",),
|
||||
wptrunner_path(is_firefox, topdir, "requirements_firefox.txt"),
|
||||
os.path.join(WPT_RUNNER_PATH, "requirements.txt",),
|
||||
]
|
||||
|
||||
if need_pip_upgrade:
|
||||
|
@ -222,17 +204,10 @@ def _is_windows():
|
|||
return sys.platform == 'win32'
|
||||
|
||||
|
||||
def is_firefox_checkout(topdir):
|
||||
parentdir = os.path.normpath(os.path.join(topdir, '..'))
|
||||
is_firefox = os.path.isfile(os.path.join(parentdir,
|
||||
'build/mach_bootstrap.py'))
|
||||
return is_firefox
|
||||
|
||||
|
||||
def bootstrap_command_only(topdir):
|
||||
# we should activate the venv before importing servo.boostrap
|
||||
# because the module requires non-standard python packages
|
||||
_activate_virtualenv(topdir, is_firefox_checkout(topdir))
|
||||
_activate_virtualenv(topdir)
|
||||
|
||||
# We cannot import these modules until the virtual environment
|
||||
# is active because they depend on modules installed via the
|
||||
|
@ -269,9 +244,7 @@ def bootstrap(topdir):
|
|||
print('You are running Python', platform.python_version())
|
||||
sys.exit(1)
|
||||
|
||||
is_firefox = is_firefox_checkout(topdir)
|
||||
|
||||
_activate_virtualenv(topdir, is_firefox)
|
||||
_activate_virtualenv(topdir)
|
||||
|
||||
def populate_context(context, key=None):
|
||||
if key is None:
|
||||
|
@ -281,10 +254,7 @@ def bootstrap(topdir):
|
|||
raise AttributeError(key)
|
||||
|
||||
sys.path[0:0] = [os.path.join(topdir, path) for path in SEARCH_PATHS]
|
||||
|
||||
sys.path[0:0] = [wpt_path(is_firefox, topdir),
|
||||
wptrunner_path(is_firefox, topdir),
|
||||
wptserve_path(is_firefox, topdir)]
|
||||
sys.path[0:0] = [WPT_PATH, WPT_RUNNER_PATH, WPT_SERVE_PATH]
|
||||
|
||||
import mach.main
|
||||
mach = mach.main.Mach(os.getcwd())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue