From 20eb01f0cac85e0f6a280a8127a872572a53ec9b Mon Sep 17 00:00:00 2001 From: Donald Stufft Date: Wed, 17 Dec 2014 20:52:37 -0500 Subject: Add a PEP440Warning to make it easier to silence these warnings --- pkg_resources.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg_resources.py b/pkg_resources.py index f3ac6c50..87fd2782 100644 --- a/pkg_resources.py +++ b/pkg_resources.py @@ -80,6 +80,13 @@ import setuptools._vendor.packaging.specifiers packaging = setuptools._vendor.packaging +class PEP440Warning(RuntimeWarning): + """ + Used when there is an issue with a version or specifier not complying with + PEP 440. + """ + + class _SetuptoolsVersionMixin(object): def __hash__(self): @@ -272,6 +279,9 @@ __all__ = [ 'ResolutionError', 'VersionConflict', 'DistributionNotFound', 'UnknownExtra', 'ExtractionError', + # Warnings + 'PEP440Warning', + # Parsing functions and string utilities 'parse_requirements', 'parse_version', 'safe_name', 'safe_version', 'get_platform', 'compatible_platforms', 'yield_lines', 'split_sections', @@ -2430,7 +2440,7 @@ class Distribution(object): "versions." % ( self.project_name, self.version, ), - RuntimeWarning, + PEP440Warning, ) return self._parsed_version -- cgit v1.2.1