diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2021-10-31 21:09:54 -0400 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2021-10-31 21:37:48 -0400 |
| commit | 84b1cd8e7760a9b3c984a4edfc37dc7266952266 (patch) | |
| tree | 45ec898ae86857fec79e1bede051713aeba1e21d | |
| parent | 96475e3b3af4e0a0166cdb75c976ce07cfd44fce (diff) | |
| download | python-setuptools-git-84b1cd8e7760a9b3c984a4edfc37dc7266952266.tar.gz | |
Raise a deprecation warning when an invalid version is encountered. Ref #2497. Ref #2822.
| -rw-r--r-- | changelog.d/2497.change.rst | 1 | ||||
| -rw-r--r-- | pkg_resources/__init__.py | 5 | ||||
| -rw-r--r-- | pytest.ini | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/changelog.d/2497.change.rst b/changelog.d/2497.change.rst new file mode 100644 index 00000000..91d840f7 --- /dev/null +++ b/changelog.d/2497.change.rst @@ -0,0 +1 @@ +Officially deprecated PEP 440 non-compliant versions. diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index c84f1dd9..3aafe652 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -113,6 +113,11 @@ def parse_version(v): try: return packaging.version.Version(v) except packaging.version.InvalidVersion: + warnings.warn( + f"{v} is an invalid version and will not be supported in " + "a future release", + PkgResourcesDeprecationWarning, + ) return packaging.version.LegacyVersion(v) @@ -31,3 +31,6 @@ filterwarnings= # https://github.com/pypa/setuptools/issues/917 ignore:setup.py install is deprecated. ignore:easy_install command is deprecated. + + # https://github.com/pypa/setuptools/issues/2497 + ignore:.* is an invalid version and will not be supported::pkg_resources |
