Imported Upstream version 65.2.0 upstream/65.2.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:56 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:56 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
docs/userguide/extension.rst
pytest.ini
setup.cfg
setuptools/_distutils/_msvccompiler.py
setuptools/_distutils/bcppcompiler.py
setuptools/_distutils/ccompiler.py
setuptools/_distutils/cygwinccompiler.py
setuptools/_distutils/sysconfig.py

index 6df865b07b4ec7b2c66e25ff259fe1f8727e6f26..cf3c02a9ac4d3e43f8887ea531afc2fb221bdf75 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 65.1.1
+current_version = 65.2.0
 commit = True
 tag = True
 
index 448c6e8ea49c28818e7397ed240fe60541b341aa..09a7c1bcbdc73dd656a3859c6f3218fe79c2836a 100644 (file)
@@ -1,3 +1,12 @@
+v65.2.0
+-------
+
+
+Changes
+^^^^^^^
+* #3553: Sync with pypa/distutils@22b9bcf, including fixed cross-compiling support and removing deprecation warning per pypa/distutils#169.
+
+
 v65.1.1
 -------
 
index b49816b0070fb89d15439736160010d9771ab8bd..6f8cbbb22cdd41ecc79b9354b3311dfe9c3e7a60 100644 (file)
@@ -57,7 +57,7 @@ a ``foo`` command, you might add something like this to your project:
          foo = mypackage.some_module:foo
 
 Assuming, of course, that the ``foo`` class in ``mypackage.some_module`` is
-a ``setuptools.Command`` subclass (documented bellow).
+a ``setuptools.Command`` subclass (documented below).
 
 Once a project containing such entry points has been activated on ``sys.path``,
 (e.g. by running ``pip install``) the command(s) will be available to any
index 892714bfa80277e9117079deaba9c8b42fa6b7ce..50a7971b714b4010618da0f5105282832ae3d6a4 100644 (file)
@@ -60,7 +60,7 @@ filterwarnings=
        ignore:Setuptools is replacing distutils
 
        # suppress warnings in deprecated msvc compilers
-       ignore:msvc9?compiler is deprecated
+       ignore:(bcpp|msvc9?)compiler is deprecated
 
        ignore:Support for .* in .pyproject.toml. is still .beta.
        ignore::setuptools.command.editable_wheel.InformationOnly
index ca95d7d1ff3a6df5a1deb05ddaaa058b682393fb..16fe9510b9ddc304244285c9c80954abbff948c6 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = setuptools
-version = 65.1.1
+version = 65.2.0
 author = Python Packaging Authority
 author_email = distutils-sig@python.org
 description = Easily download, build, install, upgrade, and uninstall Python packages
index ade80056e9329051171c736103345d1bd7177b94..729c2dd5217528d7b3f9220cc2c7981f95c6f6e1 100644 (file)
@@ -318,38 +318,16 @@ class MSVCCompiler(CCompiler):
 
     # -- Worker methods ------------------------------------------------
 
