dev-python/cython: new package, add 0.29.37.1-r1

Closes: #3094
Signed-off-by: Andreas Billmeier <b@edevau.net>
This commit is contained in:
2024-03-31 20:55:16 +02:00
parent 2f804abdd9
commit 700616474a
7 changed files with 183 additions and 5 deletions

View File

@@ -0,0 +1,6 @@
AUX cython-0.29.22-spawn-multiprocessing.patch 963 BLAKE2B ebbc3f6f4fa88e7e082326bccbad328724a4ff5645f0b2aa28f21419044b17bed8495618bb980b23a99310c2b6ef275331e1b9aa6d734017eb33646c92a07a73 SHA512 3f5c6b4108b87cf3014416386095c07ac91762152bbd87e8bd589177d40b933c11e19610bea06720c5c70f76b5b9b70d27e5c3cfa20eed30deaaf7d122910bd3
AUX cython-0.29.23-pythran-parallel-install.patch 874 BLAKE2B 39286ee98427260ce6ec077a750e0a1412445343fd11be9d96d8ab65b7d9789c5f1864cb9a1b3565ee3f51e117ecc854ebacc39dc32917fc72f36340c2d7f0a1 SHA512 8b78755288d3f165d962a5a1be9492d609a8e3dab10197b271c84ed0c4b7006053038e68f18bbb4204e6acba83e3f72ffeabf57ffa03f4a08f28b65db3cfd854
AUX cython-0.29.23-test_exceptions-py310.patch 656 BLAKE2B 6c650c85d01b8bf367528d144cd967fa9def94634e35763e2e7a1c3e5afa2b01d0c84694024dde6e45577eee223f6464b5f88ab971d207d35892edf347a0c08f SHA512 d8f7f770a0b3303552deec0e7d3f9258de1edcd384f4b2c3881634fd21ce847a3d974e9142d1ed2fbe3a549e65292c6690be3a36ab4de52d0593d9831dc2f7ce
AUX cython-0.29.37.1-no-warn-ptr-types.patch 676 BLAKE2B f5dd7a16d263de9508694e6927cd0df7dba69bdcdcb67c7bb905a5f9097cc236ed8d043437817885eeff4cc38b77b59d192ec67307811bb13ae2a2838f7b0cbd SHA512 611b2b4e8cfa95e5a10fb3422fa173402a2b420296e51d7320a10d36fd7786878c2f655e78b106025da865449dd28b7611fa7bcb600d8b99876aa02157d09e49
DIST cython-0.29.37.1.gh.tar.gz 2115631 BLAKE2B b81e527ee1da7d16d074102378b531e4b0c161a3d66e47df46b624b02464cbd5c3d08d0e32f8175d56807ed8c6603108b85953db9f51892cfdf8952b4d287399 SHA512 6038499f13914b8a1957eee4d04e0499f448c89c3d519320e5218bf518aacb7d345f3c48614839222eaee016edf549b719520500b0088d28163635a74d35f3c6
EBUILD cython-0.29.37.1-r1.ebuild 2224 BLAKE2B f6ce259197381fb6e748d340d0e399034c610a2369b865710140a222aba9582120749e13651be8906299230ba001c43bf0ef596c8586391c36aa79c7ed712b68 SHA512 f2e920f6466921bfa00bfcc69ccda1379c1e7b27395828bb6274b3507e71f426d0c24ca2634946d675aca85ca430a68843a230a577564e3f8a7fc519a712c27f

View File

@@ -0,0 +1,97 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DISTUTILS_EXT=1
DISTUTILS_USE_PEP517=setuptools
PYTHON_TESTED=( python3_{10..11} )
# 3.12 not tested yet for https://github.com/cython/cython/issues/5285.
PYTHON_COMPAT=( python3_{11..12} )
PYTHON_REQ_USE="threads(+)"
inherit distutils-r1 multiprocessing toolchain-funcs elisp-common
DESCRIPTION="A Python to C compiler"
HOMEPAGE="
https://cython.org/
https://github.com/cython/cython/
https://pypi.org/project/Cython/
"
SRC_URI="
https://github.com/cython/cython/archive/${PV}.tar.gz
-> ${P}.gh.tar.gz
"
LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 arm arm64 x86"
IUSE="emacs test"
RESTRICT="!test? ( test )"
RDEPEND="
emacs? ( >=app-editors/emacs-23.1:* )
"
BDEPEND="
${RDEPEND}
test? (
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
' "${PYTHON_TESTED[@]}")
)
"
PATCHES=(
"${FILESDIR}/${PN}-0.29.22-spawn-multiprocessing.patch"
"${FILESDIR}/${PN}-0.29.23-test_exceptions-py310.patch"
"${FILESDIR}/${PN}-0.29.23-pythran-parallel-install.patch"
# workaround for https://bugs.gentoo.org/918983
# https://github.com/cython/cython/issues/2747
"${FILESDIR}/${PN}-0.29.37.1-no-warn-ptr-types.patch"
)
SITEFILE=50cython-gentoo.el
distutils_enable_sphinx docs
python_compile() {
# Python gets confused when it is in sys.path before build.
local -x PYTHONPATH=
distutils-r1_python_compile
}
python_compile_all() {
use emacs && elisp-compile Tools/cython-mode.el
}
python_test() {
if ! has "${EPYTHON/./_}" "${PYTHON_TESTED[@]}"; then
einfo "Skipping tests on ${EPYTHON} (xfail)"
return
fi
tc-export CC
# https://github.com/cython/cython/issues/1911
local -x CFLAGS="${CFLAGS} -fno-strict-overflow"
"${PYTHON}" runtests.py -vv -j "$(makeopts_jobs)" --work-dir "${BUILD_DIR}"/tests ||
die "Tests fail with ${EPYTHON}"
}
python_install_all() {
local DOCS=( CHANGES.rst README.rst ToDo.txt USAGE.txt )
distutils-r1_python_install_all
if use emacs; then
elisp-install ${PN} Tools/cython-mode.*
elisp-site-file-install "${FILESDIR}/${SITEFILE}"
fi
}
pkg_postinst() {
use emacs && elisp-site-regen
}
pkg_postrm() {
use emacs && elisp-site-regen
}

