aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus Smith <qwcode@gmail.com>2014-01-04 18:58:03 -0800
committerMarcus Smith <qwcode@gmail.com>2014-01-04 18:58:03 -0800
commitb7b28d118a55f4738c593055b9fcc30c2e8b4b59 (patch)
tree482436e5d76378ec6661dfab505e184e33377235
parent465f771654baf972034a4e21648bac48ec132f3d (diff)
downloadexternal_python_setuptools-b7b28d118a55f4738c593055b9fcc30c2e8b4b59.tar.gz
external_python_setuptools-b7b28d118a55f4738c593055b9fcc30c2e8b4b59.tar.bz2
external_python_setuptools-b7b28d118a55f4738c593055b9fcc30c2e8b4b59.zip
convert "find_in_zip" into "find_eggs_in_zip" to prevent it from walking whl files
this specifically prevents a failure when wheels are nested under an egg dir https://bitbucket.org/pypa/setuptools/issue/129 --HG-- branch : zip_path
-rw-r--r--pkg_resources.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index efe5d34d..39881b56 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1717,7 +1717,14 @@ def find_distributions(path_item, only=False):
finder = _find_adapter(_distribution_finders, importer)
return finder(importer, path_item, only)
-def find_in_zip(importer, path_item, only=False):
+def find_eggs_in_zip(importer, path_item, only=False):
+ """
+ Find eggs in zip files; possibly multiple nested eggs.
+ """
+ if importer.archive.endswith('.whl'):
+ # wheels are not supported with this finder
+ # they don't have PKG-INFO metadata, and won't ever contain eggs
+ return
metadata = EggMetadata(importer)
if metadata.has_metadata('PKG-INFO'):
yield Distribution.from_filename(path_item, metadata=metadata)
@@ -1726,10 +1733,10 @@ def find_in_zip(importer, path_item, only=False):
for subitem in metadata.resource_listdir('/'):
if subitem.endswith('.egg'):
subpath = os.path.join(path_item, subitem)
- for dist in find_in_zip(zipimport.zipimporter(subpath), subpath):
+ for dist in find_eggs_in_zip(zipimport.zipimporter(subpath), subpath):
yield dist
-register_finder(zipimport.zipimporter, find_in_zip)
+register_finder(zipimport.zipimporter, find_eggs_in_zip)
def find_nothing(importer, path_item, only=False):
return ()