Imported Upstream version 60.2.0 upstream/60.2.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:42 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:42 +0000 (17:02 +0900)
52 files changed:
.bumpversion.cfg
CHANGES.rst
_distutils_hack/__init__.py
setup.cfg
setup.py
setuptools/__init__.py
setuptools/_distutils/cygwinccompiler.py
setuptools/_distutils/log.py
setuptools/_distutils/sysconfig.py
setuptools/_distutils/tests/test_archive_util.py
setuptools/_distutils/tests/test_bdist.py
setuptools/_distutils/tests/test_bdist_dumb.py
setuptools/_distutils/tests/test_bdist_msi.py
setuptools/_distutils/tests/test_bdist_rpm.py
setuptools/_distutils/tests/test_bdist_wininst.py
setuptools/_distutils/tests/test_build.py
setuptools/_distutils/tests/test_build_clib.py
setuptools/_distutils/tests/test_build_ext.py
setuptools/_distutils/tests/test_build_py.py
setuptools/_distutils/tests/test_build_scripts.py
setuptools/_distutils/tests/test_check.py
setuptools/_distutils/tests/test_clean.py
setuptools/_distutils/tests/test_cmd.py
setuptools/_distutils/tests/test_config.py
setuptools/_distutils/tests/test_config_cmd.py
setuptools/_distutils/tests/test_core.py
setuptools/_distutils/tests/test_cygwinccompiler.py
setuptools/_distutils/tests/test_dep_util.py
setuptools/_distutils/tests/test_dir_util.py
setuptools/_distutils/tests/test_dist.py
setuptools/_distutils/tests/test_extension.py
setuptools/_distutils/tests/test_file_util.py
setuptools/_distutils/tests/test_filelist.py
setuptools/_distutils/tests/test_install.py
setuptools/_distutils/tests/test_install_data.py
setuptools/_distutils/tests/test_install_headers.py
setuptools/_distutils/tests/test_install_lib.py
setuptools/_distutils/tests/test_install_scripts.py
setuptools/_distutils/tests/test_log.py
setuptools/_distutils/tests/test_msvc9compiler.py
setuptools/_distutils/tests/test_msvccompiler.py
setuptools/_distutils/tests/test_register.py
setuptools/_distutils/tests/test_sdist.py
setuptools/_distutils/tests/test_spawn.py
setuptools/_distutils/tests/test_sysconfig.py
setuptools/_distutils/tests/test_text_file.py
setuptools/_distutils/tests/test_unixccompiler.py
setuptools/_distutils/tests/test_upload.py
setuptools/_distutils/tests/test_util.py
setuptools/_distutils/tests/test_version.py
setuptools/logging.py [new file with mode: 0644]
tox.ini

index e607b2fcc8ae0a540f3e2dbc00ea72b9ec36798a..f696b076be19817f65047c1a9f8699ee035f17da 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 60.1.1
+current_version = 60.2.0
 commit = True
 tag = True
 
index 554ee73ed3e6bc235cdd2457440a9bc0549b5343..59b29fb51eeba6c052422943e9f3212d32aed557 100644 (file)
@@ -1,3 +1,18 @@
+v60.2.0
+-------
+
+
+Changes
+^^^^^^^
+* #2974: Setuptools now relies on the Python logging infrastructure to log messages. Instead of using ``distutils.log.*``, use ``logging.getLogger(name).*``.
+* #2987: Sync with pypa/distutils@2def21c5d74fdd2fe7996ee4030ac145a9d751bd, including fix for missing get_versions attribute (#2969), more reliance on sysconfig from stdlib.
+
+Misc
+^^^^
+* #2962: Avoid attempting to use local distutils when the presiding version of Setuptools on the path doesn't have one.
+* #2983: Restore 'add_shim' as the way to invoke the hook. Avoids compatibility issues between different versions of Setuptools with the distutils local implementation.
+
+
 v60.1.1
 -------
 
index 55ea082565390a65a728d9f268cdb086b08c5667..c0170d0908ff6319a145e088d9b27d74f9bdab5b 100644 (file)
@@ -86,17 +86,23 @@ class DistutilsMetaFinder:
         import importlib.abc
         import importlib.util
 
