Bug 1764836: Mercurial update is now compatible with MozillaBuild 4.0 r=ahal

MozillaBuild 4.0 now uses `hg` with Python 3, so use Python 3's `pip`
accordingly.

Differential Revision: https://phabricator.services.mozilla.com/D143921
This commit is contained in:
Mitchell Hentges 2022-04-19 19:10:11 +00:00
parent 4f436e2298
commit d1eb9a0470

View File

@ -143,7 +143,27 @@ class MozillaBuildBootstrapper(BaseBootstrapper):
# Mercurial upstream sometimes doesn't upload wheels, and building
# from source requires MS Visual C++ 9.0. So we force pip to install
# the last version that comes with wheels.
self.pip_install("mercurial", "--only-binary", "mercurial")
with open(Path(os.environ["MOZILLABUILD"]) / "VERSION") as f:
major, minor = (int(v) for v in f.read().split("."))
if major >= 4:
pip_dir = (
Path(os.environ["MOZILLABUILD"]) / "python3" / "Scripts" / "pip.exe"
)
else:
pip_dir = (
Path(os.environ["MOZILLABUILD"]) / "python" / "Scripts" / "pip.exe"
)
command = [
str(pip_dir),
"install",
"--upgrade",
"mercurial",
"--only-binary",
"mercurial",
]
self.run(command)
def install_browser_packages(self, mozconfig_builder):
pass
@ -246,10 +266,3 @@ class MozillaBuildBootstrapper(BaseBootstrapper):
def run(self, command):
subprocess.check_call(command, stdin=sys.stdin)
def pip_install(self, *packages):
pip_dir = Path(os.environ["MOZILLABUILD"]) / "python" / "Scripts" / "pip.exe"
command = [str(pip_dir), "install", "--upgrade"]
command.extend(packages)
self.run(command)