Skip to content

Commit

Permalink
Find .egg-info in zipimport too
Browse files Browse the repository at this point in the history
Fixes #2489
  • Loading branch information
thatch committed Dec 16, 2020
1 parent d671fc5 commit e65cd89
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelog.d/2489.change.rst
@@ -0,0 +1,2 @@
``pkg_resources`` behavior for zipimport now matches the regular behavior, and finds
``.egg-info`` (previoulsy would only find ``.dist-info``) -- by :user:`thatch`
3 changes: 2 additions & 1 deletion pkg_resources/__init__.py
Expand Up @@ -1978,12 +1978,13 @@ def find_eggs_in_zip(importer, path_item, only=False):
# don't yield nested distros
return
for subitem in metadata.resource_listdir(''):
lower = subitem.lower()
if _is_egg_path(subitem):
subpath = os.path.join(path_item, subitem)
dists = find_eggs_in_zip(zipimport.zipimporter(subpath), subpath)
for dist in dists:
yield dist
elif subitem.lower().endswith('.dist-info'):
elif any(map(lower.endswith, ('.dist-info', '.egg-info'))):
subpath = os.path.join(path_item, subitem)
submeta = EggMetadata(zipimport.zipimporter(subpath))
submeta.egg_info = subpath
Expand Down

0 comments on commit e65cd89

Please sign in to comment.