-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Labels
Needs DiscussionIssues where the implementation still needs to be discussed.Issues where the implementation still needs to be discussed.bug
Description
When using platform-specific dependencies as documented in setuptools docs, I am running into an issue:
In Python 3.7
>>> import pkg_resources as pr
>>> pr.get_distribution('doesntexist;python_version<"3.0"')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/users/is/fsaraviarajal/workspace/conda_envs_test/test3_offlinecopyof2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 479, in get_distribution
dist = get_provider(dist)
File "/users/is/fsaraviarajal/workspace/conda_envs_test/test3_offlinecopyof2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 355, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
IndexError: list index out of range
However, when the dependency is for the version of python we are running on, the outcome is as expected
>>> pr.get_distribution('doesntexist;python_version>"3.0"')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/users/is/fsaraviarajal/workspace/conda_envs_test/test3_offlinecopyof2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 479, in get_distribution
dist = get_provider(dist)
File "/users/is/fsaraviarajal/workspace/conda_envs_test/test3_offlinecopyof2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 355, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/users/is/fsaraviarajal/workspace/conda_envs_test/test3_offlinecopyof2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 898, in require
needed = self.resolve(parse_requirements(requirements))
File "/users/is/fsaraviarajal/workspace/conda_envs_test/test3_offlinecopyof2/lib/python3.7/site-packages/pkg_resources/__init__.py", line 784, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'doesntexist; python_version > "3.0"' distribution was not found and is required by the application
I have reproduced this on versions of 28.8.0 and 40.7.3 of setuptools
The exception IndexError: list index out of range
comes from this line:
setuptools/pkg_resources/__init__.py
Line 357 in c1243e9
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0] |
Metadata
Metadata
Assignees
Labels
Needs DiscussionIssues where the implementation still needs to be discussed.Issues where the implementation still needs to be discussed.bug