From 4c267c78a09128dc80be821654dd60b174d53d41 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Wed, 23 Nov 2022 19:43:18 +0000 Subject: [PATCH] Replace condition to patch distutils.dist.log As `distutils.log.Log` was backfilled for compatibility we no longer can use this as a condition. --- setuptools/logging.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setuptools/logging.py b/setuptools/logging.py index e99c1b9d50..0653878fc0 100644 --- a/setuptools/logging.py +++ b/setuptools/logging.py @@ -1,4 +1,5 @@ import sys +import inspect import logging import distutils.log from . import monkey @@ -22,7 +23,7 @@ def configure(): handlers = err_handler, out_handler logging.basicConfig( format="{message}", style='{', handlers=handlers, level=logging.DEBUG) - if hasattr(distutils.log, 'Log'): + if inspect.ismodule(distutils.dist.log): monkey.patch_func(set_threshold, distutils.log, 'set_threshold') # For some reason `distutils.log` module is getting cached in `distutils.dist` # and then loaded again when patched,