-        # In cases of path manipulation during sitecustomize,
-        # Setuptools might actually not be present even though
-        # the hook has been loaded. Allow the caller to fall
-        # back to stdlib behavior. See #2980.
-        if not importlib.util.find_spec('setuptools'):
+        try:
+            mod = importlib.import_module('setuptools._distutils')
+        except Exception:
+            # There are a couple of cases where setuptools._distutils
+            # may not be present:
+            # - An older Setuptools without a local distutils is
+            #   taking precedence. Ref #2957.
+            # - Path manipulation during sitecustomize removes
+            #   setuptools from the path but only after the hook
+            #   has been loaded. Ref #2980.
+            # In either case, fall back to stdlib behavior.
             return
 
         class DistutilsLoader(importlib.abc.Loader):
 
             def create_module(self, spec):
-                return importlib.import_module('setuptools._distutils')
+                return mod
 
             def exec_module(self, module):
                 pass
@@ -136,20 +142,20 @@ class DistutilsMetaFinder:
 DISTUTILS_FINDER = DistutilsMetaFinder()
 
 
-def ensure_shim():
-    DISTUTILS_FINDER in sys.meta_path or add_shim()
+def add_shim():
+    DISTUTILS_FINDER in sys.meta_path or insert_shim()
 
 
 @contextlib.contextmanager
 def shim():
-    add_shim()
+    insert_shim()
     try:
         yield
     finally:
         remove_shim()
 
 
-def add_shim():
+def insert_shim():
     sys.meta_path.insert(0, DISTUTILS_FINDER)
 
 
index 23c7d1ea840070bd73e7851313fe6f655772dc57..75a41c848414c71d519b8cd70a341452be6873dc 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 60.1.1
+version = 60.2.0
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
@@ -61,7 +61,7 @@ testing =
        pip>=19.1 # For proper file:// URLs support.
        jaraco.envs>=2.2
        pytest-xdist
-       sphinx
+       sphinx>=4.3.2
        jaraco.path>=3.2.0
 
 docs =
index d15189db0f01d8efa5e0c5e361f4f29c6166bf19..4cda3d38900800259bf56618cf489d686749d46f 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -55,7 +55,7 @@ class install_with_pth(install):
         import os
         var = 'SETUPTOOLS_USE_DISTUTILS'
         enabled = os.environ.get(var, 'local') == 'local'
