summaryrefslogtreecommitdiff
path: root/setuptools/package_index.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2018-01-04 20:42:12 -0500
committerGitHub <noreply@github.com>2018-01-04 20:42:12 -0500
commitc0edf9323c1e124ae34f96ccfb7cf21df0f32252 (patch)
tree3e2c19e8371c90d3c0d7fbfb6d8122e47def47de /setuptools/package_index.py
parent7af7f8a68ea4b0f7d45a739273684832fa609935 (diff)
parent85747b8ccc2a2da7ecb59c6aff2561c052c463d2 (diff)
downloadpython-setuptools-git-c0edf9323c1e124ae34f96ccfb7cf21df0f32252.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'setuptools/package_index.py')
-rwxr-xr-xsetuptools/package_index.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index fe2ef50f..ad743307 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -21,13 +21,14 @@ import setuptools
from pkg_resources import (
CHECKOUT_DIST, Distribution, BINARY_DIST, normalize_path, SOURCE_DIST,
Environment, find_distributions, safe_name, safe_version,
- to_filename, Requirement, DEVELOP_DIST,
+ to_filename, Requirement, DEVELOP_DIST, EGG_DIST,
)
from setuptools import ssl_support
from distutils import log
from distutils.errors import DistutilsError
from fnmatch import translate
from setuptools.py27compat import get_all_headers
+from setuptools.wheel import Wheel
EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$')
HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I)
@@ -115,6 +116,17 @@ def distros_for_location(location, basename, metadata=None):
if basename.endswith('.egg') and '-' in basename:
# only one, unambiguous interpretation
return [Distribution.from_location(location, basename, metadata)]
+ if basename.endswith('.whl') and '-' in basename:
+ wheel = Wheel(basename)
+ if not wheel.is_compatible():
+ return []
+ return [Distribution(
+ location=location,
+ project_name=wheel.project_name,
+ version=wheel.version,
+ # Increase priority over eggs.
+ precedence=EGG_DIST + 1,
+ )]
if basename.endswith('.exe'):
win_base, py_ver, platform = parse_bdist_wininst(basename)
if win_base is not None: