From 3423583dff6dc3e11c0a2650e1307fe64a6a6c9c Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 30 Dec 2020 07:08:15 +0900 Subject: [PATCH] Imported Upstream version 49.6.0 --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 ++++++ pkg_resources/__init__.py | 17 ++++++++++++++--- setup.cfg | 2 +- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 7ecebcd..4bbe60c 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 49.5.0 +current_version = 49.6.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 534e15a..2d49707 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v49.6.0 +------- + +* #2129: 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. + + v49.5.0 ------- diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 5927ef0..b585e85 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2056,7 +2056,10 @@ def find_on_path(importer, path_item, only=False): ) return - entries = safe_listdir(path_item) + entries = ( + os.path.join(path_item, child) + for child in safe_listdir(path_item) + ) # for performance, before sorting by version, # screen entries for only those that will yield @@ -2372,7 +2375,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): @@ -2380,7 +2391,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')) ) diff --git a/setup.cfg b/setup.cfg index 7618ab1..3c8f867 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 49.5.0 +version = 49.6.0 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org -- 2.34.1