Imported Upstream version 65.6.3 upstream/65.6.3
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:58 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:58 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
setup.cfg
setuptools/logging.py
setuptools/tests/test_logging.py

index db5a5c5c17544353b1f2d220390bea9d1d759b36..38dbe69f1b1ddd997e075c37794d6f613dee2ccd 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 65.6.2
+current_version = 65.6.3
 commit = True
 tag = True
 
index 6d57c8fb98f2ee3cdbf32a36f26e2bf1464b88aa..4f4ede6a66bc67430ce71f6b3713ab2f7f9d6964 100644 (file)
@@ -1,3 +1,13 @@
+v65.6.3
+-------
+
+
+Misc
+^^^^
+* #3709: Fix condition to patch ``distutils.dist.log`` to only apply when using
+  ``distutils`` from the stdlib.
+
+
 v65.6.2
 -------
 
index 0e18e067f714313ab15217430b86dbefbabc423f..99c1bece554483c0402de3bd070cfe7a1e61bd7f 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 65.6.2
+version = 65.6.3
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
index e99c1b9d504d149ccabbeb33dae04dff786078ec..0653878fc03551eecd8c10a3a251da98c1b46a47 100644 (file)
@@ -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,
index a5ddd56df05855316aa1a1256e88ec20b0b768b9..aa2b502b6c8eaed4fb077bac438af9564a0c56b0 100644 (file)
@@ -1,4 +1,6 @@
+import inspect
 import logging
+import os
 
 import pytest
 
@@ -34,3 +36,18 @@ def test_verbosity_level(tmp_path, monkeypatch, flag, expected_level):
     log_level = logger.getEffectiveLevel()
     log_level_name = logging.getLevelName(log_level)
     assert log_level_name == expected_level
+
+
+def test_patching_does_not_cause_problems():
+    # Ensure `dist.log` is only patched if necessary
+
+    import setuptools.logging
+    from distutils import dist
+
+    setuptools.logging.configure()
+
+    if os.getenv("SETUPTOOLS_USE_DISTUTILS", "local").lower() == "local":
+        # Modern logging infra, no problematic patching.
+        assert isinstance(dist.log, logging.Logger)
+    else:
+        assert inspect.ismodule(dist.log)