View File

@@ -0,0 +1,27 @@
Needed to prevent a loop while calling cythonize on macOS - or any platform
defaulting to the 'spawn' method, as Python 3.8 does on Darwin.
https://github.com/cython/cython/pull/3263
[Rebased on 0.29.22]
From 15ae78bb74a856836dd64828326f4f0812d36520 Mon Sep 17 00:00:00 2001
From: Marcel Bargull <marcel.bargull@udo.edu>
Date: Fri, 6 Dec 2019 18:21:19 +0100
Subject: [PATCH] Disable parallel cythonization for "spawn" start method.
---
--- a/Cython/Build/Dependencies.py
+++ b/Cython/Build/Dependencies.py
@@ -1071,6 +1071,11 @@ def cythonize(module_list, exclude=None, nthreads=0, aliases=None, quiet=False,
if N <= 1:
nthreads = 0
+ if nthreads:
+ import multiprocessing
+ if multiprocessing.get_start_method() == 'spawn':
+ print('Disabling parallel cythonization for "spawn" process start method.')
+ nthreads = 0
if nthreads:
# Requires multiprocessing (or Python >= 2.6)
try:

View File

@@ -0,0 +1,20 @@
An empty directory in site-packages is a valid Python module, unfortunately, because
of namespaces. If installing packages in parallel, the pythran module might "exist"
but be empty (hence no __version__ attribute). Catch AttributeError to avoid a narrow
race.
See https://bugs.gentoo.org/902713.
This might still be a Portage issue if there's a substantial delay between creating
the directory and installing the remaining files though.
--- a/Cython/Compiler/Pythran.py
+++ b/Cython/Compiler/Pythran.py
@@ -10,7 +10,7 @@ try:
import pythran
pythran_is_pre_0_9 = tuple(map(int, pythran.__version__.split('.')[0:2])) < (0, 9)
pythran_is_pre_0_9_6 = tuple(map(int, pythran.__version__.split('.')[0:3])) < (0, 9, 6)
-except ImportError:
+except (AttributeError, ImportError):
pythran = None
pythran_is_pre_0_9 = True
pythran_is_pre_0_9_6 = True

View File

@@ -0,0 +1,14 @@
--- a/tests/run/test_exceptions.pyx
+++ b/tests/run/test_exceptions.pyx
@@ -188,7 +188,10 @@
# should not apply to subclasses, see issue #31161
s = '''if True:\nprint "No indent"'''
- ckmsg(s, "expected an indented block", IndentationError)
+ if sys.version_info >= (3, 10):
+ ckmsg(s, "expected an indented block after 'if' statement on line 1", IndentationError)
+ else:
+ ckmsg(s, "expected an indented block", IndentationError)
s = '''if True:\n print()\n\texec "mixed tabs and spaces"'''
ckmsg(s, "inconsistent use of tabs and spaces in indentation", TabError)

View File

@@ -0,0 +1,14 @@
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py
index e9bfa9fe9..43be47dd5 100644
--- a/Cython/Compiler/ModuleNode.py
+++ b/Cython/Compiler/ModuleNode.py
@@ -376,6 +376,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.generate_includes(env, modules, code, early=False)
code = globalstate['all_the_rest']
+ # Gentoo: workaround for https://github.com/cython/cython/issues/2747
+ # https://bugs.gentoo.org/918983
+ code.putln('#pragma GCC diagnostic ignored "-Wincompatible-pointer-types"')
self.generate_cached_builtins_decls(env, code)
self.generate_lambda_definitions(env, code)