Commit 6d9b7483 authored by Julien Muchembled's avatar Julien Muchembled

Avoid installing eggs from wheels when possible

This relaxes commit ff2ee218
("Do never install from wheels") because for some eggs like plantuml,
there's no tarball.

About the implementation, no need to sort by version (as it was done)
because the list is already filtered to keep the best one.
parent 1aeb4ae0
Pipeline #15454 passed with stage
in 0 seconds
......@@ -39,7 +39,11 @@ import tempfile
import zc.buildout
import warnings
_INF = -float('inf')
WHL_DIST = pkg_resources.EGG_DIST + 1
def dist_key(dist):
key = dist.precedence
return _INF if key == WHL_DIST else key
warnings.filterwarnings(
'ignore', '.+is being parsed as a legacy, non PEP 440, version')
......@@ -547,7 +551,7 @@ class Installer:
# Filter the available dists for the requirement and source flag
dists = [dist for dist in index[requirement.project_name]
if ((dist in requirement)
and dist.precedence != WHL_DIST and
and
((not source) or
(dist.precedence == pkg_resources.SOURCE_DIST)
)
......@@ -589,8 +593,7 @@ class Installer:
):
return dist
best.sort()
return best[-1]
return max(dists, key=dist_key)
def _fetch(self, dist, tmp, download_cache):
if (download_cache
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment