forked from mirrors/gecko-dev
Now that are prioritizing system over virtualenv site-packages, the system `pip` is sometimes being used instead. This is causing issues when the system pip is set up in a distro-specific way, such as when "debundled": https://github.com/pypa/pip/blob/9.0.1/pip/_vendor/__init__.py#L53-L61 However, if we vendor `pip`, `setuptools` and `wheel`, and ensure that they're prioritized in the `sys.path` before anything is imported from the system, then we can ensure that we're using a modern `pip` _and_ sidestep system-specific pip weirdness. Note that `pip-compile`'s `--allow-unsafe` flag is not as dangerous as it sounds. There's confusion among maintainers about its origin: https://github.com/jazzband/pip-tools/issues/522 Additionally, it's going to be enabled by default in a future `pip-tools` release. So, it's not scary for us to embrace here. Also, heads up that the "pip outdated warning" no longer needs to be manually silenced, since pip avoids that code path when not running from an "installed" context. Differential Revision: https://phabricator.services.mozilla.com/D127182
25 lines
949 B
Python
25 lines
949 B
Python
from distutils.dep_util import newer_group
|
|
|
|
|
|
# yes, this is was almost entirely copy-pasted from
|
|
# 'newer_pairwise()', this is just another convenience
|
|
# function.
|
|
def newer_pairwise_group(sources_groups, targets):
|
|
"""Walk both arguments in parallel, testing if each source group is newer
|
|
than its corresponding target. Returns a pair of lists (sources_groups,
|
|
targets) where sources is newer than target, according to the semantics
|
|
of 'newer_group()'.
|
|
"""
|
|
if len(sources_groups) != len(targets):
|
|
raise ValueError(
|
|
"'sources_group' and 'targets' must be the same length")
|
|
|
|
# build a pair of lists (sources_groups, targets) where source is newer
|
|
n_sources = []
|
|
n_targets = []
|
|
for i in range(len(sources_groups)):
|
|
if newer_group(sources_groups[i], targets[i]):
|
|
n_sources.append(sources_groups[i])
|
|
n_targets.append(targets[i])
|
|
|
|
return n_sources, n_targets
|