diff options
author | Donald Stufft <donald@stufft.io> | 2014-12-13 15:52:17 -0500 |
---|---|---|
committer | Donald Stufft <donald@stufft.io> | 2014-12-13 15:52:17 -0500 |
commit | 3c81a300356155761880d81a8445bd39581d6c85 (patch) | |
tree | ab82d97a53a696025e330a318fe224db7da10b0c | |
parent | ee2cd1464e2073ba37be8e3003536f2602d51b13 (diff) | |
download | external_python_setuptools-3c81a300356155761880d81a8445bd39581d6c85.tar.gz external_python_setuptools-3c81a300356155761880d81a8445bd39581d6c85.tar.bz2 external_python_setuptools-3c81a300356155761880d81a8445bd39581d6c85.zip |
Add a warning when version is parsed as legacy
-rw-r--r-- | pkg_resources.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/pkg_resources.py b/pkg_resources.py index 4c7924b7..5af4c869 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -2413,6 +2413,17 @@ class Distribution(object): def parsed_version(self): if not hasattr(self, "_parsed_version"): self._parsed_version = parse_version(self.version) + if isinstance( + self._parsed_version, packaging.version.LegacyVersion): + warnings.warn( + "'%s (%s)' is being parsed as a legacy, non PEP 440, " + "version. You may find odd behavior and sort order. In " + "particular it will be sorted as less than 0.0. It is " + "recommend to migrate to PEP 440 compatible versions." % ( + self.project_name, self.version, + ), + RuntimeWarning, + ) return self._parsed_version |