1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge pull request #1158 from qwcode/fix_1150

we'll assume '_' means '-' in versions from wheel filenames
This commit is contained in:
Marcus Smith 2013-08-21 23:57:18 -07:00
commit 4a722c6eba
2 changed files with 11 additions and 1 deletions

View file

@ -246,7 +246,9 @@ class Wheel(object):
wheel_info = self.wheel_file_re.match(filename)
self.filename = filename
self.name = wheel_info.group('name').replace('_', '-')
self.version = wheel_info.group('ver')
# we'll assume "_" means "-" due to wheel naming scheme
# (https://github.com/pypa/pip/issues/1150)
self.version = wheel_info.group('ver').replace('_', '-')
self.pyversions = wheel_info.group('pyver').split('.')
self.abis = wheel_info.group('abi').split('.')
self.plats = wheel_info.group('plat').split('.')

View file

@ -163,6 +163,14 @@ class TestWheelFile(object):
for name, path, expected in packages:
assert wheel.root_is_purelib(name, path) == expected
def test_version_underscore_conversion(self):
"""
Test that we convert '_' to '-' for versions parsed out of wheel filenames
"""
w = wheel.Wheel('simple-0.1_1-py2-none-any.whl')
assert w.version == '0.1-1'
class TestPEP425Tags(object):
def test_broken_sysconfig(self):