diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-28 07:03:19 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-28 07:22:30 -0400 |
| commit | 965ec0df1ffa98ba5d8913a2770daaf5b92b0a0d (patch) | |
| tree | 9688bd33eb19b9f303431656aa5fafd6c31b1014 /pkg_resources | |
| parent | 11051abd79b04782d759720a4d9dac2d2bbbf49c (diff) | |
| download | python-setuptools-git-965ec0df1ffa98ba5d8913a2770daaf5b92b0a0d.tar.gz | |
In pkg_resources, no longer detect any pathname ending in .egg as a Python egg. Now the path must be an unpacked egg or a zip file. Fixes #2129.
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 2e7d5059..3c826eb0 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2373,7 +2373,15 @@ def _is_egg_path(path): """ Determine if given path appears to be an egg. """ - return path.lower().endswith('.egg') + return _is_zip_egg(path) or _is_unpacked_egg(path) + + +def _is_zip_egg(path): + return ( + path.lower().endswith('.egg') and + os.path.isfile(path) and + zipfile.is_zipfile(path) + ) def _is_unpacked_egg(path): @@ -2381,7 +2389,7 @@ def _is_unpacked_egg(path): Determine if given path appears to be an unpacked egg. """ return ( - _is_egg_path(path) and + path.lower().endswith('.egg') and os.path.isfile(os.path.join(path, 'EGG-INFO', 'PKG-INFO')) ) |
