Imported Upstream version 58.1.0 upstream/58.1.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:36 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:36 +0000 (17:02 +0900)
19 files changed:
.bumpversion.cfg
.github/workflows/main.yml
.gitignore
CHANGES.rst
changelog.d/1988-change.rst [new file with mode: 0644]
changelog.d/2785-change.rst [new file with mode: 0644]
docs/userguide/entry_point.rst
docs/userguide/quickstart.rst
setup.cfg
setuptools/_distutils/command/build_ext.py
setuptools/_distutils/command/install.py
setuptools/_distutils/sysconfig.py
setuptools/_distutils/tests/test_sysconfig.py
setuptools/_distutils/tests/test_unixccompiler.py
setuptools/_distutils/unixccompiler.py
setuptools/command/bdist_rpm.py
setuptools/command/easy_install.py
setuptools/tests/test_bdist_deprecations.py [new file with mode: 0644]
setuptools/tests/test_setopt.py

index 4871a5ea1cf7eb6fa7d72e14ddbd92bd8671a1d0..c7fab7fc0bddb2027f46066f202403f99a1b20bd 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 58.0.4
+current_version = 58.1.0
 commit = True
 tag = True
 
index 6af3ac795802b504ca098caaeadd8208d9388c98..b348056b7d536c601f6da8e87eb1ea4e45d43894 100644 (file)
@@ -7,10 +7,10 @@ jobs:
     strategy:
       matrix:
         python:
+        - pypy3
         - 3.6
         - 3.9
         - 3.10.0-alpha - 3.10.99
-        - pypy3
         platform: [ubuntu-latest, macos-latest, windows-latest]
     runs-on: ${{ matrix.platform }}
     steps:
index 90ae80505e44540e5217f5b82ebd21890c5f90fc..dc14826ec865129b3765c57718d7b7ec4f7ccc81 100644 (file)
@@ -6,6 +6,7 @@ docs/build
 include
 lib
 distribute.egg-info
+foo.egg-info
 setuptools.egg-info
 .coverage
 .eggs
index dab740079496b30776fb1ec3c8863ce7916d6d5b..a77a8f1c40c8536a2459293f21ccce282d482790 100644 (file)
@@ -1,3 +1,12 @@
+v58.1.0
+-------
+
+
+Changes
+^^^^^^^
+* #2796: Merge with pypa/distutils@02e9f65ab0
+
+
 v58.0.4
 -------
 
diff --git a/changelog.d/1988-change.rst b/changelog.d/1988-change.rst
new file mode 100644 (file)
index 0000000..4f10463
--- /dev/null
@@ -0,0 +1,2 @@
+Deprecated the ``bdist_rpm`` command. Binary packages should be built as wheels instead.
+-- by :user:`hugovk`
diff --git a/changelog.d/2785-change.rst b/changelog.d/2785-change.rst
new file mode 100644 (file)
index 0000000..7e9631b
--- /dev/null
@@ -0,0 +1,2 @@
+Replace confirparser's readfp with read_file, deprecated since Python 3.2.
+-- by :user:`hugovk`
index c92ccf768eea91d9a6dc3354a5cd4f9d232e9965..21edc6971ac4422c17b550708a05445e9f08fa81 100644 (file)
@@ -141,7 +141,7 @@ Dependency Management
 =====================
 
 Some entry points may require additional dependencies to properly function.
-For such an entry point, declare in square brakets any number of dependency
+For such an entry point, declare in square brackets any number of dependency
 ``extras`` following the entry point definition. Such entry points will only
 be viable if their extras were declared and installed. See the
 :doc:`guide on dependencies management <dependency_management>` for
index 1bd04dedc45177415bcad62ddc66f1a6f8c22197..bcb282edbb71a7b10aa342a53eac300f98deeeed 100644 (file)
@@ -201,7 +201,7 @@ Then::
     pip install --editable .
 
 This creates a link file in your interpreter site package directory which
-associate with your source code. For more information, see: (WIP)
+associate with your source code. For more information, see :doc:`development_mode`.
 
 
 Uploading your package to PyPI
