diff options
author | Junhan Huang <robinhuang@172-2-0-43.lightspeed.dybhfl.sbcglobal.net> | 2018-10-27 16:26:51 -0400 |
---|---|---|
committer | Paul Ganssle <paul@ganssle.io> | 2018-10-28 17:43:24 -0400 |
commit | 5854b0eba03dd257e30efff68f1632bdec5f0416 (patch) | |
tree | 4fa6de7fd235f29e5aca82c86da88d83651f9516 /setuptools/dist.py | |
parent | 29f9cb087fd107f412e2a2f0df877e3b14a75be9 (diff) | |
download | python-setuptools-git-5854b0eba03dd257e30efff68f1632bdec5f0416.tar.gz |
Add custom deprecation warning classes
`DeprecationWarning` is not visible by default in the latest versions of
CPython, so this switches the deprecation warnings in setuptools and
pkg_resources over to custom classes derived from `Warning` instead.
Fixes issue github issue #159
Co-authored-by: Junhan Huang <robin.j.huang@gmail.com>
Co-authored-by: Marton Pono <marci93@gmail.com>
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r-- | setuptools/dist.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index 6ee4a97f..f6078dbe 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -21,6 +21,8 @@ from setuptools.extern import six from setuptools.extern import packaging from setuptools.extern.six.moves import map, filter, filterfalse +from . import SetuptoolsDeprecationWarning + from setuptools.depends import Require from setuptools import windows_support from setuptools.monkey import get_unpatched @@ -33,7 +35,7 @@ __import__('setuptools.extern.packaging.version') def _get_unpatched(cls): - warnings.warn("Do not call this function", DeprecationWarning) + warnings.warn("Do not call this function", DistDeprecationWarning) return get_unpatched(cls) @@ -980,7 +982,7 @@ class Feature: "Features are deprecated and will be removed in a future " "version. See https://github.com/pypa/setuptools/issues/65." ) - warnings.warn(msg, DeprecationWarning, stacklevel=3) + warnings.warn(msg, DistDeprecationWarning, stacklevel=3) def __init__( self, description, standard=False, available=True, @@ -1069,3 +1071,7 @@ class Feature: " doesn't contain any packages or modules under %s" % (self.description, item, item) ) + + +class DistDeprecationWarning(SetuptoolsDeprecationWarning): + """Class for warning about deprecations in dist in setuptools. Not ignored by default, unlike DeprecationWarning.""" |