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 | 68bcfecf36ca0af76b76d15abfffa6403b2d6f54 (patch) | |
| tree | ade8a70b67aa8bf1898898b6b6da797ae6d33ce1 | |
| parent | b3203c3fd58476f0bead1436bf83ef05d3288d26 (diff) | |
| download | python-setuptools-git-68bcfecf36ca0af76b76d15abfffa6403b2d6f54.tar.gz | |
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 a3eef28f..8fec29e1 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -2303,6 +2303,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 |
