diff --git a/changelog.d/3693.bugfix.rst b/changelog.d/3693.bugfix.rst new file mode 100644 index 0000000000..53f64ccf75 --- /dev/null +++ b/changelog.d/3693.bugfix.rst @@ -0,0 +1 @@ +Merge pypa/distutils@3e9d47e with compatibility fix for distutils.log.Log. diff --git a/setuptools/_distutils/log.py b/setuptools/_distutils/log.py index bb789c300d..239f315850 100644 --- a/setuptools/_distutils/log.py +++ b/setuptools/_distutils/log.py @@ -5,6 +5,7 @@ """ import logging +import warnings from ._log import log as _global_log @@ -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