aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/package_index.py
diff options
context:
space:
mode:
authorBenoit Pierre <benoit.pierre@gmail.com>2017-11-02 21:19:39 +0100
committerBenoit Pierre <benoit.pierre@gmail.com>2017-11-26 13:19:48 +0100
commit118edbb2b715c96620b51018c1d28e81f2318053 (patch)
treedbac555fe8af490e6dcd9d097b1fcb590652c70f /setuptools/package_index.py
parentdce4750aed2d5b0a4ba677b0e308cd10dca2f6ee (diff)
downloadexternal_python_setuptools-118edbb2b715c96620b51018c1d28e81f2318053.tar.gz
external_python_setuptools-118edbb2b715c96620b51018c1d28e81f2318053.tar.bz2
external_python_setuptools-118edbb2b715c96620b51018c1d28e81f2318053.zip
easy_install: add support for installing from wheels
Note: wheels are installed as eggs, so each install is self-contained and multiple versions of the same package can be installed at the same time. Limitations: - headers are not supported - resulting egg metadata requirements have their markers stripped
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: