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 /pkg_resources | |
| 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 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 74134701..d8e4c26b 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -238,6 +238,9 @@ __all__ = [ 'register_finder', 'register_namespace_handler', 'register_loader_type', 'fixup_namespace_packages', 'get_importer', + # Warnings + 'PkgResourcesDeprecationWarning', + # Deprecated/backward compatibility only 'run_main', 'AvailableDistributions', ] @@ -2335,7 +2338,7 @@ class EntryPoint: warnings.warn( "Parameters to load are deprecated. Call .resolve and " ".require separately.", - DeprecationWarning, + PkgResourcesDeprecationWarning, stacklevel=2, ) if require: @@ -3158,3 +3161,11 @@ def _initialize_master_working_set(): # match order list(map(working_set.add_entry, sys.path)) globals().update(locals()) + +class PkgResourcesDeprecationWarning(Warning): + """ + Base class for warning about deprecations in ``pkg_resources`` + + This class is not derived from ``DeprecationWarning``, and as such is + visible by default. + """ |
