commit: 690d570622ab59c10a018f7ce8fe0164571a6835 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Mon May 13 14:00:03 2024 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Mon May 13 14:03:17 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=690d5706
dev-python/immutables: Add a patch to control ext build via envvar Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../immutables/files/immutables-0.20-opt-ext.patch | 28 ++++++++++++++++++++++ dev-python/immutables/immutables-0.20.ebuild | 13 ++++++---- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/dev-python/immutables/files/immutables-0.20-opt-ext.patch b/dev-python/immutables/files/immutables-0.20-opt-ext.patch new file mode 100644 index 000000000000..6dbcb183a612 --- /dev/null +++ b/dev-python/immutables/files/immutables-0.20-opt-ext.patch @@ -0,0 +1,28 @@ +From b1cb26389d8c8aa646c4debae429fb1515408812 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]> +Date: Mon, 13 May 2024 15:51:04 +0200 +Subject: [PATCH] Support disabling C extensions via IMMUTABLES_EXT=0 + +Support using IMMUTABLES_EXT environment variable to control whether +the C extension is built explicitly. When set to a value other than 1, +the extension built is disabled. This is helpful e.g. for future Python +versions where the extension does not work (this is affecting 3.13 right +now, but having an explicit option is more future-proof). +--- + setup.py | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 8cfc9c97..870de2d1 100644 +--- a/setup.py ++++ b/setup.py +@@ -27,7 +27,8 @@ + 'unable to read the version from immutables/_version.py') + + +-if platform.python_implementation() == 'CPython': ++if (platform.python_implementation() == 'CPython' and ++ os.environ.get('IMMUTABLES_EXT', '1') == '1'): + if os.environ.get("DEBUG_IMMUTABLES") == '1': + define_macros = [] + undef_macros = ['NDEBUG'] diff --git a/dev-python/immutables/immutables-0.20.ebuild b/dev-python/immutables/immutables-0.20.ebuild index bac9e6016261..9d290cc6d6e8 100644 --- a/dev-python/immutables/immutables-0.20.ebuild +++ b/dev-python/immutables/immutables-0.20.ebuild @@ -1,4 +1,4 @@ -# Copyright 2019-2023 Gentoo Authors +# Copyright 2019-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 @@ -27,17 +27,19 @@ IUSE="+native-extensions" distutils_enable_tests pytest src_prepare() { + local PATCHES=( + # https://github.com/MagicStack/immutables/pull/117 + "${FILESDIR}/${P}-opt-ext.patch" + ) + sed -i -e '/mypy/d' tests/conftest.py || die - # NB: upstream never builds extensions on PyPy - if ! use native-extensions; then - sed -i -e '/ext_modules=/d' setup.py || die - fi distutils-r1_src_prepare } python_compile() { # upstream controls NDEBUG explicitly use debug && local -x DEBUG_IMMUTABLES=1 + local -x IMMUTABLES_EXT=$(usex native-extensions 1 0) distutils-r1_python_compile } @@ -47,5 +49,6 @@ python_test() { ) rm -rf immutables || die + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 epytest }
