summaryrefslogtreecommitdiff
path: root/setuptools/logging.py
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-01-22 12:56:09 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-01-22 12:56:09 +0000
commit0d491c616284933e35bb5d61a94828aed0c8d3f2 (patch)
treed74bae0465eb98a3e38db0d8fc644b5a9ffd3a68 /setuptools/logging.py
parent518004161ff408826428b0584f8f91b8e08fdc45 (diff)
downloadpython-setuptools-git-0d491c616284933e35bb5d61a94828aed0c8d3f2.tar.gz
Fix weird distutils.log reloading/caching situation
For some reason `distutils.log` module is getting cached in `distutils.dist` and then loaded again when we have the opportunity to patch it. This implies: id(distutils.log) != id(distutils.dist.log). We need to make sure the same module object is used everywhere.
Diffstat (limited to 'setuptools/logging.py')
-rw-r--r--setuptools/logging.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/setuptools/logging.py b/setuptools/logging.py
index dbead6e6..56669c96 100644
--- a/setuptools/logging.py
+++ b/setuptools/logging.py
@@ -24,6 +24,12 @@ def configure():
format="{message}", style='{', handlers=handlers, level=logging.DEBUG)
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 we have the opportunity to patch it.
+ # This implies: id(distutils.log) != id(distutils.dist.log).
+ # We need to make sure the same module object is used everywhere:
+ distutils.dist.log = distutils.log
+
def set_threshold(level):
logging.root.setLevel(level*10)