Skip to content
Snippets Groups Projects
Commit f5b0cb5b authored by Mitchell Hentges's avatar Mitchell Hentges
Browse files

Bug 1717051: Rename "mach_bootstrap.py" to "mach_initialize.py"...

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
parent 1db9ce10
No related branches found
No related tags found
No related merge requests found
...@@ -83,7 +83,7 @@ the build system. ...@@ -83,7 +83,7 @@ the build system.
* mach reinvents the virtualenv. * 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 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 this. However, no clear solution has yet been devised. It's not a huge
problem and thus not a huge priority. problem and thus not a huge priority.
......
...@@ -197,7 +197,7 @@ install a recent enough Python 3. ...@@ -197,7 +197,7 @@ install a recent enough Python 3.
""".strip() """.strip()
def bootstrap(topsrcdir): def initialize(topsrcdir):
# Ensure we are running Python 3.6+. We run this check as soon as # Ensure we are running Python 3.6+. We run this check as soon as
# possible to avoid a cryptic import/usage error. # possible to avoid a cryptic import/usage error.
if sys.version_info < (3, 6): if sys.version_info < (3, 6):
......
...@@ -6,7 +6,7 @@ path:build/moz.configure/checks.configure ...@@ -6,7 +6,7 @@ path:build/moz.configure/checks.configure
path:build/moz.configure/init.configure path:build/moz.configure/init.configure
path:build/moz.configure/util.configure path:build/moz.configure/util.configure
# Used for bootstrapping the mach driver. # Used for bootstrapping the mach driver.
path:build/mach_bootstrap.py path:build/mach_initialize.py
path:build/build_virtualenv_packages.txt path:build/build_virtualenv_packages.txt
path:build/common_virtualenv_packages.txt path:build/common_virtualenv_packages.txt
path:build/mach_virtualenv_packages.txt path:build/mach_virtualenv_packages.txt
......
...@@ -25,7 +25,7 @@ from mach.registrar import Registrar ...@@ -25,7 +25,7 @@ from mach.registrar import Registrar
from mozbuild.mozconfig import MozconfigLoader from mozbuild.mozconfig import MozconfigLoader
from mozbuild.base import MachCommandBase 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 # order, but we need to access commands earlier in the sorted order to grab
# their arguments. Force them to load now. # their arguments. Force them to load now.
import mozbuild.artifact_commands # NOQA: F401 import mozbuild.artifact_commands # NOQA: F401
......
...@@ -128,20 +128,20 @@ import sys ...@@ -128,20 +128,20 @@ import sys
def load_mach(dir_path, mach_path): def load_mach(dir_path, mach_path):
import importlib.util import importlib.util
spec = importlib.util.spec_from_file_location('mach_bootstrap', mach_path) spec = importlib.util.spec_from_file_location('mach_initialize', mach_path)
mach_bootstrap = importlib.util.module_from_spec(spec) mach_initialize = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mach_bootstrap) spec.loader.exec_module(mach_initialize)
return mach_bootstrap.bootstrap(dir_path) return mach_initialize.initialize(dir_path)
def check_and_get_mach(dir_path): def check_and_get_mach(dir_path):
bootstrap_paths = ( initialize_paths = (
'build/mach_bootstrap.py', 'build/mach_initialize.py',
# test package bootstrap # test package initialize
'tools/mach_bootstrap.py', 'tools/mach_initialize.py',
) )
for bootstrap_path in bootstrap_paths: for initialize_path in initialize_paths:
mach_path = os.path.join(dir_path, bootstrap_path) mach_path = os.path.join(dir_path, initialize_path)
if os.path.isfile(mach_path): if os.path.isfile(mach_path):
return load_mach(dir_path, mach_path) return load_mach(dir_path, mach_path)
return None return None
......
...@@ -72,7 +72,7 @@ class MachCommands(MachCommandBase): ...@@ -72,7 +72,7 @@ class MachCommands(MachCommandBase):
raise UserError("Cannot pass both --requirements and --no-virtualenv.") raise UserError("Cannot pass both --requirements and --no-virtualenv.")
if no_virtualenv: if no_virtualenv:
from mach_bootstrap import mach_sys_path from mach_initialize import mach_sys_path
python_path = sys.executable python_path = sys.executable
append_env["PYTHONPATH"] = os.pathsep.join( append_env["PYTHONPATH"] = os.pathsep.join(
......
...@@ -55,7 +55,7 @@ def get_state_dir(srcdir=False): ...@@ -55,7 +55,7 @@ def get_state_dir(srcdir=False):
) )
if not os.path.isdir(state_dir): 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. # consumers of this function don't create the directory inconsistently.
print("Creating local state directory: %s" % state_dir) print("Creating local state directory: %s" % state_dir)
os.makedirs(state_dir, mode=0o770) os.makedirs(state_dir, mode=0o770)
......
...@@ -382,7 +382,7 @@ ARCHIVE_FILES = { ...@@ -382,7 +382,7 @@ ARCHIVE_FILES = {
{"source": buildconfig.topsrcdir, "pattern": "build/autoconf/**"}, {"source": buildconfig.topsrcdir, "pattern": "build/autoconf/**"},
{"source": buildconfig.topsrcdir, "pattern": "build/moz.configure/**"}, {"source": buildconfig.topsrcdir, "pattern": "build/moz.configure/**"},
{"source": buildconfig.topsrcdir, "pattern": "python/**"}, {"source": buildconfig.topsrcdir, "pattern": "python/**"},
{"source": buildconfig.topsrcdir, "pattern": "build/mach_bootstrap.py"}, {"source": buildconfig.topsrcdir, "pattern": "build/mach_initialize.py"},
{ {
"source": buildconfig.topsrcdir, "source": buildconfig.topsrcdir,
"pattern": "build/build_virtualenv_packages.txt", "pattern": "build/build_virtualenv_packages.txt",
......
...@@ -185,7 +185,7 @@ stage-config: make-stage-dir ...@@ -185,7 +185,7 @@ stage-config: make-stage-dir
stage-mach: make-stage-dir stage-mach: make-stage-dir
@(cd $(topsrcdir)/python/mach && tar $(TAR_CREATE_FLAGS) - *) | (cd $(PKG_STAGE)/tools/mach && tar -xf -) @(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) cp $(topsrcdir)/mach $(PKG_STAGE)
stage-mochitest: make-stage-dir ; stage-mochitest: make-stage-dir ;
......
...@@ -56,11 +56,11 @@ def patch_vcs(monkeypatch): ...@@ -56,11 +56,11 @@ def patch_vcs(monkeypatch):
@pytest.fixture(scope="session") @pytest.fixture(scope="session")
def run_mach(): def run_mach():
import mach_bootstrap import mach_initialize
from mach.config import ConfigSettings from mach.config import ConfigSettings
from tryselect.tasks import build from tryselect.tasks import build
mach = mach_bootstrap.bootstrap(build.topsrcdir) mach = mach_initialize.initialize(build.topsrcdir)
def inner(args): def inner(args):
mach.settings = ConfigSettings() mach.settings = ConfigSettings()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment