diff --git a/build/mach_initialize.py b/build/mach_initialize.py index d22bdd356955..e28068800966 100644 --- a/build/mach_initialize.py +++ b/build/mach_initialize.py @@ -119,7 +119,7 @@ def _maybe_activate_mozillabuild_environment(): os.environ["PATH"] += f"{os.pathsep}{new_path}" -def initialize(topsrcdir, args=()): +def initialize(topsrcdir): # This directory was deleted in bug 1666345, but there may be some ignored # files here. We can safely just delete it for the user so they don't have # to clean the repo themselves. @@ -139,7 +139,7 @@ def initialize(topsrcdir, args=()): ) ] - from mach.util import get_state_dir, get_virtualenv_base_dir, setenv + from mach.util import get_state_dir, setenv state_dir = _create_state_dir() @@ -155,269 +155,216 @@ def initialize(topsrcdir, args=()): # Centralized registry of available mach commands MACH_COMMANDS = { - "addtest": MachCommandReference("testing/mach_commands.py"), - "addwidget": MachCommandReference("toolkit/content/widgets/mach_commands.py"), - "android": MachCommandReference("mobile/android/mach_commands.py"), - "android-emulator": MachCommandReference("mobile/android/mach_commands.py"), - "artifact": MachCommandReference( - "python/mozbuild/mozbuild/artifact_commands.py", "build" - ), - "awsy-test": MachCommandReference("testing/awsy/mach_commands.py"), - "bootstrap": MachCommandReference( - "python/mozboot/mozboot/mach_commands.py", "build" - ), - "browsertime": MachCommandReference("tools/browsertime/mach_commands.py"), - "build": MachCommandReference( - "python/mozbuild/mozbuild/build_commands.py", - "build", - ), - "build-backend": MachCommandReference( - "python/mozbuild/mozbuild/build_commands.py", - "build", - ), - "buildsymbols": MachCommandReference( - "python/mozbuild/mozbuild/mach_commands.py" - ), - "busted": MachCommandReference("tools/mach_commands.py"), - "cargo": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "clang-format": MachCommandReference( - "python/mozbuild/mozbuild/code_analysis/mach_commands.py" - ), - "clang-tidy": MachCommandReference( - "python/mozbuild/mozbuild/code_analysis/mach_commands.py" - ), - "clobber": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "compare-locales": MachCommandReference( - "tools/compare-locales/mach_commands.py" - ), - "compileflags": MachCommandReference( - "python/mozbuild/mozbuild/compilation/codecomplete.py" - ), - "configure": MachCommandReference("python/mozbuild/mozbuild/build_commands.py"), - "cppunittest": MachCommandReference("testing/mach_commands.py"), - "cramtest": MachCommandReference("testing/mach_commands.py"), - "crashtest": MachCommandReference("layout/tools/reftest/mach_commands.py"), - "data-review": MachCommandReference( - "toolkit/components/glean/build_scripts/mach_commands.py" - ), + "valgrind-test": MachCommandReference("build/valgrind/mach_commands.py"), "devtools-css-db": MachCommandReference( "devtools/shared/css/generated/mach_commands.py" ), - "doc": MachCommandReference("tools/moztreedocs/mach_commands.py", "docs"), - "doctor": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "environment": MachCommandReference( - "python/mozbuild/mozbuild/mach_commands.py" - ), - "eslint": MachCommandReference("tools/lint/mach_commands.py"), - "esmify": MachCommandReference("tools/esmify/mach_commands.py"), - "fetch-condprofile": MachCommandReference( - "testing/condprofile/mach_commands.py" - ), - "file-info": MachCommandReference( - "python/mozbuild/mozbuild/frontend/mach_commands.py" - ), - "firefox-ui-functional": MachCommandReference( - "testing/firefox-ui/mach_commands.py" - ), - "fluent-migration-test": MachCommandReference("testing/mach_commands.py"), - "format": MachCommandReference("tools/lint/mach_commands.py"), - "geckodriver": MachCommandReference("testing/geckodriver/mach_commands.py"), - "geckoview-junit": MachCommandReference("testing/mochitest/mach_commands.py"), - "generate-test-certs": MachCommandReference( - "security/manager/tools/mach_commands.py" - ), - "gradle": MachCommandReference("mobile/android/mach_commands.py"), - "gradle-install": MachCommandReference("mobile/android/mach_commands.py"), - "gtest": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "webidl-example": MachCommandReference("dom/bindings/mach_commands.py"), + "webidl-parser-test": MachCommandReference("dom/bindings/mach_commands.py"), "hazards": MachCommandReference( "js/src/devtools/rootAnalysis/mach_commands.py" ), - "ide": MachCommandReference( - "python/mozbuild/mozbuild/backend/mach_commands.py", "build" - ), - "import-pr": MachCommandReference("tools/vcs/mach_commands.py"), - "install": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "install-moz-phab": MachCommandReference("tools/phabricator/mach_commands.py"), - "jit-test": MachCommandReference("testing/mach_commands.py"), - "jsapi-tests": MachCommandReference("testing/mach_commands.py"), - "jsshell-bench": MachCommandReference("testing/mach_commands.py"), + "reftest": MachCommandReference("layout/tools/reftest/mach_commands.py"), "jstestbrowser": MachCommandReference("layout/tools/reftest/mach_commands.py"), - "jstests": MachCommandReference("testing/mach_commands.py"), - "l10n-cross-channel": MachCommandReference( - "tools/compare-locales/mach_commands.py" - ), - "lint": MachCommandReference("tools/lint/mach_commands.py", "lint"), - "logspam": MachCommandReference("tools/mach_commands.py"), + "crashtest": MachCommandReference("layout/tools/reftest/mach_commands.py"), + "android": MachCommandReference("mobile/android/mach_commands.py"), + "gradle": MachCommandReference("mobile/android/mach_commands.py"), + "gradle-install": MachCommandReference("mobile/android/mach_commands.py"), "mach-commands": MachCommandReference( "python/mach/mach/commands/commandinfo.py" ), - "mach-completion": MachCommandReference( - "python/mach/mach/commands/commandinfo.py" - ), "mach-debug-commands": MachCommandReference( "python/mach/mach/commands/commandinfo.py" ), - "marionette-test": MachCommandReference("testing/marionette/mach_commands.py"), - "mochitest": MachCommandReference("testing/mochitest/mach_commands.py"), - "mots": MachCommandReference("tools/mach_commands.py"), - "mozbuild-reference": MachCommandReference( - "python/mozbuild/mozbuild/frontend/mach_commands.py", "docs" + "mach-completion": MachCommandReference( + "python/mach/mach/commands/commandinfo.py" ), - "mozharness": MachCommandReference("testing/mozharness/mach_commands.py"), - "mozregression": MachCommandReference("tools/mach_commands.py"), - "node": MachCommandReference("tools/mach_commands.py"), - "npm": MachCommandReference("tools/mach_commands.py"), - "package": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "package-multi-locale": MachCommandReference( + "settings": MachCommandReference("python/mach/mach/commands/settings.py"), + "python": MachCommandReference("python/mach_commands.py"), + "python-test": MachCommandReference("python/mach_commands.py"), + "bootstrap": MachCommandReference("python/mozboot/mozboot/mach_commands.py"), + "vcs-setup": MachCommandReference("python/mozboot/mozboot/mach_commands.py"), + "artifact": MachCommandReference( + "python/mozbuild/mozbuild/artifact_commands.py" + ), + "ide": MachCommandReference( + "python/mozbuild/mozbuild/backend/mach_commands.py" + ), + "build": MachCommandReference("python/mozbuild/mozbuild/build_commands.py"), + "configure": MachCommandReference("python/mozbuild/mozbuild/build_commands.py"), + "resource-usage": MachCommandReference( + "python/mozbuild/mozbuild/build_commands.py" + ), + "build-backend": MachCommandReference( + "python/mozbuild/mozbuild/build_commands.py" + ), + "clang-tidy": MachCommandReference( + "python/mozbuild/mozbuild/code_analysis/mach_commands.py" + ), + "static-analysis": MachCommandReference( + "python/mozbuild/mozbuild/code_analysis/mach_commands.py" + ), + "prettier-format": MachCommandReference( + "python/mozbuild/mozbuild/code_analysis/mach_commands.py" + ), + "clang-format": MachCommandReference( + "python/mozbuild/mozbuild/code_analysis/mach_commands.py" + ), + "compileflags": MachCommandReference( + "python/mozbuild/mozbuild/compilation/codecomplete.py" + ), + "mozbuild-reference": MachCommandReference( + "python/mozbuild/mozbuild/frontend/mach_commands.py" + ), + "file-info": MachCommandReference( + "python/mozbuild/mozbuild/frontend/mach_commands.py" + ), + "vendor": MachCommandReference( + "python/mozbuild/mozbuild/vendor/mach_commands.py" + ), + "watch": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "cargo": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "doctor": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "clobber": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "show-log": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "warnings-summary": MachCommandReference( "python/mozbuild/mozbuild/mach_commands.py" ), - "pastebin": MachCommandReference("tools/mach_commands.py"), - "perf-data-review": MachCommandReference( - "toolkit/components/glean/build_scripts/mach_commands.py" + "warnings-list": MachCommandReference( + "python/mozbuild/mozbuild/mach_commands.py" + ), + "gtest": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "package": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "install": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "run": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "buildsymbols": MachCommandReference( + "python/mozbuild/mozbuild/mach_commands.py" + ), + "environment": MachCommandReference( + "python/mozbuild/mozbuild/mach_commands.py" + ), + "repackage": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), + "package-multi-locale": MachCommandReference( + "python/mozbuild/mozbuild/mach_commands.py" ), "perftest": MachCommandReference( "python/mozperftest/mozperftest/mach_commands.py" ), "perftest-test": MachCommandReference( - "python/mozperftest/mozperftest/mach_commands.py", "perftest-test" - ), - "perftest-tools": MachCommandReference( "python/mozperftest/mozperftest/mach_commands.py" ), - "power": MachCommandReference("tools/power/mach_commands.py"), - "prettier-format": MachCommandReference( - "python/mozbuild/mozbuild/code_analysis/mach_commands.py" - ), - "puppeteer-test": MachCommandReference("remote/mach_commands.py"), - "python": MachCommandReference("python/mach_commands.py"), - "python-test": MachCommandReference("python/mach_commands.py", "python-test"), - "raptor": MachCommandReference("testing/raptor/mach_commands.py"), - "raptor-test": MachCommandReference("testing/raptor/mach_commands.py"), - "reftest": MachCommandReference("layout/tools/reftest/mach_commands.py"), "release": MachCommandReference( "python/mozrelease/mozrelease/mach_commands.py" ), - "release-history": MachCommandReference("taskcluster/mach_commands.py"), "remote": MachCommandReference("remote/mach_commands.py"), - "repackage": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "resource-usage": MachCommandReference( - "python/mozbuild/mozbuild/build_commands.py", "build" + "puppeteer-test": MachCommandReference("remote/mach_commands.py"), + "generate-test-certs": MachCommandReference( + "security/manager/tools/mach_commands.py" ), - "run": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "run-condprofile": MachCommandReference("testing/condprofile/mach_commands.py"), - "rusttests": MachCommandReference("testing/mach_commands.py"), - "settings": MachCommandReference("python/mach/mach/commands/settings.py"), - "show-log": MachCommandReference("python/mozbuild/mozbuild/mach_commands.py"), - "static-analysis": MachCommandReference( - "python/mozbuild/mozbuild/code_analysis/mach_commands.py" - ), - "storybook": MachCommandReference( - "browser/components/storybook/mach_commands.py" - ), - "talos-test": MachCommandReference("testing/talos/mach_commands.py"), + "taskgraph": MachCommandReference("taskcluster/mach_commands.py"), + "taskcluster-load-image": MachCommandReference("taskcluster/mach_commands.py"), "taskcluster-build-image": MachCommandReference("taskcluster/mach_commands.py"), "taskcluster-image-digest": MachCommandReference( "taskcluster/mach_commands.py" ), - "taskcluster-load-image": MachCommandReference("taskcluster/mach_commands.py"), - "taskgraph": MachCommandReference("taskcluster/mach_commands.py"), + "release-history": MachCommandReference("taskcluster/mach_commands.py"), + "awsy-test": MachCommandReference("testing/awsy/mach_commands.py"), + "fetch-condprofile": MachCommandReference( + "testing/condprofile/mach_commands.py" + ), + "run-condprofile": MachCommandReference("testing/condprofile/mach_commands.py"), + "firefox-ui-functional": MachCommandReference( + "testing/firefox-ui/mach_commands.py" + ), + "geckodriver": MachCommandReference("testing/geckodriver/mach_commands.py"), + "addtest": MachCommandReference("testing/mach_commands.py"), + "test": MachCommandReference("testing/mach_commands.py"), + "cppunittest": MachCommandReference("testing/mach_commands.py"), + "jstests": MachCommandReference("testing/mach_commands.py"), + "jit-test": MachCommandReference("testing/mach_commands.py"), + "jsapi-tests": MachCommandReference("testing/mach_commands.py"), + "jsshell-bench": MachCommandReference("testing/mach_commands.py"), + "cramtest": MachCommandReference("testing/mach_commands.py"), + "test-info": MachCommandReference("testing/mach_commands.py"), + "rusttests": MachCommandReference("testing/mach_commands.py"), + "fluent-migration-test": MachCommandReference("testing/mach_commands.py"), + "marionette-test": MachCommandReference("testing/marionette/mach_commands.py"), + "mochitest": MachCommandReference("testing/mochitest/mach_commands.py"), + "geckoview-junit": MachCommandReference("testing/mochitest/mach_commands.py"), + "mozharness": MachCommandReference("testing/mozharness/mach_commands.py"), + "raptor": MachCommandReference("testing/raptor/mach_commands.py"), + "raptor-test": MachCommandReference("testing/raptor/mach_commands.py"), + "talos-test": MachCommandReference("testing/talos/mach_commands.py"), + "tps-build": MachCommandReference("testing/tps/mach_commands.py"), + "web-platform-tests": MachCommandReference( + "testing/web-platform/mach_commands.py" + ), + "wpt": MachCommandReference("testing/web-platform/mach_commands.py"), + "web-platform-tests-update": MachCommandReference( + "testing/web-platform/mach_commands.py" + ), + "wpt-update": MachCommandReference("testing/web-platform/mach_commands.py"), + "wpt-manifest-update": MachCommandReference( + "testing/web-platform/mach_commands.py" + ), + "wpt-serve": MachCommandReference("testing/web-platform/mach_commands.py"), + "wpt-metadata-summary": MachCommandReference( + "testing/web-platform/mach_commands.py" + ), + "wpt-metadata-merge": MachCommandReference( + "testing/web-platform/mach_commands.py" + ), + "wpt-unittest": MachCommandReference("testing/web-platform/mach_commands.py"), + "wpt-test-paths": MachCommandReference("testing/web-platform/mach_commands.py"), + "wpt-fission-regressions": MachCommandReference( + "testing/web-platform/mach_commands.py" + ), + "xpcshell-test": MachCommandReference("testing/xpcshell/mach_commands.py"), "telemetry-tests-client": MachCommandReference( "toolkit/components/telemetry/tests/marionette/mach_commands.py" ), - "test": MachCommandReference("testing/mach_commands.py"), - "test-info": MachCommandReference("testing/mach_commands.py"), - "test-interventions": MachCommandReference( - "testing/webcompat/mach_commands.py", "webcompat" + "data-review": MachCommandReference( + "toolkit/components/glean/build_scripts/mach_commands.py" ), - "tps-build": MachCommandReference("testing/tps/mach_commands.py"), - "try": MachCommandReference("tools/tryselect/mach_commands.py"), - "uniffi": MachCommandReference( - "toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py" - ), - "update-glean": MachCommandReference( + "perf-data-review": MachCommandReference( "toolkit/components/glean/build_scripts/mach_commands.py" ), "update-glean-tags": MachCommandReference( "toolkit/components/glean/build_scripts/mach_commands.py" ), - "valgrind-test": MachCommandReference("build/valgrind/mach_commands.py"), - "vcs-setup": MachCommandReference( - "python/mozboot/mozboot/mach_commands.py", "build" + "update-glean": MachCommandReference( + "toolkit/components/glean/build_scripts/mach_commands.py" ), - "vendor": MachCommandReference( - "python/mozbuild/mozbuild/vendor/mach_commands.py", "vendor" + "browsertime": MachCommandReference("tools/browsertime/mach_commands.py"), + "compare-locales": MachCommandReference( + "tools/compare-locales/mach_commands.py" ), - "warnings-list": MachCommandReference( - "python/mozbuild/mozbuild/mach_commands.py" - ), - "warnings-summary": MachCommandReference( - "python/mozbuild/mozbuild/mach_commands.py" - ), - "watch": MachCommandReference( - "python/mozbuild/mozbuild/mach_commands.py", "watch" - ), - "web-platform-tests": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "web-platform-tests-update": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "webidl-example": MachCommandReference("dom/bindings/mach_commands.py"), - "webidl-parser-test": MachCommandReference("dom/bindings/mach_commands.py"), - "wpt": MachCommandReference("testing/web-platform/mach_commands.py", "wpt"), - "wpt-fetch-logs": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt-interop" - ), - "wpt-fission-regressions": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-interop-score": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt-interop" - ), - "wpt-manifest-update": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-metadata-merge": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-metadata-summary": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-serve": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-test-paths": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-unittest": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" - ), - "wpt-update": MachCommandReference( - "testing/web-platform/mach_commands.py", "wpt" + "l10n-cross-channel": MachCommandReference("tools/lint/mach_commands.py"), + "busted": MachCommandReference("tools/mach_commands.py"), + "pastebin": MachCommandReference("tools/mach_commands.py"), + "mozregression": MachCommandReference("tools/mach_commands.py"), + "node": MachCommandReference("tools/mach_commands.py"), + "npm": MachCommandReference("tools/mach_commands.py"), + "logspam": MachCommandReference("tools/mach_commands.py"), + "doc": MachCommandReference("tools/moztreedocs/mach_commands.py"), + "install-moz-phab": MachCommandReference("tools/phabricator/mach_commands.py"), + "power": MachCommandReference("tools/power/mach_commands.py"), + "try": MachCommandReference("tools/tryselect/mach_commands.py"), + "import-pr": MachCommandReference("tools/vcs/mach_commands.py"), + "test-interventions": MachCommandReference( + "testing/webcompat/mach_commands.py" ), + "esmify": MachCommandReference("tools/esmify/mach_commands.py"), "xpcshell": MachCommandReference("js/xpconnect/mach_commands.py"), - "xpcshell-test": MachCommandReference("testing/xpcshell/mach_commands.py"), + "uniffi": MachCommandReference( + "toolkit/components/uniffi-bindgen-gecko-js/mach_commands.py" + ), + "storybook": MachCommandReference( + "browser/components/storybook/mach_commands.py" + ), + "widgets": MachCommandReference("toolkit/content/widgets/mach_commands.py"), } - command_name = next((x for x in args if not x.startswith("-")), None) - command_site_manager = None - - # the 'clobber' command needs to run in the 'mach' venv, so we - # don't want to activate any other virtualenv for it. - if command_name != "clobber": - site_name = getattr(MACH_COMMANDS.get(command_name), "site_name", "common") - - from mach.site import CommandSiteManager - - command_site_manager = CommandSiteManager.from_environment( - topsrcdir, - lambda: os.path.normpath(get_state_dir(True, topsrcdir=topsrcdir)), - site_name, - get_virtualenv_base_dir(topsrcdir), - ) - - command_site_manager.activate() - # Set a reasonable limit to the number of open files. # # Some linux systems set `ulimit -n` to a very high number, which works @@ -541,7 +488,7 @@ def initialize(topsrcdir, args=()): if "MACH_MAIN_PID" not in os.environ: setenv("MACH_MAIN_PID", str(os.getpid())) - driver = mach.main.Mach(os.getcwd(), command_site_manager) + driver = mach.main.Mach(os.getcwd()) driver.populate_context_handler = populate_context if not driver.settings_paths: @@ -562,14 +509,7 @@ def initialize(topsrcdir, args=()): ) or os.path.exists(os.path.join(topsrcdir, "INSTALL")) else: missing_ok = () - if command_name not in MACH_COMMANDS: - command_modules_to_load = MACH_COMMANDS - else: - command_modules_to_load = {command_name: MACH_COMMANDS[command_name]} - - driver.load_commands_from_spec( - command_modules_to_load, topsrcdir, missing_ok=missing_ok - ) + driver.load_commands_from_spec(MACH_COMMANDS, topsrcdir, missing_ok=missing_ok) return driver diff --git a/mach b/mach index a62db70b13a5..cc5e25b7aa36 100755 --- a/mach +++ b/mach @@ -13,17 +13,17 @@ MIN_PYTHON_VERSION = (3, 7) MAX_PYTHON_VERSION_TO_CONSIDER = (3, 11) -def load_mach(dir_path, mach_path, args): +def load_mach(dir_path, mach_path): # Defer import of "importlib.util" until after Python version check has happened # so that Python 2 usages fail gracefully. import importlib.util spec = importlib.util.spec_from_file_location('mach_initialize', mach_path) mach_initialize = importlib.util.module_from_spec(spec) spec.loader.exec_module(mach_initialize) - return mach_initialize.initialize(dir_path, args) + return mach_initialize.initialize(dir_path) -def check_and_get_mach(dir_path, args): +def check_and_get_mach(dir_path): initialize_paths = ( # Run Thunderbird's mach_initialize.py if it exists 'comm/build/mach_initialize.py', @@ -34,7 +34,7 @@ def check_and_get_mach(dir_path, args): for initialize_path in initialize_paths: mach_path = os.path.join(dir_path, initialize_path) if os.path.isfile(mach_path): - return load_mach(dir_path, mach_path, args) + return load_mach(dir_path, mach_path) return None @@ -114,7 +114,7 @@ def main(args): # https://github.com/python/cpython/pull/9516 os.environ.pop("__PYVENV_LAUNCHER__", None) - mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__)), args) + mach = check_and_get_mach(os.path.dirname(os.path.realpath(__file__))) if not mach: print('Could not run mach: No mach source directory found.') sys.exit(1) diff --git a/python/mach/mach/main.py b/python/mach/mach/main.py index 1b4782367ad3..79fcb8e8ad17 100644 --- a/python/mach/mach/main.py +++ b/python/mach/mach/main.py @@ -16,9 +16,7 @@ import traceback import uuid from collections.abc import Iterable from pathlib import Path -from typing import Dict, List, Optional, Union - -from mach.site import CommandSiteManager +from typing import Dict, List, Union from .base import ( CommandContext, @@ -182,13 +180,8 @@ class MachCommandReference: module: Path - def __init__( - self, - module: Union[str, Path], - command_site_name: Optional[str] = None, - ): + def __init__(self, module: Union[str, Path]): self.module = Path(module) - self.site_name = command_site_name if command_site_name else "common" class Mach(object): @@ -233,9 +226,7 @@ To see more help for a specific command, run: %(prog)s help """ - def __init__( - self, cwd: str, command_site_manager: Optional[CommandSiteManager] = None - ): + def __init__(self, cwd: str): assert Path(cwd).is_dir() self.cwd = cwd @@ -243,7 +234,6 @@ To see more help for a specific command, run: self.logger = logging.getLogger(__name__) self.settings = ConfigSettings() self.settings_paths = [] - self.command_site_manager = command_site_manager if "MACHRC" in os.environ: self.settings_paths.append(os.environ["MACHRC"]) @@ -529,7 +519,6 @@ To see more help for a specific command, run: return Registrar._run_command_handler( handler, context, - self.command_site_manager, debug_command=args.debug_command, profile_command=args.profile_command, **vars(args.command_args), diff --git a/python/mach/mach/registrar.py b/python/mach/mach/registrar.py index e7738af81c31..75481596f4b4 100644 --- a/python/mach/mach/registrar.py +++ b/python/mach/mach/registrar.py @@ -86,13 +86,7 @@ class MachRegistrar(object): return fail_conditions def _run_command_handler( - self, - handler, - context, - command_site_manager=None, - debug_command=False, - profile_command=False, - **kwargs, + self, handler, context, debug_command=False, profile_command=False, **kwargs ): instance = MachRegistrar._instance(handler, context, **kwargs) fail_conditions = MachRegistrar._fail_conditions(handler, instance) @@ -105,10 +99,7 @@ class MachRegistrar(object): self.command_depth += 1 fn = handler.func if handler.virtualenv_name: - if command_site_manager: - instance.virtualenv_manager = command_site_manager - else: - instance.activate_virtualenv() + instance.activate_virtualenv() profile = None if profile_command: diff --git a/python/mozbuild/mozbuild/artifact_commands.py b/python/mozbuild/mozbuild/artifact_commands.py index d5abf1a0998d..12184ce0d984 100644 --- a/python/mozbuild/mozbuild/artifact_commands.py +++ b/python/mozbuild/mozbuild/artifact_commands.py @@ -132,11 +132,7 @@ def _make_artifacts( return artifacts -@ArtifactSubCommand( - "artifact", - "install", - "Install a good pre-built artifact.", -) +@ArtifactSubCommand("artifact", "install", "Install a good pre-built artifact.") @CommandArgument( "source", metavar="SRC", @@ -204,10 +200,7 @@ def artifact_clear_cache(command_context, tree=None, job=None, verbose=False): return 0 -@SubCommand( - "artifact", - "toolchain", -) +@SubCommand("artifact", "toolchain") @CommandArgument("--verbose", "-v", action="store_true", help="Print verbose output.") @CommandArgument( "--cache-dir", @@ -271,10 +264,6 @@ def artifact_toolchain( """Download, cache and install pre-built toolchains.""" import time - # As a result of the selective module loading changes, this import has to be - # done here. It is not explicitly used, but it has an implicit side-effect - # (bringing in TASKCLUSTER_ROOT_URL) which is necessary. - import gecko_taskgraph.main # noqa: F401 import redo import requests from taskgraph.util.taskcluster import get_artifact_url diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 3f5a6242f838..8dc9f90dbf64 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -268,10 +268,6 @@ class MozbuildObject(ProcessExecutionMixin): return self._virtualenv_manager - @virtualenv_manager.setter - def virtualenv_manager(self, command_site_manager): - self._virtualenv_manager = command_site_manager - @staticmethod @memoize def get_base_mozconfig_info(topsrcdir, path, env_mozconfig): diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 370b9888be7e..0c388f198bfc 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -29,6 +29,7 @@ from mach.decorators import ( SettingsProvider, SubCommand, ) +from voluptuous import All, Boolean, Required, Schema import mozbuild.settings # noqa need @SettingsProvider hook to execute from mozbuild.base import ( @@ -112,8 +113,6 @@ To do so, add the corresponding file in /build/cargo, followin def _cargo_config_yaml_schema(): - from voluptuous import All, Boolean, Required, Schema - def starts_with_cargo(s): if s.startswith("cargo-"): return s diff --git a/python/sites/build.txt b/python/sites/build.txt index 691a9a2f6e61..4e6f6c51d9ad 100644 --- a/python/sites/build.txt +++ b/python/sites/build.txt @@ -1,51 +1 @@ pth:third_party/python/vsdownload -vendored:testing/web-platform/tests/tools/third_party/h2 -vendored:testing/web-platform/tests/tools/third_party/hpack -vendored:testing/web-platform/tests/tools/third_party/html5lib -vendored:testing/web-platform/tests/tools/third_party/hyperframe -vendored:testing/web-platform/tests/tools/third_party/pywebsocket3 -vendored:testing/web-platform/tests/tools/third_party/webencodings -vendored:testing/web-platform/tests/tools/wptrunner -vendored:testing/web-platform/tests/tools/wptserve -vendored:third_party/python/Jinja2 -vendored:third_party/python/PyYAML/lib3/ -vendored:third_party/python/aiohttp -vendored:third_party/python/appdirs -vendored:third_party/python/async_timeout -vendored:third_party/python/chardet -vendored:third_party/python/compare_locales -vendored:third_party/python/diskcache -vendored:third_party/python/dlmanager -vendored:third_party/python/ecdsa -vendored:third_party/python/fluent.migrate -vendored:third_party/python/fluent.syntax -vendored:third_party/python/giturlparse -vendored:third_party/python/glean_parser -vendored:third_party/python/gyp/pylib -vendored:third_party/python/importlib_metadata -vendored:third_party/python/importlib_resources -vendored:third_party/python/json-e -vendored:third_party/python/jsonschema -vendored:third_party/python/mohawk -vendored:third_party/python/mozilla_repo_urls -vendored:third_party/python/multidict -vendored:third_party/python/pathspec -vendored:third_party/python/pkgutil_resolve_name -vendored:third_party/python/ply -vendored:third_party/python/pyasn1 -vendored:third_party/python/pyasn1_modules -vendored:third_party/python/pylru -vendored:third_party/python/pyrsistent -vendored:third_party/python/redo -vendored:third_party/python/requests_unixsocket -vendored:third_party/python/rsa -vendored:third_party/python/slugid -vendored:third_party/python/taskcluster -vendored:third_party/python/taskcluster_taskgraph -vendored:third_party/python/taskcluster_urls -vendored:third_party/python/toml -vendored:third_party/python/typing_extensions -vendored:third_party/python/voluptuous -vendored:third_party/python/yamllint -vendored:third_party/python/yarl -vendored:third_party/python/zipp diff --git a/python/sites/common.txt b/python/sites/common.txt index e693cd06ba9f..8b137891791f 100644 --- a/python/sites/common.txt +++ b/python/sites/common.txt @@ -1,56 +1 @@ -vendored:testing/web-platform/tests/tools/third_party/h2 -vendored:testing/web-platform/tests/tools/third_party/hpack -vendored:testing/web-platform/tests/tools/third_party/html5lib -vendored:testing/web-platform/tests/tools/third_party/hyperframe -vendored:testing/web-platform/tests/tools/third_party/pywebsocket3 -vendored:testing/web-platform/tests/tools/third_party/webencodings -vendored:testing/web-platform/tests/tools/wptrunner -vendored:testing/web-platform/tests/tools/wptserve -vendored:third_party/python/MarkupSafe/src -vendored:third_party/python/PyYAML/lib3/ -vendored:third_party/python/aiohttp -vendored:third_party/python/appdirs -vendored:third_party/python/async_timeout -vendored:third_party/python/cbor2 -vendored:third_party/python/chardet -vendored:third_party/python/compare_locales -vendored:third_party/python/cookies -vendored:third_party/python/cram -vendored:third_party/python/diskcache -vendored:third_party/python/dlmanager -vendored:third_party/python/ecdsa -vendored:third_party/python/esprima -vendored:third_party/python/fluent.migrate -vendored:third_party/python/fluent.syntax -vendored:third_party/python/giturlparse -vendored:third_party/python/glean_parser -vendored:third_party/python/gyp/pylib -vendored:third_party/python/importlib_metadata -vendored:third_party/python/importlib_resources -vendored:third_party/python/json-e -vendored:third_party/python/jsonschema -vendored:third_party/python/mohawk -vendored:third_party/python/mozilla_repo_urls -vendored:third_party/python/multidict -vendored:third_party/python/pathspec -vendored:third_party/python/pkgutil_resolve_name -vendored:third_party/python/ply -vendored:third_party/python/pyasn1 -vendored:third_party/python/pyasn1_modules -vendored:third_party/python/pylru -vendored:third_party/python/pyparsing -vendored:third_party/python/pyrsistent -vendored:third_party/python/redo -vendored:third_party/python/requests_unixsocket -vendored:third_party/python/responses -vendored:third_party/python/rsa -vendored:third_party/python/slugid -vendored:third_party/python/taskcluster -vendored:third_party/python/taskcluster_taskgraph -vendored:third_party/python/taskcluster_urls -vendored:third_party/python/toml -vendored:third_party/python/typing_extensions -vendored:third_party/python/voluptuous -vendored:third_party/python/yamllint -vendored:third_party/python/yarl -vendored:third_party/python/zipp + diff --git a/python/sites/docs.txt b/python/sites/docs.txt index 60820c4dd837..b6b9cd63e883 100644 --- a/python/sites/docs.txt +++ b/python/sites/docs.txt @@ -4,14 +4,19 @@ pypi:Babel==2.12.1 pypi:backports-abc==0.5 pypi:boto3==1.26.80 pypi:botocore==1.29.80 +pypi:colorama==0.4.5 pypi:commonmark==0.9.1 pypi:docutils==0.17.1 pypi:fluent.pygments==1.0 +pypi:fluent.syntax==0.19.0 pypi:idna==2.10 pypi:imagesize==1.4.1 +pypi:importlib-resources==5.12.0 pypi:jmespath==1.0.1 +pypi:jsonschema==4.17.3 pypi:livereload==2.6.3 pypi:Markdown==3.4.3 +pypi:MarkupSafe==2.0.1 pypi:mock==5.0.1 pypi:mots==0.8.0 pypi:myst-parser==1.0 @@ -20,6 +25,7 @@ pypi:parsimonious==0.10.0 pypi:pyasn1==0.4.8 pypi:pyasn1-modules==0.2.8 pypi:Pygments==2.14.0 +pypi:pyparsing==2.4.7 # for autodoc pypi:pytest==7.2.1 pypi:python-dateutil==2.8.2 @@ -27,6 +33,7 @@ pypi:python-frontmatter==1.0.0 pypi:pytz==2022.7.1 # for autodoc pypi:pywatchman==1.4.1 +pypi:redo==2.0.3 pypi:s3transfer==0.6.0 pypi:scandir==1.10.0 pypi:singledispatch==4.0.0 @@ -46,35 +53,16 @@ pypi:sphinxcontrib-qthelp==1.0.3 pypi:sphinxcontrib-serializinghtml==1.1.5 pypi:tornado==6.0.4 vendored:third_party/python/Jinja2 -vendored:third_party/python/MarkupSafe/src -vendored:third_party/python/PyYAML/lib3/ -vendored:third_party/python/aiohttp -vendored:third_party/python/appdirs -vendored:third_party/python/async_timeout vendored:third_party/python/certifi vendored:third_party/python/chardet -vendored:third_party/python/fluent.syntax -vendored:third_party/python/giturlparse vendored:third_party/python/importlib_metadata vendored:third_party/python/importlib_resources -vendored:third_party/python/json-e vendored:third_party/python/jsonschema -vendored:third_party/python/mohawk -vendored:third_party/python/mozilla_repo_urls vendored:third_party/python/packaging vendored:third_party/python/pkgutil_resolve_name -vendored:third_party/python/pyparsing -vendored:third_party/python/redo vendored:third_party/python/requests -vendored:third_party/python/requests_unixsocket vendored:third_party/python/rsa vendored:third_party/python/sentry_sdk vendored:third_party/python/six -vendored:third_party/python/slugid -vendored:third_party/python/taskcluster -vendored:third_party/python/taskcluster_taskgraph -vendored:third_party/python/taskcluster_urls -vendored:third_party/python/toml vendored:third_party/python/urllib3 -vendored:third_party/python/voluptuous vendored:third_party/python/zipp diff --git a/python/sites/lint.txt b/python/sites/lint.txt index 5f79a4c5495d..139597f9cb07 100644 --- a/python/sites/lint.txt +++ b/python/sites/lint.txt @@ -1,28 +1,2 @@ -vendored:third_party/python/PyYAML/lib3/ -vendored:third_party/python/aiohttp -vendored:third_party/python/appdirs -vendored:third_party/python/async_timeout -vendored:third_party/python/chardet -vendored:third_party/python/compare_locales -vendored:third_party/python/esprima -vendored:third_party/python/fluent.syntax -vendored:third_party/python/giturlparse -vendored:third_party/python/json-e -vendored:third_party/python/jsonschema -vendored:third_party/python/mohawk -vendored:third_party/python/mozilla_repo_urls -vendored:third_party/python/multidict -vendored:third_party/python/pathspec -vendored:third_party/python/pyparsing -vendored:third_party/python/pyrsistent -vendored:third_party/python/redo -vendored:third_party/python/requests_unixsocket -vendored:third_party/python/slugid -vendored:third_party/python/taskcluster -vendored:third_party/python/taskcluster_taskgraph -vendored:third_party/python/taskcluster_urls -vendored:third_party/python/toml -vendored:third_party/python/typing_extensions -vendored:third_party/python/voluptuous -vendored:third_party/python/yamllint -vendored:third_party/python/yarl + + diff --git a/python/sites/mach.txt b/python/sites/mach.txt index 66d342597db4..456c45ae99b2 100644 --- a/python/sites/mach.txt +++ b/python/sites/mach.txt @@ -26,8 +26,8 @@ pth:testing/mozbase/mozcrash pth:testing/mozbase/mozdebug pth:testing/mozbase/mozdevice pth:testing/mozbase/mozfile -pth:testing/mozbase/mozgeckoprofiler pth:testing/mozbase/mozhttpd +pth:testing/mozbase/mozgeckoprofiler pth:testing/mozbase/mozinfo pth:testing/mozbase/mozinstall pth:testing/mozbase/mozleak @@ -38,50 +38,103 @@ pth:testing/mozbase/mozprocess pth:testing/mozbase/mozprofile pth:testing/mozbase/mozproxy pth:testing/mozbase/mozrunner -pth:testing/mozbase/mozscreenshot pth:testing/mozbase/mozserve pth:testing/mozbase/mozsystemmonitor +pth:testing/mozbase/mozscreenshot pth:testing/mozbase/moztest pth:testing/mozbase/mozversion pth:testing/mozharness pth:testing/raptor pth:testing/talos pth:testing/web-platform +vendored:testing/web-platform/tests/tools/third_party/h2 +vendored:testing/web-platform/tests/tools/third_party/hpack +vendored:testing/web-platform/tests/tools/third_party/html5lib +vendored:testing/web-platform/tests/tools/third_party/hyperframe +vendored:testing/web-platform/tests/tools/third_party/pywebsocket3 +vendored:testing/web-platform/tests/tools/third_party/webencodings +vendored:testing/web-platform/tests/tools/wptserve +vendored:testing/web-platform/tests/tools/wptrunner pth:testing/xpcshell +vendored:third_party/python/aiohttp +vendored:third_party/python/ansicon +vendored:third_party/python/appdirs +vendored:third_party/python/async_timeout +vendored:third_party/python/attrs +vendored:third_party/python/blessed +vendored:third_party/python/cbor2 +vendored:third_party/python/certifi +vendored:third_party/python/chardet +vendored:third_party/python/click +vendored:third_party/python/colorama +vendored:third_party/python/compare_locales +vendored:third_party/python/cookies +vendored:third_party/python/cram +vendored:third_party/python/diskcache +vendored:third_party/python/distro +vendored:third_party/python/dlmanager +vendored:third_party/python/ecdsa +vendored:third_party/python/esprima +vendored:third_party/python/fluent.migrate +vendored:third_party/python/fluent.syntax +vendored:third_party/python/giturlparse +vendored:third_party/python/glean_parser +vendored:third_party/python/gyp/pylib +vendored:third_party/python/idna +vendored:third_party/python/importlib_metadata +vendored:third_party/python/importlib_resources +vendored:third_party/python/Jinja2 +vendored:third_party/python/jinxed +vendored:third_party/python/jsmin +vendored:third_party/python/json-e +vendored:third_party/python/jsonschema +vendored:third_party/python/looseversion +vendored:third_party/python/MarkupSafe/src +vendored:third_party/python/mohawk +vendored:third_party/python/mozilla_repo_urls +vendored:third_party/python/mozilla_version +vendored:third_party/python/multidict +vendored:third_party/python/packaging +vendored:third_party/python/pathspec +vendored:third_party/python/pip +vendored:third_party/python/pip_tools +vendored:third_party/python/pkgutil_resolve_name +vendored:third_party/python/ply +vendored:third_party/python/pyasn1 +vendored:third_party/python/pyasn1_modules +vendored:third_party/python/pylru +vendored:third_party/python/pyparsing +vendored:third_party/python/pyrsistent +vendored:third_party/python/python-hglib +vendored:third_party/python/PyYAML/lib3/ +vendored:third_party/python/redo +vendored:third_party/python/requests +vendored:third_party/python/requests_unixsocket +vendored:third_party/python/responses +vendored:third_party/python/rsa +vendored:third_party/python/setuptools +vendored:third_party/python/sentry_sdk +vendored:third_party/python/six +vendored:third_party/python/slugid +vendored:third_party/python/taskcluster +vendored:third_party/python/taskcluster_taskgraph +vendored:third_party/python/taskcluster_urls +vendored:third_party/python/toml +vendored:third_party/python/tqdm +vendored:third_party/python/typing_extensions +vendored:third_party/python/urllib3 +vendored:third_party/python/voluptuous +vendored:third_party/python/wcwidth +vendored:third_party/python/wheel +vendored:third_party/python/yamllint +vendored:third_party/python/yarl +vendored:third_party/python/zipp pth:toolkit/components/telemetry/tests/marionette/harness pth:tools pth:tools/moztreedocs pth:xpcom/ds/tools pth:xpcom/geckoprocesstypes_generator pth:xpcom/idl-parser -vendored:third_party/python/Jinja2 -vendored:third_party/python/MarkupSafe/src -vendored:third_party/python/ansicon -vendored:third_party/python/attrs -vendored:third_party/python/blessed -vendored:third_party/python/certifi -vendored:third_party/python/chardet -vendored:third_party/python/click -vendored:third_party/python/colorama -vendored:third_party/python/distro -vendored:third_party/python/idna -vendored:third_party/python/jinxed -vendored:third_party/python/jsmin -vendored:third_party/python/looseversion -vendored:third_party/python/mozilla_version -vendored:third_party/python/packaging -vendored:third_party/python/pip -vendored:third_party/python/pip_tools -vendored:third_party/python/pyparsing -vendored:third_party/python/python-hglib -vendored:third_party/python/requests -vendored:third_party/python/sentry_sdk -vendored:third_party/python/setuptools -vendored:third_party/python/six -vendored:third_party/python/tqdm -vendored:third_party/python/urllib3 -vendored:third_party/python/wcwidth -vendored:third_party/python/wheel # glean-sdk may not be installable if a wheel isn't available # and it has to be built from source. pypi-optional:glean-sdk==53.0.0:telemetry will not be collected diff --git a/python/sites/perftest-test.txt b/python/sites/perftest-test.txt index ec5c652eb848..f457c8c66734 100644 --- a/python/sites/perftest-test.txt +++ b/python/sites/perftest-test.txt @@ -1,10 +1,2 @@ pypi:pytest==7.0.1 pypi:coverage==5.1 -vendored:third_party/python/PyYAML/lib3/ -vendored:third_party/python/dlmanager -vendored:third_party/python/esprima -vendored:third_party/python/importlib_resources -vendored:third_party/python/jsonschema -vendored:third_party/python/pyrsistent -vendored:third_party/python/redo -vendored:third_party/python/responses \ No newline at end of file diff --git a/python/sites/python-test.txt b/python/sites/python-test.txt index 87d7e6dbe694..74889365a22b 100644 --- a/python/sites/python-test.txt +++ b/python/sites/python-test.txt @@ -1,57 +1 @@ pypi:pytest==7.0.1 -vendored:testing/web-platform/tests/tools/third_party/h2 -vendored:testing/web-platform/tests/tools/third_party/hpack -vendored:testing/web-platform/tests/tools/third_party/html5lib -vendored:testing/web-platform/tests/tools/third_party/hyperframe -vendored:testing/web-platform/tests/tools/third_party/pywebsocket3 -vendored:testing/web-platform/tests/tools/third_party/webencodings -vendored:testing/web-platform/tests/tools/wptrunner -vendored:testing/web-platform/tests/tools/wptserve -vendored:third_party/python/MarkupSafe/src -vendored:third_party/python/PyYAML/lib3/ -vendored:third_party/python/aiohttp -vendored:third_party/python/appdirs -vendored:third_party/python/async_timeout -vendored:third_party/python/cbor2 -vendored:third_party/python/chardet -vendored:third_party/python/compare_locales -vendored:third_party/python/cookies -vendored:third_party/python/cram -vendored:third_party/python/diskcache -vendored:third_party/python/dlmanager -vendored:third_party/python/ecdsa -vendored:third_party/python/esprima -vendored:third_party/python/fluent.migrate -vendored:third_party/python/fluent.syntax -vendored:third_party/python/giturlparse -vendored:third_party/python/glean_parser -vendored:third_party/python/gyp/pylib -vendored:third_party/python/importlib_metadata -vendored:third_party/python/importlib_resources -vendored:third_party/python/json-e -vendored:third_party/python/jsonschema -vendored:third_party/python/mohawk -vendored:third_party/python/mozilla_repo_urls -vendored:third_party/python/multidict -vendored:third_party/python/pathspec -vendored:third_party/python/pkgutil_resolve_name -vendored:third_party/python/ply -vendored:third_party/python/pyasn1 -vendored:third_party/python/pyasn1_modules -vendored:third_party/python/pylru -vendored:third_party/python/pyparsing -vendored:third_party/python/pyrsistent -vendored:third_party/python/redo -vendored:third_party/python/requests_unixsocket -vendored:third_party/python/responses -vendored:third_party/python/rsa -vendored:third_party/python/slugid -vendored:third_party/python/taskcluster -vendored:third_party/python/taskcluster_taskgraph -vendored:third_party/python/taskcluster_urls -vendored:third_party/python/toml -vendored:third_party/python/typing_extensions -vendored:third_party/python/voluptuous -vendored:third_party/python/yamllint -vendored:third_party/python/yarl -vendored:third_party/python/zipp diff --git a/python/sites/vendor.txt b/python/sites/vendor.txt index 6b8166a9ef0b..cb5b087afc50 100644 --- a/python/sites/vendor.txt +++ b/python/sites/vendor.txt @@ -1,6 +1,4 @@ pypi:poetry==1.4 # Pin poetry-core so that the same one is used between Python versions. # Otherwise, different versions of poetry-core output different "requirements.txt" contents -pypi:poetry-core==1.5.1 -vendored:third_party/python/toml -vendored:third_party/python/voluptuous +pypi:poetry-core==1.5.1 \ No newline at end of file