-        enabled and __import__('_distutils_hack').ensure_shim()
+        enabled and __import__('_distutils_hack').add_shim()
         """).lstrip().replace('\n', '; ')
 
     def initialize_options(self):
index 9d6f0bc0dd674e92a985a5f997b17039ade95217..43d1c96eb28b97580f7d4878c680a852e929ba7a 100644 (file)
@@ -18,6 +18,7 @@ from setuptools.extension import Extension
 from setuptools.dist import Distribution
 from setuptools.depends import Require
 from . import monkey
+from . import logging
 
 
 __all__ = [
@@ -149,6 +150,7 @@ def _install_setup_requires(attrs):
 
 def setup(**attrs):
     # Make sure we have any requirements needed to interpret 'attrs'.
+    logging.configure()
     _install_setup_requires(attrs)
     return distutils.core.setup(**attrs)
 
index 4a38dfdadd0b2034d68bcbc199254edb275b7cc7..fd082f6d2789737ec0c96bdde7a033e2c1a3b9ab 100644 (file)
@@ -354,3 +354,9 @@ def is_cygwincc(cc):
     out_string = check_output(shlex.split(cc) + ['-dumpmachine'])
     return out_string.strip().endswith(b'cygwin')
 
+
+get_versions = None
+"""
+A stand-in for the previous get_versions() function to prevent failures
+when monkeypatched. See pypa/setuptools#2969.
+"""
index 8ef6b28ea2ec097ae6ab5d9ac9b2e0d3fc8f4809..a68b156b5b8ded870240b89c20f9d49aec20f786 100644 (file)
@@ -3,13 +3,14 @@
 # The class here is styled after PEP 282 so that it could later be
 # replaced with a standard Python logging implementation.
 
+import sys
+
 DEBUG = 1
 INFO = 2
 WARN = 3
 ERROR = 4
 FATAL = 5
 
-import sys
 
 class Log:
 
@@ -54,6 +55,7 @@ class Log:
     def fatal(self, msg, *args):
         self._log(FATAL, msg, args)
 
+
 _global_log = Log()
 log = _global_log.log
 debug = _global_log.debug
@@ -62,12 +64,14 @@ warn = _global_log.warn
 error = _global_log.error
 fatal = _global_log.fatal
 
+
 def set_threshold(level):
     # return the old threshold for use from tests
     old = _global_log.threshold
     _global_log.threshold = level
     return old
 
+
 def set_verbosity(v):
     if v <= 0:
         set_threshold(WARN)
index d36d94f76f8a5ae8b2510053811942dac6937367..4a77a431dcf4a8ed61730b0db8caefb269dd3ccf 100644 (file)
@@ -13,6 +13,7 @@ import _imp
 import os
 import re
 import sys
+import sysconfig
 
 from .errors import DistutilsPlatformError
 
@@ -274,31 +275,15 @@ def get_config_h_filename():
             inc_dir = os.path.join(_sys_home or project_base, "PC")
         else:
             inc_dir = _sys_home or project_base
+        return os.path.join(inc_dir, 'pyconfig.h')
     else:
-        inc_dir = get_python_inc(plat_specific=1)
+        return sysconfig.get_config_h_filename()
 
-    return os.path.join(inc_dir, 'pyconfig.h')
-
-
-# Allow this value to be patched by pkgsrc. Ref pypa/distutils#16.
-_makefile_tmpl = 'config-{python_ver}{build_flags}{multiarch}'
 
 
 def get_makefile_filename():
     """Return full pathname of installed Makefile from the Python build."""
-    if python_build:
-        return os.path.join(_sys_home or project_base, "Makefile")
-    lib_dir = get_python_lib(plat_specific=0, standard_lib=1)
-    multiarch = (
-        '-%s' % sys.implementation._multiarch
-        if hasattr(sys.implementation, '_multiarch') else ''
-    )
-    config_file = _makefile_tmpl.format(
-        python_ver=get_python_version(),
-        build_flags=build_flags,
-        multiarch=multiarch,
-    )
-    return os.path.join(lib_dir, config_file, 'Makefile')
+    return sysconfig.get_makefile_filename()
 
 
 def parse_config_h(fp, g=None):
@@ -308,26 +293,7 @@ def parse_config_h(fp, g=None):
     optional dictionary is passed in as the second argument, it is
     used instead of a new dictionary.
     """
-    if g is None:
-        g = {}
-    define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n")
-    undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n")
-    #
-    while True:
-        line = fp.readline()
-        if not line:
-            break
-        m = define_rx.match(line)
-        if m:
-            n, v = m.group(1, 2)
-            try: v = int(v)
-            except ValueError: pass
-            g[n] = v
-        else:
-            m = undef_rx.match(line)
-            if m:
-                g[m.group(1)] = 0
-    return g
+    return sysconfig.parse_config_h(fp, vars=g)
 
 
 # Regexes needed for parsing Makefile (and similar syntaxes,
index c5560372bd26a36f5306e2bd029505254aea6279..800b90180edfe4e6664dfdbc213f3307f6fcf79b 100644 (file)
@@ -387,7 +387,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
             archive.close()
 
 def test_suite():
