Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pypa/distutils@3e9d47e with fix for distutils.log. #3705

Merged
merged 5 commits into from Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/3693.bugfix.rst
@@ -0,0 +1 @@
Merge pypa/distutils@3e9d47e with compatibility fix for distutils.log.Log.
19 changes: 19 additions & 0 deletions setuptools/_distutils/log.py
Expand Up @@ -5,6 +5,7 @@
"""

import logging
import warnings

from ._log import log as _global_log

Expand Down Expand Up @@ -36,3 +37,21 @@ def set_verbosity(v):
set_threshold(logging.INFO)
elif v >= 2:
set_threshold(logging.DEBUG)


class Log(logging.Logger):
"""distutils.log.Log is deprecated, please use an alternative from `logging`."""

def __init__(self, threshold=WARN):
warnings.warn(Log.__doc__) # avoid DeprecationWarning to ensure warn is shown
super().__init__(__name__, level=threshold)

@property
def threshold(self):
return self.level

@threshold.setter
def threshold(self, level):
self.setLevel(level)

warn = logging.Logger.warning