diff options
| author | Michał Górny <mgorny@gentoo.org> | 2023-07-31 09:17:38 +0200 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2023-07-31 09:21:19 +0200 |
| commit | e1505ba25edfd5dde254e3719460b56e60695261 (patch) | |
| tree | 1d4125b7c1c3156dcf67d30e68fb1b802f67d18a /dev-python | |
| parent | 1ca23290ed3de93e99f4250da4bad4f9d1572bb5 (diff) | |
| download | gentoo-e1505ba25edfd5dde254e3719460b56e60695261.tar.gz gentoo-e1505ba25edfd5dde254e3719460b56e60695261.tar.bz2 gentoo-e1505ba25edfd5dde254e3719460b56e60695261.zip | |
dev-python/cftime: Backport cython-3 fix
Bug: https://github.com/Unidata/cftime/issues/271
Closes: https://bugs.gentoo.org/898668
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python')
| -rw-r--r-- | dev-python/cftime/cftime-1.6.2-r1.ebuild (renamed from dev-python/cftime/cftime-1.6.2.ebuild) | 6 | ||||
| -rw-r--r-- | dev-python/cftime/files/cftime-1.6.2-cython-3.patch | 34 |
2 files changed, 39 insertions, 1 deletions
diff --git a/dev-python/cftime/cftime-1.6.2.ebuild b/dev-python/cftime/cftime-1.6.2-r1.ebuild index c1341db6add8..c7709831ca42 100644 --- a/dev-python/cftime/cftime-1.6.2.ebuild +++ b/dev-python/cftime/cftime-1.6.2-r1.ebuild @@ -26,12 +26,16 @@ RDEPEND=" ${DEPEND} " BDEPEND=" - <dev-python/cython-3[${PYTHON_USEDEP}] + >=dev-python/cython-0.29.20[${PYTHON_USEDEP}] " distutils_enable_tests pytest python_prepare_all() { + local PATCHES=( + "${FILESDIR}/${P}-cython-3.patch" + ) + # remove pytest-cov dep sed -e "/--cov/d" -i setup.cfg || die diff --git a/dev-python/cftime/files/cftime-1.6.2-cython-3.patch b/dev-python/cftime/files/cftime-1.6.2-cython-3.patch new file mode 100644 index 000000000000..c52ebdb3c84f --- /dev/null +++ b/dev-python/cftime/files/cftime-1.6.2-cython-3.patch @@ -0,0 +1,34 @@ +From 31f782aed3de56300886dd7350f1faff657e14dd Mon Sep 17 00:00:00 2001 +From: Spencer Clark <spencerkclark@gmail.com> +Date: Sat, 29 Jul 2023 09:51:10 -0400 +Subject: [PATCH] Set c_api_binop_methods compiler directive to True + +This retains Cython 0.x behavior for arithmetic operators for +Cython >= 3.0.0. +--- + Changelog | 2 ++ + pyproject.toml | 2 +- + requirements-dev.txt | 2 +- + setup.py | 9 ++++++++- + 4 files changed, 12 insertions(+), 3 deletions(-) + +diff --git a/setup.py b/setup.py +index 006f1a92..360396fa 100644 +--- a/setup.py ++++ b/setup.py +@@ -16,7 +16,14 @@ + BASEDIR = os.path.abspath(os.path.dirname(__file__)) + SRCDIR = os.path.join(BASEDIR,'src') + CMDS_NOCYTHONIZE = ['clean','clean_cython','sdist'] +-COMPILER_DIRECTIVES = {} ++COMPILER_DIRECTIVES = { ++ # Cython 3.0.0 changes the default of the c_api_binop_methods directive to ++ # False, resulting in errors in datetime and timedelta arithmetic: ++ # https://github.com/Unidata/cftime/issues/271. We explicitly set it to ++ # True to retain Cython 0.x behavior for future Cython versions. This ++ # directive was added in Cython version 0.29.20. ++ "c_api_binop_methods": True ++} + DEFINE_MACROS = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] + FLAG_COVERAGE = '--cython-coverage' # custom flag enabling Cython line tracing + NAME = 'cftime' |
