diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-10 16:18:22 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-05-10 16:18:22 -0400 |
| commit | 5638e4783fc0f4f5cc40e7ecfab0500983826fa0 (patch) | |
| tree | e681fe0fdc04eea980540cc61b398f033a7b3513 | |
| parent | 7b0a818f9a877d5e1fe558cf1a817bf2034ddf9f (diff) | |
| download | python-setuptools-git-5638e4783fc0f4f5cc40e7ecfab0500983826fa0.tar.gz | |
To assess the directoriness of an entry, include the path of that entry.
| -rw-r--r-- | pkg_resources/__init__.py | 5 | ||||
| -rw-r--r-- | pkg_resources/tests/test_pkg_resources.py | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 0575a989..0512731d 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2072,7 +2072,10 @@ def dist_factory(path_item, entry, only): """Return a dist_factory for the given entry.""" lower = entry.lower() is_egg_info = lower.endswith('.egg-info') - is_dist_info = lower.endswith('.dist-info') and not os.path.isfile(entry) + is_dist_info = ( + lower.endswith('.dist-info') and + os.path.isdir(os.path.join(path_item, entry)) + ) is_meta = is_egg_info or is_dist_info return ( distributions_from_metadata diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 9991402c..189a8668 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -335,7 +335,7 @@ def test_dist_info_is_not_dir(tmp_path, only): """Test path containing a file with dist-info extension.""" dist_info = tmp_path / 'foobar.dist-info' dist_info.touch() - assert not pkg_resources.dist_factory(None, str(dist_info), only) + assert not pkg_resources.dist_factory(str(tmp_path), str(dist_info), only) class TestDeepVersionLookupDistutils: |