-    return unittest.makeSuite(ArchiveUtilTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(ArchiveUtilTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 130d8bf155a45c4ec8e95165fe03714ac0d3e240..8b7498e3ebda1d9f249c32883be2d72ac7ad0b13 100644 (file)
@@ -51,7 +51,7 @@ class BuildTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(BuildTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildTestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index 01a233bce37ff97ca5e64f305146307aaf50d887..bb860c8ac70345ae3c48b3119241d9f6838587e0 100644 (file)
@@ -91,7 +91,7 @@ class BuildDumbTestCase(support.TempdirManager,
         self.assertEqual(contents, sorted(wanted))
 
 def test_suite():
-    return unittest.makeSuite(BuildDumbTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildDumbTestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index 937266f8c080e5197b155a027f7e93c0c7a012bc..b1831ef20c66be4042fb8b01542fa8dfc58dff5a 100644 (file)
@@ -22,7 +22,7 @@ class BDistMSITestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(BDistMSITestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BDistMSITestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index 6453a02b88f6007f5def9439b48c81b582ab486f..3b22af3a90f962fcd05b54928e3481cc1ee1141f 100644 (file)
@@ -129,7 +129,7 @@ class BuildRpmTestCase(support.TempdirManager,
         os.remove(os.path.join(pkg_dir, 'dist', 'foo-0.1-1.noarch.rpm'))
 
 def test_suite():
-    return unittest.makeSuite(BuildRpmTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildRpmTestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index 31cf2628de5d9faac8c55497342868b0a6ea288b..59f25167e6fdb3af3f1663e0fd3c16ebe37c10e6 100644 (file)
@@ -34,7 +34,7 @@ class BuildWinInstTestCase(support.TempdirManager,
         self.assertGreater(len(exe_file), 10)
 
 def test_suite():
-    return unittest.makeSuite(BuildWinInstTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildWinInstTestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index b020a5ba3569d71ecfdea65934eb6408a64a092a..83a9e4f4dd2f43b7fe93ba05d165757c1201b949 100644 (file)
@@ -50,7 +50,7 @@ class BuildTestCase(support.TempdirManager,
         self.assertEqual(cmd.executable, os.path.normpath(sys.executable))
 
 def test_suite():
-    return unittest.makeSuite(BuildTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 259c43522d122f7ddb883be90af735c877bcf099..d50ead7c940e9c300eff99fc491ba3a619b2a3c5 100644 (file)
@@ -130,7 +130,7 @@ class BuildCLibTestCase(support.TempdirManager,
         self.assertIn('libfoo.a', os.listdir(build_temp))
 
 def test_suite():
-    return unittest.makeSuite(BuildCLibTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildCLibTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 85ecf4b720e622ba3006061870021c530037cbe1..cb0db2b57a2eab90f39abec3c9fce8441b9fbfc4 100644 (file)
@@ -538,8 +538,8 @@ class ParallelBuildExtTestCase(BuildExtTestCase):
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(BuildExtTestCase))
-    suite.addTest(unittest.makeSuite(ParallelBuildExtTestCase))
+    suite.addTest(unittest.TestLoader().loadTestsFromTestCase(BuildExtTestCase))
+    suite.addTest(unittest.TestLoader().loadTestsFromTestCase(ParallelBuildExtTestCase))
     return suite
 
 if __name__ == '__main__':
index 0712e92c6aba4c58c00a87582c37b06b090a69ba..a590a485a2b9294acdad37c8057f6b77f724a124 100644 (file)
@@ -173,7 +173,7 @@ class BuildPyTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(BuildPyTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildPyTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 954fc763987c2a97ad03fb7576feb0b60f314a4b..f299e51ef79fac16f61fb71a596c3d159e814c1d 100644 (file)
@@ -106,7 +106,7 @@ class BuildScriptsTestCase(support.TempdirManager,
             self.assertIn(name, built)
 
 def test_suite():
-    return unittest.makeSuite(BuildScriptsTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(BuildScriptsTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index e534aca1d47637ce8058740bfd4385719c505dab..91bcdceb43bc69f67a60424b94eaff8eb3a6e3e7 100644 (file)
@@ -157,7 +157,7 @@ class CheckTestCase(support.LoggingSilencer,
                                  'restructuredtext': 1})
 
 def test_suite():
-    return unittest.makeSuite(CheckTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(CheckTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index c605afd86012b693bc5e14c9d5005fda2694d52e..92367499cefc046fad9aa1941f9bcc1ec6d15a35 100644 (file)
@@ -43,7 +43,7 @@ class cleanTestCase(support.TempdirManager,
         cmd.run()
 
 def test_suite():
-    return unittest.makeSuite(cleanTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(cleanTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index cf5197c30fca9d31b4da0946de45e7d7cf66418a..2319214a9e332b87a9499968e09dbb19d601683a 100644 (file)
@@ -120,7 +120,7 @@ class CommandTestCase(unittest.TestCase):
             debug.DEBUG = False
 
 def test_suite():
-    return unittest.makeSuite(CommandTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(CommandTestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index 344084afb77912dec8cc5a2076bae2eceeab96d4..8ab70efb161cbd87e0bd95291f2c78e3b2a19a16 100644 (file)
@@ -135,7 +135,7 @@ class PyPIRCCommandTestCase(BasePyPIRCCommandTestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(PyPIRCCommandTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(PyPIRCCommandTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 4cd9a6b9a0ca5e8cd4deea1eb7363cdb9db5a3c6..2c84719aad3fd7ca926d503f82734529452f97e6 100644 (file)
@@ -92,7 +92,7 @@ class ConfigTestCase(support.LoggingSilencer,
             self.assertFalse(os.path.exists(f))
 
 def test_suite():
-    return unittest.makeSuite(ConfigTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(ConfigTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index d99cfd26c3db7515f9c4ad1bfe67be866020d94a..7270d699a3e94f6f2781de8a220d1e3addfb6df7 100644 (file)
@@ -159,7 +159,7 @@ class CoreTestCase(support.EnvironGuard, unittest.TestCase):
         self.assertEqual(stdout.readlines()[0], wanted)
 
 def test_suite():
-    return unittest.makeSuite(CoreTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(CoreTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 0e52c88fb079a484c801799b661f01ceaf4db7c7..8715a535394d6a2e8f1673b5777c5d828286295f 100644 (file)
@@ -90,7 +90,7 @@ class CygwinCCompilerTestCase(support.TempdirManager,
         self.assertRaises(ValueError, get_msvcr)
 
 def test_suite():
-    return unittest.makeSuite(CygwinCCompilerTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(CygwinCCompilerTestCase)
 
 if __name__ == '__main__':
     run_unittest(test_suite())
index c6fae39cfb1e07628e99334eccc8ab38dbad7acb..0d52740a9edda390982ee2a6aee3a6f3ff438101 100644 (file)
@@ -74,7 +74,7 @@ class DepUtilTestCase(support.TempdirManager, unittest.TestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(DepUtilTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(DepUtilTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index d436cf8319171554ba17b9590e4db61d6bed53e5..1b1f3bbb02e3483dc39282e81fcf392cb0b183c7 100644 (file)
@@ -133,7 +133,7 @@ class DirUtilTestCase(support.TempdirManager, unittest.TestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(DirUtilTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(DirUtilTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 45eadee87fd6473c15447f719a9961af7bba787c..36155be1524e669f366766eb396ac377b2105af9 100644 (file)
@@ -525,8 +525,8 @@ class MetadataTestCase(support.TempdirManager, support.EnvironGuard,
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(DistributionTestCase))
-    suite.addTest(unittest.makeSuite(MetadataTestCase))
+    suite.addTest(unittest.TestLoader().loadTestsFromTestCase(DistributionTestCase))
+    suite.addTest(unittest.TestLoader().loadTestsFromTestCase(MetadataTestCase))
     return suite
 
 if __name__ == "__main__":
index 2eb5b422df576e6ff71b08e0efb9c96d259b6de1..78a55daa088d017dd625793d955d2bef3d3291ca 100644 (file)
@@ -65,7 +65,7 @@ class ExtensionTestCase(unittest.TestCase):
                           "Unknown Extension options: 'chic'")
 
 def test_suite():
-    return unittest.makeSuite(ExtensionTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(ExtensionTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index d2536075264f47ccc946f0b2e6cda4a0a6af9e4a..81b90d6c8a3dab3bd2ab9ce1810da4816d14f560 100644 (file)
@@ -118,7 +118,7 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(FileUtilTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(FileUtilTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 9ec507b5d0be02991a362d76f2f307b0b14cce14..a90edcf1381155df9f53039383b31b373c99ace8 100644 (file)
@@ -344,8 +344,8 @@ class FindAllTestCase(unittest.TestCase):
 
 def test_suite():
     return unittest.TestSuite([
-        unittest.makeSuite(FileListTestCase),
-        unittest.makeSuite(FindAllTestCase),
+        unittest.TestLoader().loadTestsFromTestCase(FileListTestCase),
+        unittest.TestLoader().loadTestsFromTestCase(FindAllTestCase),
     ])
 
 
index cce973dc5733c22bd2aa9b2e812ffa1c938cc269..75770b05e60deefd4bd6db2c8b24fe8ea58ee33a 100644 (file)
@@ -244,7 +244,7 @@ class InstallTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(InstallTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(InstallTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 32ab296a320e005d0f798add14a26f9f9577ab7a..6191d2fa6eefab35e9b92e05d4f43f31c30fbda2 100644 (file)
@@ -69,7 +69,7 @@ class InstallDataTestCase(support.TempdirManager,
         self.assertTrue(os.path.exists(os.path.join(inst, rone)))
 
 def test_suite():
-    return unittest.makeSuite(InstallDataTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(InstallDataTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 2217b321e6e054d22bdf248c6542ef3b9a6e4d1f..1aa4d09cdef731cfa893fb24b3b1e66677918cd8 100644 (file)
@@ -33,7 +33,7 @@ class InstallHeadersTestCase(support.TempdirManager,
         self.assertEqual(len(cmd.get_outputs()), 2)
 
 def test_suite():
-    return unittest.makeSuite(InstallHeadersTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(InstallHeadersTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index fda6315bbc7b593c25a8819d99d0448d4d9e98fd..652653f2b2c2bcb1e9f10787bf1c2337c4eff09a 100644 (file)
@@ -109,7 +109,7 @@ class InstallLibTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(InstallLibTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(InstallLibTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 1f7b1038cb2719a441699e092dac35ec77135226..648db3b11da745615a6670293ad33eccbc0dc5ee 100644 (file)
@@ -76,7 +76,7 @@ class InstallScriptsTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(InstallScriptsTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(InstallScriptsTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 75cf900617be6c52ef52361996a35e29b2ae6137..ec2ae028de8777421ed9c8b926ce8dfad0fbf65a 100644 (file)
@@ -40,7 +40,7 @@ class TestLog(unittest.TestCase):
                         'Fαtal\t\\xc8rr\\u014dr')
 
 def test_suite():
-    return unittest.makeSuite(TestLog)
+    return unittest.TestLoader().loadTestsFromTestCase(TestLog)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 77a07ef39dd1a6fe26ada95099d824c89f1ac54c..6235405e31201b23a5319444fde8ef8c390b1698 100644 (file)
@@ -178,7 +178,7 @@ class msvc9compilerTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(msvc9compilerTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(msvc9compilerTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 46a51cd0a7b85cfae328fa50c5d916db5dc57a13..846e5bb80a940594da9d73ff2394fb1559c36786 100644 (file)
@@ -98,7 +98,7 @@ class TestSpawn(unittest.TestCase):
         compiler = _msvccompiler.MSVCCompiler()
         compiler._paths = "expected"
         inner_cmd = 'import os; assert os.environ["PATH"] == "expected"'
-        command = ['python', '-c', inner_cmd]
+        command = [sys.executable, '-c', inner_cmd]
 
         threads = [
             CheckThread(target=compiler.spawn, args=[command])
@@ -132,7 +132,7 @@ class TestSpawn(unittest.TestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(msvccompilerTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(msvccompilerTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 84607f996f18df8761b3307a9ed5b4c018872dea..5770ed58ae937955ebfa5b911e1adef0b4999f55 100644 (file)
@@ -319,7 +319,7 @@ class RegisterTestCase(BasePyPIRCCommandTestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(RegisterTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(RegisterTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 880044fa391aea2b7ae6de4cde98bf0d49b1b726..4c51717ce6a75ad2a168203ef1be56c3fa5a8ee5 100644 (file)
@@ -483,7 +483,7 @@ class SDistTestCase(BasePyPIRCCommandTestCase):
             archive.close()
 
 def test_suite():
-    return unittest.makeSuite(SDistTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(SDistTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index f620da78430cd43f81cb1bec887a2de83ce928b4..c5ed8e2b45c48e6afbbe4671eb8c5ea1691ec21e 100644 (file)
@@ -133,7 +133,7 @@ class SpawnTestCase(support.TempdirManager,
 
 
 def test_suite():
-    return unittest.makeSuite(SpawnTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(SpawnTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 80cd1599a732a811b0f2930f3d16bd374ae6b213..9de3cb7018f0e096c2a1c8a727552fdea42b086e 100644 (file)
@@ -38,6 +38,12 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
         config_h = sysconfig.get_config_h_filename()
         self.assertTrue(os.path.isfile(config_h), config_h)
 
+    @unittest.skipIf(sys.platform == 'win32',
+                     'Makefile only exists on Unix like systems')
+    def test_get_makefile_filename(self):
+        makefile = sysconfig.get_makefile_filename()
+        self.assertTrue(os.path.isfile(makefile), makefile)
+
     def test_get_python_lib(self):
         # XXX doesn't work on Linux when Python was never installed before
         #self.assertTrue(os.path.isdir(lib_dir), lib_dir)
@@ -283,10 +289,19 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
         outs, errs = p.communicate()
         self.assertEqual(0, p.returncode, "Subprocess failed: " + outs)
 
+    def test_parse_config_h(self):
+        config_h = sysconfig.get_config_h_filename()
+        input = {}
+        with open(config_h, encoding="utf-8") as f:
+            result = sysconfig.parse_config_h(f, g=input)
+        self.assertTrue(input is result)
+        with open(config_h, encoding="utf-8") as f:
+            result = sysconfig.parse_config_h(f)
+        self.assertTrue(isinstance(result, dict))
 
 def test_suite():
     suite = unittest.TestSuite()
-    suite.addTest(unittest.makeSuite(SysconfigTestCase))
+    suite.addTest(unittest.TestLoader().loadTestsFromTestCase(SysconfigTestCase))
     return suite
 
 
index 7e76240a9a30712c8c9991d147a688c6b3169846..ebac3d52f9097c2114efa9559c3fc7e57aafcd79 100644 (file)
@@ -101,7 +101,7 @@ class TextFileTestCase(support.TempdirManager, unittest.TestCase):
             in_file.close()
 
 def test_suite():
-    return unittest.makeSuite(TextFileTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(TextFileTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index 2ea93da1b54b993f03b4e42e75dc86dbe7bba029..4574f77fb46b087a3cdc0bd6e12a352828de153b 100644 (file)
@@ -246,7 +246,7 @@ class UnixCCompilerTestCase(support.TempdirManager, unittest.TestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(UnixCCompilerTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(UnixCCompilerTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index bca5516d2f74f68f26b4592e12fc8082c099f7ab..ce3e84a248c728bc683489866984d178942fab66 100644 (file)
@@ -217,7 +217,7 @@ class uploadTestCase(BasePyPIRCCommandTestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(uploadTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(uploadTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index bf0d4333f9aeaad97720a44ca4e058501930b9dc..12469e3de3f7da21b18abe8299698a5f9230ab7d 100644 (file)
@@ -303,7 +303,7 @@ class UtilTestCase(support.EnvironGuard, unittest.TestCase):
 
 
 def test_suite():
-    return unittest.makeSuite(UtilTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(UtilTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
index d50cca1fc0801942c06d05764b671c3dc7848217..8405aa3a629b4e3387576023347f12d81dd35319 100644 (file)
@@ -89,7 +89,7 @@ class VersionTestCase(unittest.TestCase):
                           (v1, v2, res))
 
 def test_suite():
-    return unittest.makeSuite(VersionTestCase)
+    return unittest.TestLoader().loadTestsFromTestCase(VersionTestCase)
 
 if __name__ == "__main__":
     run_unittest(test_suite())
diff --git a/setuptools/logging.py b/setuptools/logging.py
new file mode 100644 (file)
index 0000000..dbead6e
--- /dev/null
@@ -0,0 +1,30 @@
+import sys
+import logging
+import distutils.log
+from . import monkey
+
+
+def _not_warning(record):
+    return record.levelno < logging.WARNING
+
+
+def configure():
+    """
+    Configure logging to emit warning and above to stderr
+    and everything else to stdout. This behavior is provided
+    for compatibilty with distutils.log but may change in
+    the future.
+    """
+    err_handler = logging.StreamHandler()
+    err_handler.setLevel(logging.WARNING)
+    out_handler = logging.StreamHandler(sys.stdout)
+    out_handler.addFilter(_not_warning)
+    handlers = err_handler, out_handler
+    logging.basicConfig(
+        format="{message}", style='{', handlers=handlers, level=logging.DEBUG)
+    monkey.patch_func(set_threshold, distutils.log, 'set_threshold')
+
+
+def set_threshold(level):
+    logging.root.setLevel(level*10)
+    return set_threshold.unpatched(level)
diff --git a/tox.ini b/tox.ini
index 25b4eaf018237223619e449e4a7a2e591d9d640e..145c2209964a6a866181124ce6d7c0754fa1d967 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -7,9 +7,6 @@ toxworkdir={env:TOX_WORK_DIR:.tox}
 
 [testenv]
 deps =
-       # workaround for sphinx-doc/sphinx#9562
-       # TODO: remove after Sphinx>4.1.2 is available.
-       sphinx@git+https://github.com/sphinx-doc/sphinx; python_version>="3.10"
        # TODO: remove after man-group/pytest-plugins#188 is solved
        pytest-virtualenv @ git+https://github.com/jaraco/pytest-plugins@distutils-deprecated#subdirectory=pytest-virtualenv
 commands =