Bug 1730712: Remove pip package check in site.up_to_date() r=ahal

Sorry for the flip-flop on technique here :S

`validate_environment_packages()` was originally run when checking if a
site is up-to-date to ensure that ad-hoc pip installs didn't replace
needed packages with those of different versions.

However, since it was added, a few notes have come up:
1. The case where requirements change isn't caught by this - that is
  caught earlier by the cheap "a requirements file has changed on-disk"
  check.
2. This is really slow, and doing it for most Mach commands is not worth
  it (as evident by how the `skip_pip_package_check` was already added
  for the Mach site's use case).
3. Since the tree as-is doesn't have (common) cases where ad-hoc
  installations break an environment, then this check, though helpful,
  isn't adding a significant amount of value considering its performance
  cost.

However, these aren't to say that this won't be valuable in the future:
I'd like to reach a point where sites are considered "sealed" by
default: no ad-hoc pip installations are allowed.
However, add the ability to mark sites as unsealed/"allowing
ad-hoc pip installations". Then, re-add the pip package check, but only
for such flexible, unsealed virtualenvs.

Differential Revision: https://phabricator.services.mozilla.com/D129692
This commit is contained in:
Mitchell Hentges
2021-11-17 20:54:26 +00:00
parent 64450314a7
commit 58240e566f
2 changed files with 3 additions and 14 deletions

View File

@@ -266,7 +266,7 @@ def _activate_python_environment(topsrcdir, state_dir):
# to be affected by such installs, and since it takes ~400ms to get the list
# of installed pip packages (a *lot* of time to wait during Mach init), we
# skip verifying that our pip packages exist.
if not mach_site.up_to_date(skip_pip_package_check=True):
if not mach_site.up_to_date():
print(
'The "mach" virtualenv is not up-to-date, please run '
'"./mach create-mach-environment"'