Bug 1755516: Add "common" to PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS r=ahal

There are cases in CI where we're using the system Python, but we
still want to create a virtualenv. For example, build jobs use the
system Python packages, but Mozharness wants to have access to Mach
packages. So, a virtualenv needs to be created (the `"common"`
virtualenv), whose associated `python` binary is used to invoke
Mozharness.

So, just like for the `build` site, allow creating the `common`
site even when the "native package source" is the system Python.

Since `mach_virtualenv_requirements.txt` already depends on
`common_virtualenv_requirements.txt`, this restriction should not cause
validation breakage.

Differential Revision: https://phabricator.services.mozilla.com/D140255
This commit is contained in:
Mitchell Hentges 2022-03-10 20:41:54 +00:00
parent 70e8dc46bd
commit 98bdea23c9
2 changed files with 5 additions and 4 deletions

View File

@ -165,11 +165,12 @@ variable can be used:
There's a couple restrictions here:
* ``MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE`` only applies to the top-level ``"mach"`` site and the
``"build"`` site. All other sites will use ``pip install`` at run-time as needed.
* ``MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE`` only applies to the top-level ``"mach"`` site,
the ``"common"`` site and the ``"build"`` site. All other sites will use ``pip install`` at
run-time as needed.
* ``MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE="system"`` is not allowed when using any site other
than ``"mach"`` or ``"build"``, because:
than ``"mach"``, ``"common"`` or ``"build"``, because:
* As described in :ref:`package-compatibility` below, packages used by Mach are still
in scope when commands are run, and

View File

@ -34,7 +34,7 @@ METADATA_FILENAME = "moz_virtualenv_metadata.json"
# The following virtualenvs *may* be used in a context where they aren't allowed to
# install pip packages over the network. In such a case, they must access unvendored
# python packages via the system environment.
PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS = ("mach", "build")
PIP_NETWORK_INSTALL_RESTRICTED_VIRTUALENVS = ("mach", "build", "common")
class VirtualenvOutOfDateException(Exception):