summaryrefslogtreecommitdiff
path: root/pip/req.py
diff options
context:
space:
mode:
authorMarcus Smith <qwcode@gmail.com>2013-11-14 16:35:24 -0800
committerMarcus Smith <qwcode@gmail.com>2013-11-14 16:35:24 -0800
commit3dc40cad46525ad084559744ab28e36c90a2477b (patch)
tree068ab23a1aac8803bcdb2ac9039c99227057b2b3 /pip/req.py
parent9f94221ff662898dfbd10d76d6c355883954ee47 (diff)
downloadpip-3dc40cad46525ad084559744ab28e36c90a2477b.tar.gz
- if installing directly from a wheel, fail if it has an invalid name or is unsupported
- when walking links, skip invalid wheel filenames, don't crash
Diffstat (limited to 'pip/req.py')
-rw-r--r--pip/req.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/pip/req.py b/pip/req.py
index 1b28b51c8..4e1e1d92e 100644
--- a/pip/req.py
+++ b/pip/req.py
@@ -12,8 +12,8 @@ import zipfile
from distutils.util import change_root
from pip.locations import (bin_py, running_under_virtualenv,PIP_DELETE_MARKER_FILENAME,
write_delete_marker_file)
-from pip.exceptions import (InstallationError, UninstallationError,
- BestVersionAlreadyInstalled,
+from pip.exceptions import (InstallationError, UninstallationError, UnsupportedWheel,
+ BestVersionAlreadyInstalled, InvalidWheelFilename,
DistributionNotFound, PreviousBuildDirError)
from pip.vcs import vcs
from pip.log import logger
@@ -32,7 +32,7 @@ from pip.download import (PipSession, get_file_content, is_url, url_to_path,
unpack_vcs_link, is_vcs_url, is_file_url,
unpack_file_url, unpack_http_url)
import pip.wheel
-from pip.wheel import move_wheel_files
+from pip.wheel import move_wheel_files, Wheel, wheel_ext
class InstallRequirement(object):
@@ -133,6 +133,12 @@ class InstallRequirement(object):
if link.scheme == 'file' and re.search(r'\.\./', url):
url = path_to_url(os.path.normpath(os.path.abspath(link.path)))
+ # fail early for invalid or unsupported wheels
+ if link.ext == wheel_ext:
+ wheel = Wheel(link.filename) # can raise InvalidWheelFilename
+ if not wheel.supported():
+ raise UnsupportedWheel("%s is not a supported wheel on this platform." % wheel.filename)
+
else:
req = name