index fb25e6cbd4d0dcf662577b1277a127ccae9b7472..0bee3cf35f117589a4accf3d716b12461cfa7358 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 58.0.4
+version = 58.1.0
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
index f7ab32cfe1d1515f72d8204502beba59c350fda6..22628baf90f1ae93033d2f7d06c7c116b695a5ee 100644 (file)
@@ -220,7 +220,7 @@ class build_ext(Command):
         # For extensions under Cygwin, Python's library directory must be
         # appended to library_dirs
         if sys.platform[:6] == 'cygwin':
-            if sys.executable.startswith(os.path.join(sys.exec_prefix, "bin")):
+            if not sysconfig.python_build:
                 # building third party extensions
                 self.library_dirs.append(os.path.join(sys.prefix, "lib",
                                                       "python" + get_python_version(),
index 400fb45dd0869f3c173a2e16a99894a15c484c18..866e2d597151da71af52803b39e62aa0bfc360a9 100644 (file)
@@ -470,6 +470,7 @@ class install(Command):
         """Sets the install directories by applying the install schemes."""
         # it's the caller's problem if they supply a bad name!
         if (hasattr(sys, 'pypy_version_info') and
+                sys.version_info < (3, 8) and
                 not name.endswith(('_user', '_home'))):
             if os.name == 'nt':
                 name = 'pypy_nt'
index 879b6981ed444e709f5b412c262a4afcb4496374..8832b3ecebf8966796df4663d33ae6b57a4c4f7d 100644 (file)
@@ -99,9 +99,9 @@ def get_python_inc(plat_specific=0, prefix=None):
     """
     if prefix is None:
         prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
-    if IS_PYPY:
-        return os.path.join(prefix, 'include')
-    elif os.name == "posix":
+    if os.name == "posix":
+        if IS_PYPY and sys.version_info < (3, 8):
+            return os.path.join(prefix, 'include')
         if python_build:
             # Assume the executable is in the build directory.  The
             # pyconfig.h file should be in the same directory.  Since
@@ -113,7 +113,8 @@ def get_python_inc(plat_specific=0, prefix=None):
             else:
                 incdir = os.path.join(get_config_var('srcdir'), 'Include')
                 return os.path.normpath(incdir)
-        python_dir = 'python' + get_python_version() + build_flags
+        implementation = 'pypy' if IS_PYPY else 'python'
+        python_dir = implementation + get_python_version() + build_flags
         return os.path.join(prefix, "include", python_dir)
     elif os.name == "nt":
         if python_build:
@@ -142,7 +143,8 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
     If 'prefix' is supplied, use it instead of sys.base_prefix or
     sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
     """
-    if IS_PYPY:
+
+    if IS_PYPY and sys.version_info < (3, 8):
         # PyPy-specific schema
         if prefix is None:
             prefix = PREFIX
@@ -164,8 +166,9 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
         else:
             # Pure Python
             libdir = "lib"
+        implementation = 'pypy' if IS_PYPY else 'python'
         libpython = os.path.join(prefix, libdir,
-                                 "python" + get_python_version())
+                                 implementation + get_python_version())
         if standard_lib:
             return libpython
         else:
@@ -211,10 +214,9 @@ def customize_compiler(compiler):
 
         if 'CC' in os.environ:
             newcc = os.environ['CC']
-            if (sys.platform == 'darwin'
-                    and 'LDSHARED' not in os.environ
+            if('LDSHARED' not in os.environ
                     and ldshared.startswith(cc)):
-                # On OS X, if CC is overridden, use that as the default
+                # If CC is overridden, use that as the default
                 #       command for LDSHARED as well
                 ldshared = newcc + ldshared[len(cc):]
             cc = newcc
@@ -252,6 +254,9 @@ def customize_compiler(compiler):
             linker_exe=cc,
             archiver=archiver)
 
+        if 'RANLIB' in os.environ and compiler.executables.get('ranlib', None):
+            compiler.set_executables(ranlib=os.environ['RANLIB'])
+
         compiler.shared_lib_extension = shlib_suffix
 
 
index c757194288c97ad7662de2ff389497d09cd0a816..80cd1599a732a811b0f2930f3d16bd374ae6b213 100644 (file)
@@ -9,6 +9,7 @@ import unittest
 
 from distutils import sysconfig
 from distutils.ccompiler import get_default_compiler
+from distutils.unixccompiler import UnixCCompiler
 from distutils.tests import support
 from test.support import run_unittest, swap_item
 
@@ -84,9 +85,14 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
         # make sure AR gets caught
         class compiler:
             compiler_type = 'unix'
+            executables = UnixCCompiler.executables
+
+            def __init__(self):
+                self.exes = {}
 
             def set_executables(self, **kw):
-                self.exes = kw
+                for k, v in kw.items():
+                    self.exes[k] = v
 
         sysconfig_vars = {
             'AR': 'sc_ar',
@@ -125,6 +131,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
         os.environ['ARFLAGS'] = '--env-arflags'
         os.environ['CFLAGS'] = '--env-cflags'
         os.environ['CPPFLAGS'] = '--env-cppflags'
+        os.environ['RANLIB'] = 'env_ranlib'
 
         comp = self.customize_compiler()
         self.assertEqual(comp.exes['archiver'],
@@ -145,6 +152,12 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
                           ' --env-cppflags'))
         self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix')
 
+        if sys.platform == "darwin":
+            self.assertEqual(comp.exes['ranlib'],
+                         'env_ranlib')
+        else:
+            self.assertTrue('ranlib' not in comp.exes)
+
         del os.environ['AR']
         del os.environ['CC']
         del os.environ['CPP']
@@ -154,6 +167,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
         del os.environ['ARFLAGS']
         del os.environ['CFLAGS']
         del os.environ['CPPFLAGS']
+        del os.environ['RANLIB']
 
         comp = self.customize_compiler()
         self.assertEqual(comp.exes['archiver'],
@@ -171,6 +185,7 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase):
         self.assertEqual(comp.exes['linker_so'],
                          'sc_ldshared')
         self.assertEqual(comp.shared_lib_extension, 'sc_shutil_suffix')
+        self.assertTrue('ranlib' not in comp.exes)
 
     def test_parse_makefile_base(self):
         self.makefile = TESTFN
index ebd7c161e037b440e8caeaf6acbe23a6c140d4d0..1008f58a15e78d3af59cf09c96ca80b9ad27e407 100644 (file)
@@ -140,6 +140,14 @@ class UnixCCompilerTestCase(unittest.TestCase):
         sysconfig.get_config_var = gcv
         self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
 
+        def gcv(v):
+            if v == 'CC':
+                return 'gcc -pthread -B /bar'
+            elif v == 'GNULD':
+                return 'yes'
+        sysconfig.get_config_var = gcv
+        self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')
+
         # GCC non-GNULD
         sys.platform = 'bar'
         def gcv(v):
@@ -181,8 +189,8 @@ class UnixCCompilerTestCase(unittest.TestCase):
         sysconfig.get_config_var = gcv
         self.assertEqual(self.cc.rpath_foo(), '-R/foo')
 
-    @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X')
-    def test_osx_cc_overrides_ldshared(self):
+    @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
+    def test_cc_overrides_ldshared(self):
         # Issue #18080:
         # ensure that setting CC env variable also changes default linker
         def gcv(v):
@@ -202,8 +210,8 @@ class UnixCCompilerTestCase(unittest.TestCase):
             sysconfig.customize_compiler(self.cc)
         self.assertEqual(self.cc.linker_so[0], 'my_cc')
 
-    @unittest.skipUnless(sys.platform == 'darwin', 'test only relevant for OS X')
-    def test_osx_explicit_ldshared(self):
+    @unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
+    def test_explicit_ldshared(self):
         # Issue #18080:
         # ensure that setting CC env variable does not change
         #   explicit LDSHARED setting for linker
index f51977a5ae4962f6d4a605ac40ee36eb2fc2cae6..349cc1642b74c398b9b53f5616d3f0a023dab03a 100644 (file)
@@ -13,7 +13,7 @@ the "typical" Unix-style command-line C compiler:
   * link shared library handled by 'cc -shared'
 """
 
-import os, sys, re
+import os, sys, re, shlex
 
 from distutils import sysconfig
 from distutils.dep_util import newer
@@ -231,7 +231,7 @@ class UnixCCompiler(CCompiler):
         # this time, there's no way to determine this information from
         # the configuration data stored in the Python installation, so
         # we use this hack.
-        compiler = os.path.basename(sysconfig.get_config_var("CC"))
+        compiler = os.path.basename(shlex.split(sysconfig.get_config_var("CC"))[0])
         if sys.platform[:6] == "darwin":
             from distutils.util import get_macosx_target_ver, split_version
             macosx_target_ver = get_macosx_target_ver()
index 0eb1b9c254b174e9e3be7e3322e2fcb21ea8e3aa..98bf5dea8468bf1728f18d97d1b9a43be33fdf20 100644 (file)
@@ -1,4 +1,7 @@
 import distutils.command.bdist_rpm as orig
+import warnings
+
+from setuptools import SetuptoolsDeprecationWarning
 
 
 class bdist_rpm(orig.bdist_rpm):
@@ -11,6 +14,12 @@ class bdist_rpm(orig.bdist_rpm):
     """
 
     def run(self):
+        warnings.warn(
+            "bdist_rpm is deprecated and will be removed in a future "
+            "version. Use bdist_wheel (wheel packages) instead.",
+            SetuptoolsDeprecationWarning,
+        )
+
         # ensure distro name is up-to-date
         self.run_command('egg_info')
 
index 43bd29524936ce2017866e8e8a56de5dbc6dbfd7..5e0f97cfea5484ea1ea139e0f4b8e8553b80b00d 100644 (file)
@@ -1508,7 +1508,7 @@ def extract_wininst_cfg(dist_filename):
             # Now the config is in bytes, but for RawConfigParser, it should
             #  be text, so decode it.
             config = config.decode(sys.getfilesystemencoding())
-            cfg.readfp(io.StringIO(config))
+            cfg.read_file(io.StringIO(config))
         except configparser.Error:
             return None
         if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
diff --git a/setuptools/tests/test_bdist_deprecations.py b/setuptools/tests/test_bdist_deprecations.py
new file mode 100644 (file)
index 0000000..28482fd
--- /dev/null
@@ -0,0 +1,27 @@
+"""develop tests
+"""
+import mock
+import sys
+
+import pytest
+
+from setuptools.dist import Distribution
+from setuptools import SetuptoolsDeprecationWarning
+
+
+@pytest.mark.skipif(sys.platform == 'win32', reason='non-Windows only')
+@mock.patch('distutils.command.bdist_rpm.bdist_rpm')
+def test_bdist_rpm_warning(distutils_cmd):
+    dist = Distribution(
+        dict(
+            script_name='setup.py',
+            script_args=['bdist_rpm'],
+            name='foo',
+            py_modules=['hi'],
+        )
+    )
+    dist.parse_command_line()
+    with pytest.warns(SetuptoolsDeprecationWarning):
+        dist.run_commands()
+
+    distutils_cmd.run.assert_called_once()
index 61dc68b61885337029c7db0c5dd23c12b704b244..36008632141cbf26bfa8c22c935cf5f8fd5b16b0 100644 (file)
@@ -31,8 +31,11 @@ class TestEdit:
 
     def test_case_retained(self, tmpdir):
         """
+        When editing a file, case of keys should be retained.
         """
         config = tmpdir.join('setup.cfg')
-        self.write_text(str(config), '[names]\nJARACO=jaraco')
-        setopt.edit_config(str(config), dict())
-        assert 'JARACO' in config.read_text(encoding='ascii')
+        self.write_text(str(config), '[names]\nFoO=bAr')
+        setopt.edit_config(str(config), dict(names=dict(oTher='yes')))
+        actual = config.read_text(encoding='ascii')
+        assert 'FoO' in actual
+        assert 'oTher' in actual