Skip to content

Commit

Permalink
Merged in qwcode/setuptools/zip_path (pull request #32)
Browse files Browse the repository at this point in the history
convert "find_in_zip" into "find_eggs_in_zip" to prevent it from walking whl files. Fixes #129
  • Loading branch information
jaraco committed Jan 7, 2014
2 parents 818e80e + b7b28d1 commit 7de6148
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 ()
Expand Down

0 comments on commit 7de6148

Please sign in to comment.