Commit b907432b authored by Alex Hochheiden's avatar Alex Hochheiden
Browse files

Bug 1732228 - Add the default pip to the venv so we can use that to install...

Bug 1732228 - Add the default pip to the venv so we can use that to install the specific version of pip from the in-tree wheel r=firefox-build-system-reviewers,glandium

- We can't use the `pip` from source that's in-tree, since that is no longer a supported entry point of pip.
- We can't use the `pip` wheel to install itself, since that is no longer supported either.
- We can't create the venv with the default `pip`, because that fails on Windows10 in CI.
- We can create the venv with `--without-pip` and then run `ensurepip --default-pip` to get a version of `pip` in all contexts that can install the wheel of `pip` that's in-tree.

Depends on D171176

Differential Revision: https://phabricator.services.mozilla.com/D171177
parent 3739a0dc
Loading
Loading
Loading
Loading
+12 −11
Original line number Diff line number Diff line
@@ -531,10 +531,6 @@ class VirtualenvMixin(object):
                                    sys.executable, str(expected_python_debug_exe)
                                )

            # We install "--without-pip" since the version of pip bundled with
            # python is not consistent across versions/platforms and could be
            # incompatible. We don't use "--upgrade" to get the newest pip
            # since that would tie us to pypy being available, which we don't want.
            self.mkdir_p(dirs["abs_work_dir"])
            self.run_command(
                [sys.executable, "-m", "venv", "--without-pip", venv_path],
@@ -543,6 +539,16 @@ class VirtualenvMixin(object):
                halt_on_failure=True,
            )

            # To workaround an issue on Windows10 jobs in CI we have to
            # explicitly install the default pip separately. Ideally we
            # could just remove the "--without-pip" above and get the same
            # result, but that's apparently not always the case.
            self.run_command(
                [str(venv_python_bin), "-m", "ensurepip", "--default-pip"],
                cwd=dirs["abs_work_dir"],
                halt_on_failure=True,
            )

            self._ensure_python_exe(venv_python_bin.parent)

            # We can work around a bug on some versions of Python 3.6 on
@@ -559,16 +565,11 @@ class VirtualenvMixin(object):
                    new_venv_config = Path(venv_path) / "pyvenv.cfg"
                    shutil.copyfile(str(this_venv_config), str(new_venv_config))

            # Since we didn't install pip, we can use the pip wheel directly
            # to install pip itself, and setuptools afterwards. Doing this "self
            # install" is faster than letting venv install the bundled pip only
            # to uninstall it when it installs this vendored pip wheel. We set the
            pip_path = pip_wheel_path / "pip"

            self.run_command(
                [
                    str(venv_python_bin),
                    str(pip_path),
                    "-m",
                    "pip",
                    "install",
                    "--only-binary",
                    ":all:",