From 21b3f9ceef131258a721b1b29e52d0f9c4fd2ea4 Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sat, 13 Jan 2024 19:05:12 +0100 Subject: Move {dev-util → dev-build}/meson MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny Closes: https://github.com/gentoo/gentoo/pull/34790 Signed-off-by: Michał Górny --- ...le-stop-using-distutils-link-to-libpython.patch | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 dev-build/meson/files/1.2.2/0004-python-module-stop-using-distutils-link-to-libpython.patch (limited to 'dev-build/meson/files/1.2.2/0004-python-module-stop-using-distutils-link-to-libpython.patch') diff --git a/dev-build/meson/files/1.2.2/0004-python-module-stop-using-distutils-link-to-libpython.patch b/dev-build/meson/files/1.2.2/0004-python-module-stop-using-distutils-link-to-libpython.patch new file mode 100644 index 000000000000..2ebdbcc2b30f --- /dev/null +++ b/dev-build/meson/files/1.2.2/0004-python-module-stop-using-distutils-link-to-libpython.patch @@ -0,0 +1,72 @@ +From 3c493dae4bd8410bfb09e8f654605f65e15d8e66 Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Tue, 22 Nov 2022 22:56:10 -0500 +Subject: [PATCH 4/7] python module: stop using distutils "link to libpython" + probe on recent python + +On python >=3.8, this information is expected to be encoded in the +sysconfig vars. + +In distutils, it is always necessary to link to libpython on Windows; +for posix platforms, it depends on the value of LIBPYTHON (which is the +library to link to, possibly the empty string) as generated by +configure.ac and embedded into python.pc and python-config.sh, and then +coded a second time in the distutils python sources. + +There are a couple of caveats which have ramifications for Cygwin and +Android: + +- python.pc and python-config.sh disagree with distutils when python is + not built shared. In that case, the former act the same as a shared + build, while the latter *never* links to libpython + +- python.pc disagrees with python-config.sh and distutils when python is + built shared. The former never links to libpython, while the latter do + +The disagreement is resolved in favor of distutils' behavior in all +cases, and python.pc is correct for our purposes on python 3.12; see: +https://github.com/python/cpython/pull/100356 +https://github.com/python/cpython/pull/100967 + +Although it was not backported to older releases, Cygwin at least has +always patched in a fix for python.pc, which behavior is now declared +canonical. We can reliably assume it is always correct. + +This is the other half of the fix for #7702 + +(cherry picked from commit 2d6c10908b3771216e7ce086af1ee4dc77e698c2) +--- + mesonbuild/scripts/python_info.py | 17 +++++++++++++---- + 1 file changed, 13 insertions(+), 4 deletions(-) + +diff --git a/mesonbuild/scripts/python_info.py b/mesonbuild/scripts/python_info.py +index d17b3a376..a3f3d3535 100755 +--- a/mesonbuild/scripts/python_info.py ++++ b/mesonbuild/scripts/python_info.py +@@ -64,10 +64,19 @@ def get_install_paths(): + paths, install_paths = get_install_paths() + + def links_against_libpython(): +- from distutils.core import Distribution, Extension +- cmd = Distribution().get_command_obj('build_ext') +- cmd.ensure_finalized() +- return bool(cmd.get_libraries(Extension('dummy', []))) ++ # on versions supporting python-embed.pc, this is the non-embed lib ++ # ++ # PyPy is not yet up to 3.12 and work is still pending to export the ++ # relevant information (it doesn't automatically provide arbitrary ++ # Makefile vars) ++ if sys.version_info >= (3, 8) and not is_pypy: ++ variables = sysconfig.get_config_vars() ++ return bool(variables.get('LIBPYTHON', 'yes')) ++ else: ++ from distutils.core import Distribution, Extension ++ cmd = Distribution().get_command_obj('build_ext') ++ cmd.ensure_finalized() ++ return bool(cmd.get_libraries(Extension('dummy', []))) + + variables = sysconfig.get_config_vars() + variables.update({'base_prefix': getattr(sys, 'base_prefix', sys.prefix)}) +-- +2.42.0 + -- cgit v1.2.3-65-gdbad