-    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
-        ext_map = {
-            **{ext: self.obj_extension for ext in self.src_extensions},
+    @property
+    def out_extensions(self):
+        return {
+            **super().out_extensions,
             **{
                 ext: self.res_extension
                 for ext in self._rc_extensions + self._mc_extensions
             },
         }
 
-        output_dir = output_dir or ''
-
-        def make_out_path(p):
-            base, ext = os.path.splitext(p)
-            if strip_dir:
-                base = os.path.basename(base)
-            else:
-                _, base = os.path.splitdrive(base)
-                if base.startswith((os.path.sep, os.path.altsep)):
-                    base = base[1:]
-            try:
-                # XXX: This may produce absurdly long paths. We should check
-                # the length of the result and trim base until we fit within
-                # 260 characters.
-                return os.path.join(output_dir, base + ext_map[ext])
-            except LookupError:
-                # Better to raise an exception instead of silently continuing
-                # and later complain about sources and targets having
-                # different lengths
-                raise CompileError(f"Don't know how to compile {p}")
-
-        return list(map(make_out_path, source_filenames))
-
     def compile(  # noqa: C901
         self,
         sources,
index ee033ed94a1a36eaf82e0a4290ed7198834a1a33..80b6bd852269afc075e38a4280c728f0777c923f 100644 (file)
@@ -13,6 +13,8 @@ for the Borland C++ compiler.
 
 
 import os
+import warnings
+
 from distutils.errors import (
     DistutilsExecError,
     CompileError,
@@ -26,6 +28,14 @@ from distutils.dep_util import newer
 from distutils import log
 
 
+warnings.warn(
+    "bcppcompiler is deprecated and slated to be removed "
+    "in the future. Please discontinue use or file an issue "
+    "with pypa/distutils describing your use case.",
+    DeprecationWarning,
+)
+
+
 class BCPPCompiler(CCompiler):
     """Concrete class that implements an interface to the Borland C/C++
     compiler, as defined by the CCompiler abstract class.
index c8d3b24bc0eefae34a41301896ef9a7815336f73..97551c99fec8ebdaa523bdc22dba80e3447c981a 100644 (file)
@@ -6,7 +6,6 @@ for the Distutils compiler abstraction model."""
 import sys
 import os
 import re
-import warnings
 
 from distutils.errors import (
     CompileError,
@@ -924,37 +923,39 @@ int main (int argc, char **argv) {
     def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
         if output_dir is None:
             output_dir = ''
-        obj_names = []
-        for src_name in source_filenames:
-            base, ext = os.path.splitext(src_name)
-            base = self._mangle_base(base)
-            if ext not in self.src_extensions:
-                raise UnknownFileError(
-                    "unknown file type '{}' (from '{}')".format(ext, src_name)
-                )
-            if strip_dir:
-                base = os.path.basename(base)
-            obj_names.append(os.path.join(output_dir, base + self.obj_extension))
-        return obj_names
+        return list(
+            self._make_out_path(output_dir, strip_dir, src_name)
+            for src_name in source_filenames
+        )
+
+    @property
+    def out_extensions(self):
+        return dict.fromkeys(self.src_extensions, self.obj_extension)
+
+    def _make_out_path(self, output_dir, strip_dir, src_name):
+        base, ext = os.path.splitext(src_name)
+        base = self._make_relative(base)
+        try:
+            new_ext = self.out_extensions[ext]
+        except LookupError:
+            raise UnknownFileError(
+                "unknown file type '{}' (from '{}')".format(ext, src_name)
+            )
+        if strip_dir:
+            base = os.path.basename(base)
+        return os.path.join(output_dir, base + new_ext)
 
     @staticmethod
-    def _mangle_base(base):
+    def _make_relative(base):
         """
-        For unknown reasons, absolute paths are mangled.
+        In order to ensure that a filename always honors the
+        indicated output_dir, make sure it's relative.
+        Ref python/cpython#37775.
         """
         # Chop off the drive
         no_drive = os.path.splitdrive(base)[1]
         # If abs, chop off leading /
-        rel = no_drive[os.path.isabs(no_drive) :]
-        if rel != base:
-            msg = (
-                f"Absolute path {base!r} is being replaced with a "
-                f"relative path {rel!r} for outputs. This behavior is "
-                "deprecated. If this behavior is desired, please "
-                "comment in pypa/distutils#169."
-            )
-            warnings.warn(msg, DeprecationWarning)
-        return rel
+        return no_drive[os.path.isabs(no_drive) :]
 
     def shared_object_filename(self, basename, strip_dir=0, output_dir=''):
         assert output_dir is not None
index 63910f2ac88d857669117e9d6d2d6c02abb3cab8..2c4da5b57e5fda8b1510a61c2f14a61fac1c0916 100644 (file)
@@ -20,7 +20,6 @@ from distutils.errors import (
     DistutilsPlatformError,
     CCompilerError,
     CompileError,
-    UnknownFileError,
 )
 from distutils.version import LooseVersion, suppress_known_deprecation
 
@@ -242,28 +241,20 @@ class CygwinCCompiler(UnixCCompiler):
 
     # -- Miscellaneous methods -----------------------------------------
 
-    def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):
-        """Adds supports for rc and res files."""
-        if output_dir is None:
-            output_dir = ''
-        obj_names = []
-        for src_name in source_filenames:
-            # use normcase to make sure '.rc' is really '.rc' and not '.RC'
-            base, ext = os.path.splitext(os.path.normcase(src_name))
-            if ext not in (self.src_extensions + ['.rc', '.res']):
-                raise UnknownFileError(
-                    "unknown file type '{}' (from '{}')".format(ext, src_name)
-                )
-            if strip_dir:
-                base = os.path.basename(base)
-            if ext in ('.res', '.rc'):
-                # these need to be compiled to object files
-                obj_names.append(
-                    os.path.join(output_dir, base + ext + self.obj_extension)
-                )
-            else:
-                obj_names.append(os.path.join(output_dir, base + self.obj_extension))
-        return obj_names
+    def _make_out_path(self, output_dir, strip_dir, src_name):
+        # use normcase to make sure '.rc' is really '.rc' and not '.RC'
+        norm_src_name = os.path.normcase(src_name)
+        return super()._make_out_path(output_dir, strip_dir, norm_src_name)
+
+    @property
+    def out_extensions(self):
+        """
+        Add support for rc and res files.
+        """
+        return {
+            **super().out_extensions,
+            **{ext: ext + self.obj_extension for ext in ('.res', '.rc')},
+        }
 
 
 # the same as cygwin plus some additional parameters
index aae9c1b320aa5cf5b95ef0fa9c46e43b6e84561f..3dd8185f79f82f661ef7e2ea4960a1cfd9d219c8 100644 (file)
@@ -164,10 +164,19 @@ def _get_python_inc_from_config(plat_specific, spec_prefix):
     the host
     platform Python installation, while the current Python
     executable is from the build platform installation.
+
+    >>> monkeypatch = getfixture('monkeypatch')
+    >>> gpifc = _get_python_inc_from_config
+    >>> monkeypatch.setitem(gpifc.__globals__, 'get_config_var', str.lower)
+    >>> gpifc(False, '/usr/bin/')
+    >>> gpifc(False, '')
+    >>> gpifc(False, None)
+    'includepy'
+    >>> gpifc(True, None)
+    'confincludepy'
     """
-    if not spec_prefix:
-        return
-    return get_config_var('CONF' * plat_specific + 'INCLUDEPY')
+    if spec_prefix is None:
+        return get_config_var('CONF' * plat_specific + 'INCLUDEPY')
 
 
 def _get_python_inc_posix_prefix(prefix):