forked from mirrors/gecko-dev
Bug 1717051: Rename "mach_bootstrap.py" to "mach_initialize.py" r=firefox-build-system-reviewers,glandium
We've overloaded "bootstrap" to mean three different things: * The "standalone bootstrap script": `python/mozboot/bin/bootstrap.py`. This is to freshly clone a new repo, then run `./mach bootstrap`. * `./mach bootstrap`: Install necessary dependencies and set up the system for development. * "Mach bootstrap": do the in-process initialization work Mach needs before it can run commands. By using the term "initialize" instead, perhaps we can remove ambiguity when discussing Mach. I'm not attached to the name (or this change at all), but I'm interested in reviewer thoughts :) Differential Revision: https://phabricator.services.mozilla.com/D120410
This commit is contained in:
parent
1db9ce10c0
commit
f5b0cb5bc1
11 changed files with 20 additions and 20 deletions
|
|
@ -83,7 +83,7 @@ the build system.
|
|||
|
||||
* mach reinvents the virtualenv.
|
||||
|
||||
There is code in ``build/mach_bootstrap.py`` that configures ``sys.path``
|
||||
There is code in ``build/mach_initialize.py`` that configures ``sys.path``
|
||||
much the same way the virtualenv does. There are various bugs tracking
|
||||
this. However, no clear solution has yet been devised. It's not a huge
|
||||
problem and thus not a huge priority.
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ install a recent enough Python 3.
|
|||
""".strip()
|
||||
|
||||
|
||||
def bootstrap(topsrcdir):
|
||||
def initialize(topsrcdir):
|
||||
# Ensure we are running Python 3.6+. We run this check as soon as
|
||||
# possible to avoid a cryptic import/usage error.
|
||||
if sys.version_info < (3, 6):
|
||||
|
|
@ -6,7 +6,7 @@ path:build/moz.configure/checks.configure
|
|||
path:build/moz.configure/init.configure
|
||||
path:build/moz.configure/util.configure
|
||||
# Used for bootstrapping the mach driver.
|
||||
path:build/mach_bootstrap.py
|
||||
path:build/mach_initialize.py
|
||||
path:build/build_virtualenv_packages.txt
|
||||
path:build/common_virtualenv_packages.txt
|
||||
path:build/mach_virtualenv_packages.txt
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ from mach.registrar import Registrar
|
|||
from mozbuild.mozconfig import MozconfigLoader
|
||||
from mozbuild.base import MachCommandBase
|
||||
|
||||
# Command files like this are listed in build/mach_bootstrap.py in alphabetical
|
||||
# Command files like this are listed in build/mach_initialize.py in alphabetical
|
||||
# order, but we need to access commands earlier in the sorted order to grab
|
||||
# their arguments. Force them to load now.
|
||||
import mozbuild.artifact_commands # NOQA: F401
|
||||
|
|
|
|||
20
mach
20
mach
|
|
@ -128,20 +128,20 @@ import sys
|
|||
|
||||
def load_mach(dir_path, mach_path):
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location('mach_bootstrap', mach_path)
|
||||
mach_bootstrap = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mach_bootstrap)
|
||||
return mach_bootstrap.bootstrap(dir_path)
|
||||
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)
|
||||
|
||||
|
||||
def check_and_get_mach(dir_path):
|
||||
bootstrap_paths = (
|
||||
'build/mach_bootstrap.py',
|
||||
# test package bootstrap
|
||||
'tools/mach_bootstrap.py',
|
||||
initialize_paths = (
|
||||
'build/mach_initialize.py',
|
||||
# test package initialize
|
||||
'tools/mach_initialize.py',
|
||||
)
|
||||
for bootstrap_path in bootstrap_paths:
|
||||
mach_path = os.path.join(dir_path, bootstrap_path)
|
||||
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)
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class MachCommands(MachCommandBase):
|
|||
raise UserError("Cannot pass both --requirements and --no-virtualenv.")
|
||||
|
||||
if no_virtualenv:
|
||||
from mach_bootstrap import mach_sys_path
|
||||
from mach_initialize import mach_sys_path
|
||||
|
||||
python_path = sys.executable
|
||||
append_env["PYTHONPATH"] = os.pathsep.join(
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ def get_state_dir(srcdir=False):
|
|||
)
|
||||
|
||||
if not os.path.isdir(state_dir):
|
||||
# We create the srcdir here rather than 'mach_bootstrap.py' so direct
|
||||
# We create the srcdir here rather than 'mach_initialize.py' so direct
|
||||
# consumers of this function don't create the directory inconsistently.
|
||||
print("Creating local state directory: %s" % state_dir)
|
||||
os.makedirs(state_dir, mode=0o770)
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ ARCHIVE_FILES = {
|
|||
{"source": buildconfig.topsrcdir, "pattern": "build/autoconf/**"},
|
||||
{"source": buildconfig.topsrcdir, "pattern": "build/moz.configure/**"},
|
||||
{"source": buildconfig.topsrcdir, "pattern": "python/**"},
|
||||
{"source": buildconfig.topsrcdir, "pattern": "build/mach_bootstrap.py"},
|
||||
{"source": buildconfig.topsrcdir, "pattern": "build/mach_initialize.py"},
|
||||
{
|
||||
"source": buildconfig.topsrcdir,
|
||||
"pattern": "build/build_virtualenv_packages.txt",
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ stage-config: make-stage-dir
|
|||
|
||||
stage-mach: make-stage-dir
|
||||
@(cd $(topsrcdir)/python/mach && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/tools/mach && tar -xf -)
|
||||
cp $(topsrcdir)/testing/tools/mach_test_package_bootstrap.py $(PKG_STAGE)/tools/mach_bootstrap.py
|
||||
cp $(topsrcdir)/testing/tools/mach_test_package_initialize.py $(PKG_STAGE)/tools/mach_initialize.py
|
||||
cp $(topsrcdir)/mach $(PKG_STAGE)
|
||||
|
||||
stage-mochitest: make-stage-dir ;
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ def patch_vcs(monkeypatch):
|
|||
|
||||
@pytest.fixture(scope="session")
|
||||
def run_mach():
|
||||
import mach_bootstrap
|
||||
import mach_initialize
|
||||
from mach.config import ConfigSettings
|
||||
from tryselect.tasks import build
|
||||
|
||||
mach = mach_bootstrap.bootstrap(build.topsrcdir)
|
||||
mach = mach_initialize.initialize(build.topsrcdir)
|
||||
|
||||
def inner(args):
|
||||
mach.settings = ConfigSettings()
|
||||
|
|
|
|||
Loading…
Reference in a new issue