mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
unpack_file should use flatten=False for .whl files GH1011
This commit is contained in:
parent
3ea56eaecd
commit
42102e9dea
|
@ -589,8 +589,9 @@ def unpack_file(filename, location, content_type, link):
|
|||
if (content_type == 'application/zip'
|
||||
or filename.endswith('.zip')
|
||||
or filename.endswith('.pybundle')
|
||||
or filename.endswith('.whl')
|
||||
or zipfile.is_zipfile(filename)):
|
||||
unzip_file(filename, location, flatten=not filename.endswith('.pybundle'))
|
||||
unzip_file(filename, location, flatten=not filename.endswith(('.pybundle', 'whl')))
|
||||
elif (content_type == 'application/x-gzip'
|
||||
or tarfile.is_tarfile(filename)
|
||||
or splitext(filename)[1].lower() in ('.tar', '.tar.gz', '.tar.bz2', '.tgz', '.tbz')):
|
||||
|
|
|
@ -79,8 +79,9 @@ Upper-[12].0.tar.gz and requiresuppper-1.0.tar.gz
|
|||
'requiresupper' requires 'upper'
|
||||
used for testing case mismatch case for url requirements
|
||||
|
||||
|
||||
|
||||
meta-1.0-py2.py3-none-any.whl
|
||||
--------------------------------------------------
|
||||
Is an empty package which install_requires the simple and simple2 packages.
|
||||
|
||||
|
||||
|
||||
|
|
BIN
tests/data/packages/meta-1.0-py2.py3-none-any.whl
Normal file
BIN
tests/data/packages/meta-1.0-py2.py3-none-any.whl
Normal file
Binary file not shown.
|
@ -137,3 +137,20 @@ class TestWheelFile(object):
|
|||
w = wheel.Wheel('simple-0.1-py2-none-any.whl')
|
||||
assert w.support_index_min() == None
|
||||
|
||||
def test_unpack_wheel_no_flatten(self):
|
||||
from pip import util
|
||||
from tempfile import mkdtemp
|
||||
from shutil import rmtree
|
||||
import os
|
||||
from nose import SkipTest
|
||||
|
||||
filepath = '../data/packages/meta-1.0-py2.py3-none-any.whl'
|
||||
if not os.path.exists(filepath):
|
||||
raise SkipTest
|
||||
try:
|
||||
tmpdir = mkdtemp()
|
||||
util.unpack_file(filepath, tmpdir, 'application/zip', None )
|
||||
assert os.path.isdir(os.path.join(tmpdir,'meta-1.0.dist-info'))
|
||||
finally:
|
||||
rmtree(tmpdir)
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue