Imported Upstream version 59.8.0 upstream/59.8.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:40 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:40 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
setup.cfg
setuptools/_distutils/command/install.py
setuptools/_distutils/cygwinccompiler.py
setuptools/_distutils/msvc9compiler.py
setuptools/_distutils/tests/test_archive_util.py
setuptools/_distutils/tests/test_sdist.py
setuptools/_distutils/tests/unix_compat.py [new file with mode: 0644]

index 44072dee542fdee019cb9033485c0d2221fbbd8d..562bc7d3b6bafab884d43e3a876c9c957d3a4118 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 59.7.0
+current_version = 59.8.0
 commit = True
 tag = True
 
index 5c898fa85b2142727ea53fe9a5727f4b4d3ed163..0b018b25de58161a8ccd6de658e40389e8786be8 100644 (file)
@@ -1,3 +1,12 @@
+v59.8.0
+-------
+
+
+Changes
+^^^^^^^
+* #2935: Merge pypa/distutils@460b59f0e68dba17e2465e8dd421bbc14b994d1f.
+
+
 v59.7.0
 -------
 
index 343ea2ad2961f2c4ae2df28804af1cfb2fca33da..21bdf4a083c32a4b9c6d668a72497acb5c6081a4 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 59.7.0
+version = 59.8.0
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
index 18b352fac06f68adfaa4dd3927a0dc7bb3349408..80f5f8c73a125bb484458149c496302d415ecd45 100644 (file)
@@ -81,6 +81,11 @@ if HAS_USER_SITE:
         'data'   : '{userbase}',
         }
 
+    INSTALL_SCHEMES['osx_framework_user'] = {
+        'headers':
+            '{userbase}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}',
+    }
+
 # The keys to an installation scheme; if any new types of files are to be
 # installed, be sure to add an entry to every installation scheme above,
 # and to SCHEME_KEYS here.
@@ -445,12 +450,17 @@ class install(Command):
     def finalize_unix(self):
         """Finalizes options for posix platforms."""
         if self.install_base is not None or self.install_platbase is not None:
-            if ((self.install_lib is None and
-                 self.install_purelib is None and
-                 self.install_platlib is None) or
+            incomplete_scheme = (
+                (
+                    self.install_lib is None and
+                    self.install_purelib is None and
+                    self.install_platlib is None
+                ) or
                 self.install_headers is None or
                 self.install_scripts is None or
-                self.install_data is None):
+                self.install_data is None
+            )
+            if incomplete_scheme:
                 raise DistutilsOptionError(
                       "install-base or install-platbase supplied, but "
                       "installation scheme is incomplete")
@@ -510,21 +520,30 @@ class install(Command):
                       "I don't know how to install stuff on '%s'" % os.name)
 
     def select_scheme(self, name):
+        os_name, sep, key = name.partition('_')
+        try:
+            resolved = sysconfig.get_preferred_scheme(key)
+        except Exception:
+            resolved = self._pypy_hack(name)
+        return self._select_scheme(resolved)
+
+    def _select_scheme(self, name):
         """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'
-            else:
-                name = 'pypy'
         scheme = _load_schemes()[name]
         for key in SCHEME_KEYS:
             attrname = 'install_' + key
             if getattr(self, attrname) is None:
                 setattr(self, attrname, scheme[key])
 
+    @staticmethod
+    def _pypy_hack(name):
+        PY37 = sys.version_info < (3, 8)
+        old_pypy = hasattr(sys, 'pypy_version_info') and PY37
+        prefix = not name.endswith(('_user', '_home'))
+        pypy_name = 'pypy' + '_nt' * (os.name == 'nt')
+        return pypy_name if old_pypy and prefix else name
+
     def _expand_attrs(self, attrs):
         for attr in attrs:
             val = getattr(self, attr)
index ad6cc44b08fb518aea016d940bc718dd149db023..09be5ba2c1041acced8c5d5cb27652e7c8b5cd0f 100644 (file)
@@ -50,6 +50,7 @@ cygwin in no-cygwin mode).
 import os
 import sys
 import copy
+import shlex
 from subprocess import Popen, PIPE, check_output
 import re
 
@@ -421,5 +422,5 @@ def get_versions():
 
 def is_cygwincc(cc):
     '''Try to determine if the compiler that would be used is from cygwin.'''
-    out_string = check_output([cc, '-dumpmachine'])
+    out_string = check_output(shlex.split(cc) + ['-dumpmachine'])
     return out_string.strip().endswith(b'cygwin')
index a1b3b02ff0a94b0611a4ca44345d42a226d15ee5..14d137752d22df0876c2d07085e29df3f8981322 100644 (file)
@@ -291,8 +291,6 @@ def query_vcvarsall(version, arch="x86"):
 
 # More globals
 VERSION = get_build_version()
-if VERSION < 8.0:
-    raise DistutilsPlatformError("VC %0.1f is not supported by this module" % VERSION)
 # MACROS = MacroExpander(VERSION)
 
 class MSVCCompiler(CCompiler) :
@@ -339,6 +337,8 @@ class MSVCCompiler(CCompiler) :
     def initialize(self, plat_name=None):
         # multi-init means we would need to check platform same each time...
         assert not self.initialized, "don't init multiple times"
+        if self.__version < 8.0:
+            raise DistutilsPlatformError("VC %0.1f is not supported by this module" % self.__version)
         if plat_name is None:
             plat_name = get_platform()
         # sanity check for platforms to prevent obscure errors later.
index ce6456dc5d25e44d341ac2c2ac00d7ddca3b54d6..c5560372bd26a36f5306e2bd029505254aea6279 100644 (file)
@@ -14,16 +14,11 @@ from distutils.archive_util import (check_archive_formats, make_tarball,
 from distutils.spawn import find_executable, spawn
 from distutils.tests import support
 from test.support import run_unittest, patch
+from .unix_compat import require_unix_id, require_uid_0, grp, pwd, UID_0_SUPPORT
 
 from .py38compat import change_cwd
 from .py38compat import check_warnings
 
-try:
-    import grp
-    import pwd
-    UID_GID_SUPPORT = True
-except ImportError:
-    UID_GID_SUPPORT = False
 
 try:
     import zipfile
@@ -339,7 +334,7 @@ class ArchiveUtilTestCase(support.TempdirManager,
     def test_make_archive_owner_group(self):
         # testing make_archive with owner and group, with various combinations
         # this works even if there's not gid/uid support
-        if UID_GID_SUPPORT:
+        if UID_0_SUPPORT:
             group = grp.getgrgid(0)[0]
             owner = pwd.getpwuid(0)[0]
         else:
@@ -364,7 +359,8 @@ class ArchiveUtilTestCase(support.TempdirManager,
         self.assertTrue(os.path.exists(res))
 
     @unittest.skipUnless(ZLIB_SUPPORT, "Requires zlib")
-    @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
+    @require_unix_id
+    @require_uid_0
     def test_tarfile_root_owner(self):
         tmpdir =  self._create_files()
         base_name = os.path.join(self.mkdtemp(), 'archive')
index b087a8178795da18d1b9062fe5074ebf94d6b83e..880044fa391aea2b7ae6de4cde98bf0d49b1b726 100644 (file)
@@ -7,6 +7,7 @@ import zipfile
 from os.path import join
 from textwrap import dedent
 from test.support import captured_stdout, run_unittest
+from .unix_compat import require_unix_id, require_uid_0, pwd, grp
 
 from .py38compat import check_warnings
 
@@ -16,13 +17,6 @@ try:
 except ImportError:
     ZLIB_SUPPORT = False
 
-try:
-    import grp
-    import pwd
-    UID_GID_SUPPORT = True
-except ImportError:
-    UID_GID_SUPPORT = False
-
 from distutils.command.sdist import sdist, show_formats
 from distutils.core import Distribution
 from distutils.tests.test_config import BasePyPIRCCommandTestCase
@@ -440,7 +434,8 @@ class SDistTestCase(BasePyPIRCCommandTestCase):
                                              'fake-1.0/README.manual'])
 
     @unittest.skipUnless(ZLIB_SUPPORT, "requires zlib")
-    @unittest.skipUnless(UID_GID_SUPPORT, "Requires grp and pwd support")
+    @require_unix_id
+    @require_uid_0
     @unittest.skipIf(find_executable('tar') is None,
                      "The tar command is not found")
     @unittest.skipIf(find_executable('gzip') is None,
diff --git a/setuptools/_distutils/tests/unix_compat.py b/setuptools/_distutils/tests/unix_compat.py
new file mode 100644 (file)
index 0000000..b7718c2
--- /dev/null
@@ -0,0 +1,16 @@
+import sys
+import unittest
+
+try:
+    import grp
+    import pwd
+except ImportError:
+    grp = pwd = None
+
+
+UNIX_ID_SUPPORT = grp and pwd
+UID_0_SUPPORT = UNIX_ID_SUPPORT and sys.platform != "cygwin"
+
+require_unix_id = unittest.skipUnless(
+    UNIX_ID_SUPPORT, "Requires grp and pwd support")
+require_uid_0 = unittest.skipUnless(UID_0_SUPPORT, "Requires UID 0 support")