]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
python3-setuptools: try to revert one upstream change jansa/master-setuptools
authorMartin Jansa <martin.jansa@gmail.com>
Thu, 5 Sep 2024 11:02:09 +0000 (13:02 +0200)
committerMartin Jansa <martin.jansa@gmail.com>
Thu, 5 Sep 2024 12:40:59 +0000 (14:40 +0200)
Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
meta/recipes-devtools/python/python3-setuptools/0001-Revert-Distutils-C-support.patch [new file with mode: 0644]
meta/recipes-devtools/python/python3-setuptools_72.2.0.bb

diff --git a/meta/recipes-devtools/python/python3-setuptools/0001-Revert-Distutils-C-support.patch b/meta/recipes-devtools/python/python3-setuptools/0001-Revert-Distutils-C-support.patch
new file mode 100644 (file)
index 0000000..6e59258
--- /dev/null
@@ -0,0 +1,228 @@
+From ed33e7abb57ddcbe98a8334d29061fe6a8fdfee4 Mon Sep 17 00:00:00 2001
+From: Martin Jansa <martin.jansa@gmail.com>
+Date: Tue, 3 Sep 2024 19:12:51 +0200
+Subject: [PATCH] Revert "Distutils C++ support"
+
+This reverts commit 2c937116cc0dcd9b26b6070e89a3dc5dcbedc2ae.
+
+Upstream-Status: Pending [temporary test]
+
+Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
+---
+ setuptools/_distutils/cygwinccompiler.py | 41 +++++++--------------
+ setuptools/_distutils/sysconfig.py       | 46 ++++++++++++------------
+ setuptools/_distutils/unixccompiler.py   | 21 ++---------
+ 3 files changed, 40 insertions(+), 68 deletions(-)
+
+diff --git a/setuptools/_distutils/cygwinccompiler.py b/setuptools/_distutils/cygwinccompiler.py
+index ce412e832..352547107 100644
+--- a/setuptools/_distutils/cygwinccompiler.py
++++ b/setuptools/_distutils/cygwinccompiler.py
+@@ -65,18 +65,14 @@ class CygwinCCompiler(UnixCCompiler):
+         self.cxx = os.environ.get('CXX', 'g++')
+         self.linker_dll = self.cc
+-        self.linker_dll_cxx = self.cxx
+         shared_option = "-shared"
+         self.set_executables(
+-            compiler=f'{self.cc} -mcygwin -O -Wall',
+-            compiler_so=f'{self.cc} -mcygwin -mdll -O -Wall',
+-            compiler_cxx=f'{self.cxx} -mcygwin -O -Wall',
+-            compiler_so_cxx=f'{self.cxx} -mcygwin -mdll -O -Wall',
+-            linker_exe=f'{self.cc} -mcygwin',
+-            linker_so=f'{self.linker_dll} -mcygwin {shared_option}',
+-            linker_exe_cxx=f'{self.cxx} -mcygwin',
+-            linker_so_cxx=f'{self.linker_dll_cxx} -mcygwin {shared_option}',
++            compiler='%s -mcygwin -O -Wall' % self.cc,
++            compiler_so='%s -mcygwin -mdll -O -Wall' % self.cc,
++            compiler_cxx='%s -mcygwin -O -Wall' % self.cxx,
++            linker_exe='%s -mcygwin' % self.cc,
++            linker_so=('{} -mcygwin {}'.format(self.linker_dll, shared_option)),
+         )
+         self.dll_libraries = get_msvcr()
+@@ -106,17 +102,9 @@ class CygwinCCompiler(UnixCCompiler):
+                 raise CompileError(msg)
+         else:  # for other files use the C-compiler
+             try:
+-                if self.detect_language(src) == 'c++':
+-                    self.spawn(
+-                        self.compiler_so_cxx
+-                        + cc_args
+-                        + [src, '-o', obj]
+-                        + extra_postargs
+-                    )
+-                else:
+-                    self.spawn(
+-                        self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs
+-                    )
++                self.spawn(
++                    self.compiler_so + cc_args + [src, '-o', obj] + extra_postargs
++                )
+             except DistutilsExecError as msg:
+                 raise CompileError(msg)
+@@ -250,14 +238,11 @@ class Mingw32CCompiler(CygwinCCompiler):
+             raise CCompilerError('Cygwin gcc cannot be used with --compiler=mingw32')
+         self.set_executables(
+-            compiler=f'{self.cc} -O -Wall',
+-            compiler_so=f'{self.cc} -shared -O -Wall',
+-            compiler_so_cxx=f'{self.cxx} -shared -O -Wall',
+-            compiler_cxx=f'{self.cxx} -O -Wall',
+-            linker_exe=f'{self.cc}',
+-            linker_so=f'{self.linker_dll} {shared_option}',
+-            linker_exe_cxx=f'{self.cxx}',
+-            linker_so_cxx=f'{self.linker_dll_cxx} {shared_option}',
++            compiler='%s -O -Wall' % self.cc,
++            compiler_so='%s -mdll -O -Wall' % self.cc,
++            compiler_cxx='%s -O -Wall' % self.cxx,
++            linker_exe='%s' % self.cc,
++            linker_so='{} {}'.format(self.linker_dll, shared_option),
+         )
+     def runtime_library_dir_option(self, dir):
+diff --git a/setuptools/_distutils/sysconfig.py b/setuptools/_distutils/sysconfig.py
+index fbdd5d73a..52bea04a9 100644
+--- a/setuptools/_distutils/sysconfig.py
++++ b/setuptools/_distutils/sysconfig.py
+@@ -304,7 +304,6 @@ def customize_compiler(compiler):
+             cflags,
+             ccshared,
+             ldshared,
+-            ldcxxshared,
+             shlib_suffix,
+             ar,
+             ar_flags,
+@@ -314,14 +313,11 @@ def customize_compiler(compiler):
+             'CFLAGS',
+             'CCSHARED',
+             'LDSHARED',
+-            'LDCXXSHARED',
+             'SHLIB_SUFFIX',
+             'AR',
+             'ARFLAGS',
+         )
+-        cxxflags = cflags
+-
+         if 'CC' in os.environ:
+             newcc = os.environ['CC']
+             if 'LDSHARED' not in os.environ and ldshared.startswith(cc):
+@@ -329,42 +325,48 @@ def customize_compiler(compiler):
+                 #       command for LDSHARED as well
+                 ldshared = newcc + ldshared[len(cc) :]
+             cc = newcc
+-        cxx = os.environ.get('CXX', cxx)
+-        ldshared = os.environ.get('LDSHARED', ldshared)
+-        ldcxxshared = os.environ.get('LDCXXSHARED', ldcxxshared)
+-        cpp = os.environ.get(
+-            'CPP',
+-            cc + " -E",  # not always
+-        )
++        if 'CXX' in os.environ:
++            cxx = os.environ['CXX']
++        if 'LDSHARED' in os.environ:
++            ldshared = os.environ['LDSHARED']
++        if 'CPP' in os.environ:
++            cpp = os.environ['CPP']
++        else:
++            cpp = cc + " -E"  # not always
++        if 'LDFLAGS' in os.environ:
++            ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++        if 'CFLAGS' in os.environ:
++            cflags = cflags + ' ' + os.environ['CFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CPPFLAGS' in os.environ:
++            cpp = cpp + ' ' + os.environ['CPPFLAGS']
++            cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++        if 'AR' in os.environ:
++            ar = os.environ['AR']
++        if 'ARFLAGS' in os.environ:
++            archiver = ar + ' ' + os.environ['ARFLAGS']
++        else:
++            archiver = ar + ' ' + ar_flags
+         ldshared = _add_flags(ldshared, 'LD')
+-        ldcxxshared = _add_flags(ldcxxshared, 'LD')
+         cflags = _add_flags(cflags, 'C')
+         ldshared = _add_flags(ldshared, 'C')
+-        cxxflags = os.environ.get('CXXFLAGS', cxxflags)
+-        ldcxxshared = _add_flags(ldcxxshared, 'CXX')
+         cpp = _add_flags(cpp, 'CPP')
+         cflags = _add_flags(cflags, 'CPP')
+-        cxxflags = _add_flags(cxxflags, 'CPP')
+         ldshared = _add_flags(ldshared, 'CPP')
+-        ldcxxshared = _add_flags(ldcxxshared, 'CPP')
+         ar = os.environ.get('AR', ar)
+         archiver = ar + ' ' + os.environ.get('ARFLAGS', ar_flags)
+         cc_cmd = cc + ' ' + cflags
+-        cxx_cmd = cxx + ' ' + cxxflags
+-
+         compiler.set_executables(
+             preprocessor=cpp,
+             compiler=cc_cmd,
+             compiler_so=cc_cmd + ' ' + ccshared,
+-            compiler_cxx=cxx_cmd,
+-            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
++            compiler_cxx=cxx,
+             linker_so=ldshared,
+-            linker_so_cxx=ldcxxshared,
+             linker_exe=cc,
+-            linker_exe_cxx=cxx,
+             archiver=archiver,
+         )
+diff --git a/setuptools/_distutils/unixccompiler.py b/setuptools/_distutils/unixccompiler.py
+index 6c1116ae8..3254c53f2 100644
+--- a/setuptools/_distutils/unixccompiler.py
++++ b/setuptools/_distutils/unixccompiler.py
+@@ -118,12 +118,9 @@ class UnixCCompiler(CCompiler):
+         'preprocessor': None,
+         'compiler': ["cc"],
+         'compiler_so': ["cc"],
+-        'compiler_cxx': ["c++"],
+-        'compiler_so_cxx': ["c++"],
++        'compiler_cxx': ["cc"],
+         'linker_so': ["cc", "-shared"],
+-        'linker_so_cxx': ["c++", "-shared"],
+         'linker_exe': ["cc"],
+-        'linker_exe_cxx': ["c++", "-shared"],
+         'archiver': ["ar", "-cr"],
+         'ranlib': None,
+     }
+@@ -190,14 +187,8 @@ class UnixCCompiler(CCompiler):
+     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+         compiler_so = compiler_fixup(self.compiler_so, cc_args + extra_postargs)
+-        compiler_so_cxx = compiler_fixup(self.compiler_so_cxx, cc_args + extra_postargs)
+         try:
+-            if self.detect_language(src) == 'c++':
+-                self.spawn(
+-                    compiler_so_cxx + cc_args + [src, '-o', obj] + extra_postargs
+-                )
+-            else:
+-                self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
++            self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
+         except DistutilsExecError as msg:
+             raise CompileError(msg)
+@@ -265,13 +256,7 @@ class UnixCCompiler(CCompiler):
+                 # building an executable or linker_so (with shared options)
+                 # when building a shared library.
+                 building_exe = target_desc == CCompiler.EXECUTABLE
+-                linker = (
+-                    self.linker_exe
+-                    if building_exe
+-                    else (
+-                        self.linker_so_cxx if target_lang == "c++" else self.linker_so
+-                    )
+-                )[:]
++                linker = (self.linker_exe if building_exe else self.linker_so)[:]
+                 if target_lang == "c++" and self.compiler_cxx:
+                     env, linker_ne = _split_env(linker)
index 63ea999960ba31f2ae9cad1fe55b272349025c74..bab805b6b2f683d024c46cf512ef3c044d753719 100644 (file)
@@ -9,7 +9,9 @@ inherit pypi python_setuptools_build_meta
 SRC_URI:append:class-native = " file://0001-conditionally-do-not-fetch-code-by-easy_install.patch"
 
 SRC_URI += " \
-            file://0001-_distutils-sysconfig.py-make-it-possible-to-substite.patch"
+    file://0001-_distutils-sysconfig.py-make-it-possible-to-substite.patch \
+    file://0001-Revert-Distutils-C-support.patch \
+"
 
 SRC_URI[sha256sum] = "80aacbf633704e9c8bfa1d99fa5dd4dc59573efcf9e4042c13d3bcef91ac2ef9"