From 700616474a2aed003618be0c1846f589046c6f07 Mon Sep 17 00:00:00 2001 From: Andreas Billmeier Date: Sun, 31 Mar 2024 20:55:16 +0200 Subject: [PATCH] dev-python/cython: new package, add 0.29.37.1-r1 Closes: https://git.edevau.net/onkelbeh/HomeAssistantRepository/issues/3094 Signed-off-by: Andreas Billmeier --- README.md | 10 +- dev-python/cython/Manifest | 6 ++ dev-python/cython/cython-0.29.37.1-r1.ebuild | 97 +++++++++++++++++++ ...cython-0.29.22-spawn-multiprocessing.patch | 27 ++++++ ...hon-0.29.23-pythran-parallel-install.patch | 20 ++++ ...cython-0.29.23-test_exceptions-py310.patch | 14 +++ .../cython-0.29.37.1-no-warn-ptr-types.patch | 14 +++ 7 files changed, 183 insertions(+), 5 deletions(-) create mode 100644 dev-python/cython/Manifest create mode 100644 dev-python/cython/cython-0.29.37.1-r1.ebuild create mode 100644 dev-python/cython/files/cython-0.29.22-spawn-multiprocessing.patch create mode 100644 dev-python/cython/files/cython-0.29.23-pythran-parallel-install.patch create mode 100644 dev-python/cython/files/cython-0.29.23-test_exceptions-py310.patch create mode 100644 dev-python/cython/files/cython-0.29.37.1-no-warn-ptr-types.patch diff --git a/README.md b/README.md index 5505fcd9f..09cef6c51 100644 --- a/README.md +++ b/README.md @@ -617,12 +617,12 @@ A daily compile test is run at Github with Python 3.9 to catch general faults. E ## Licenses This repository itself is released under GPL-3 (like most Gentoo repositories), all work on the depending components under the licenses they came from. Perhaps you came here because I filed an issue at your component about a bad or missing license. It is easy to [assign a license](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository). During cleanups and license investigations I have been asked often which license to choose. I am not a lawyer, but I can offer the following table, counted over this repository, perhaps this helps your decision. If a package has more than one license listed, all of them are counted. -There are 1942 Ebuilds in total, 1931 of them have in total 1950 (42 different) licenses assigned. +There are 1940 Ebuilds in total, 1929 of them have in total 1948 (42 different) licenses assigned. |License| Ebuilds using it| |-------|-----| -|MIT|1090| -|Apache-2.0|449| +|MIT|1092| +|Apache-2.0|445| |GPL-3|130| |BSD|110| |LGPL-3|25| @@ -664,9 +664,9 @@ There are 1942 Ebuilds in total, 1931 of them have in total 1950 (42 different) |GPL-2+|1| |GPL-2-with-linking-exception|1| -(Last counted: 24/03/2024) +(Last counted: 31/03/2024) I did my best to keep these clean. If a valid license was published on PyPI, it has been automatically merged. Otherwise I took it from GitHub or alternatively from comments/files in the source. Sometimes these differed and have been not unique. All license strings are adjusted to the list in `/usr/portage/gentoo/licenses/`. Some packages do not have any license published. In this case, Authors have been asked for clarification, some did not respond. Following the [official Gentoo Guide](https://devmanual.gentoo.org/general-concepts/licenses/index.html), these then were added with an `all-rights-reserved` license and `RESTRICT="mirror"` was set. Find the appropriate licenses referenced in the Ebuild files and in the corresponding homepages or sources. A big thanks goes to Iris for reviewing this README. -Last updated: 24/03/2024 +Last updated: 31/03/2024 diff --git a/dev-python/cython/Manifest b/dev-python/cython/Manifest new file mode 100644 index 000000000..85ab845d5 --- /dev/null +++ b/dev-python/cython/Manifest @@ -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 diff --git a/dev-python/cython/cython-0.29.37.1-r1.ebuild b/dev-python/cython/cython-0.29.37.1-r1.ebuild new file mode 100644 index 000000000..4bd0b605d --- /dev/null +++ b/dev-python/cython/cython-0.29.37.1-r1.ebuild @@ -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 +} diff --git a/dev-python/cython/files/cython-0.29.22-spawn-multiprocessing.patch b/dev-python/cython/files/cython-0.29.22-spawn-multiprocessing.patch new file mode 100644 index 000000000..15b6f968e --- /dev/null +++ b/dev-python/cython/files/cython-0.29.22-spawn-multiprocessing.patch @@ -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 +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: diff --git a/dev-python/cython/files/cython-0.29.23-pythran-parallel-install.patch b/dev-python/cython/files/cython-0.29.23-pythran-parallel-install.patch new file mode 100644 index 000000000..450007b56 --- /dev/null +++ b/dev-python/cython/files/cython-0.29.23-pythran-parallel-install.patch @@ -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 diff --git a/dev-python/cython/files/cython-0.29.23-test_exceptions-py310.patch b/dev-python/cython/files/cython-0.29.23-test_exceptions-py310.patch new file mode 100644 index 000000000..0c9fb2c9e --- /dev/null +++ b/dev-python/cython/files/cython-0.29.23-test_exceptions-py310.patch @@ -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) diff --git a/dev-python/cython/files/cython-0.29.37.1-no-warn-ptr-types.patch b/dev-python/cython/files/cython-0.29.37.1-no-warn-ptr-types.patch new file mode 100644 index 000000000..b7a9d19a2 --- /dev/null +++ b/dev-python/cython/files/cython-0.29.37.1-no-warn-ptr-types.patch @@ -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)