diff options
author | Martin Robinson <mrobinson@igalia.com> | 2023-07-28 15:34:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-28 13:34:23 +0000 |
commit | 4127ffa3fc37d7e7cf9f368b09196a2c695278a5 (patch) | |
tree | 713f61e32c5aa077b4065ffa7a6382e092fdc0df | |
parent | 25e2a6dfa151ae21868dff0bf7d53f5a5ff73df6 (diff) | |
download | servo-4127ffa3fc37d7e7cf9f368b09196a2c695278a5.tar.gz servo-4127ffa3fc37d7e7cf9f368b09196a2c695278a5.zip |
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.
-rw-r--r-- | python/mach_bootstrap.py | 52 |
1 files changed, 11 insertions, 41 deletions
diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py index 557846f4896..56aa0143243 100644 --- a/python/mach_bootstrap.py +++ b/python/mach_bootstrap.py @@ -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()) |