diff options
| author | Tim Hatch <thatch@fb.com> | 2020-12-14 09:14:45 -0800 |
|---|---|---|
| committer | Tim Hatch <thatch@fb.com> | 2020-12-21 12:50:42 -0800 |
| commit | c3019cf01e7f3d61f8fa41143e40546247292045 (patch) | |
| tree | b652a3fa38fdf8243449a6063e546e29201baffa | |
| parent | 44d45ae20a663f1cb75812657cee1244e3dddb58 (diff) | |
| download | python-setuptools-git-c3019cf01e7f3d61f8fa41143e40546247292045.tar.gz | |
Find .egg-info in zipimport too
Fixes #2489
| -rw-r--r-- | changelog.d/2489.change.rst | 2 | ||||
| -rw-r--r-- | pkg_resources/__init__.py | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/changelog.d/2489.change.rst b/changelog.d/2489.change.rst new file mode 100644 index 00000000..40eddbe7 --- /dev/null +++ b/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` diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 737f4d5f..ba90c8c4 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -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 |
