···30303131 nativeCheckInputs = [
3232 git
3333- pythonPackages.pytestCheckHook
3333+ pythonPackages.pytest7CheckHook
3434 ];
35353636 # 1. git fails to run as it cannot detect the email address, so we set it
···22, autoreconfHook
33, fetchPypi
44, buildPythonPackage
55-, cython_3
55+, cython
66, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
77}:
88···3434 '';
35353636 propagatedBuildInputs = [
3737- cython_3
3737+ cython
3838 ] ++ lib.optionals pariSupport [
3939 # When cysignals is built with pari, including cysignals into the
4040 # buildInputs of another python package will cause cython to link against
+91
pkgs/development/python-modules/cython/0.nix
···11+{ lib
22+, stdenv
33+, buildPythonPackage
44+, fetchPypi
55+, fetchpatch
66+, setuptools
77+, python
88+, pkg-config
99+, gdb
1010+, numpy
1111+, ncurses
1212+}:
1313+1414+let
1515+ excludedTests = [ "reimport_from_subinterpreter" ]
1616+ # cython's testsuite is not working very well with libc++
1717+ # We are however optimistic about things outside of testsuite still working
1818+ ++ lib.optionals (stdenv.cc.isClang or false) [ "cpdef_extern_func" "libcpp_algo" ]
1919+ # Some tests in the test suite isn't working on aarch64. Disable them for
2020+ # now until upstream finds a workaround.
2121+ # Upstream issue here: https://github.com/cython/cython/issues/2308
2222+ ++ lib.optionals stdenv.isAarch64 [ "numpy_memoryview" ]
2323+ ++ lib.optionals stdenv.isi686 [ "future_division" "overflow_check_longlong" ]
2424+ ;
2525+2626+in buildPythonPackage rec {
2727+ pname = "cython";
2828+ version = "0.29.36";
2929+ pyproject = true;
3030+3131+ src = fetchPypi {
3232+ pname = "Cython";
3333+ inherit version;
3434+ hash = "sha256-QcDP0tdU44PJ7rle/8mqSrhH0Ml0cHfd18Dctow7wB8=";
3535+ };
3636+3737+ nativeBuildInputs = [
3838+ pkg-config
3939+ setuptools
4040+ ];
4141+4242+ nativeCheckInputs = [
4343+ gdb numpy ncurses
4444+ ];
4545+4646+ LC_ALL = "en_US.UTF-8";
4747+4848+ patches = [
4949+ # backport Cython 3.0 trashcan support (https://github.com/cython/cython/pull/2842) to 0.X series.
5050+ # it does not affect Python code unless the code explicitly uses the feature.
5151+ # trashcan support is needed to avoid stack overflows during object deallocation in sage (https://trac.sagemath.org/ticket/27267)
5252+ ./trashcan.patch
5353+ # The above commit introduces custom trashcan macros, as well as
5454+ # compiler changes to use them in Cython-emitted code. The latter
5555+ # change is still useful, but the former has been upstreamed as of
5656+ # Python 3.8, and the patch below makes Cython use the upstream
5757+ # trashcan macros whenever available. This is needed for Python
5858+ # 3.11 support, because the API used in Cython's implementation
5959+ # changed: https://github.com/cython/cython/pull/4475
6060+ (fetchpatch {
6161+ name = "disable-trashcan.patch";
6262+ url = "https://github.com/cython/cython/commit/e337825cdcf5e94d38ba06a0cb0188e99ce0cc92.patch";
6363+ hash = "sha256-q0f63eetKrDpmP5Z4v8EuGxg26heSyp/62OYqhRoSso=";
6464+ })
6565+ ];
6666+6767+ checkPhase = ''
6868+ export HOME="$NIX_BUILD_TOP"
6969+ ${python.interpreter} runtests.py -j$NIX_BUILD_CORES \
7070+ --no-code-style \
7171+ ${lib.optionalString (builtins.length excludedTests != 0)
7272+ ''--exclude="(${builtins.concatStringsSep "|" excludedTests})"''}
7373+ '';
7474+7575+ # https://github.com/cython/cython/issues/2785
7676+ # Temporary solution
7777+ doCheck = false;
7878+ # doCheck = !stdenv.isDarwin;
7979+8080+ # force regeneration of generated code in source distributions
8181+ # https://github.com/cython/cython/issues/5089
8282+ setupHook = ./setup-hook.sh;
8383+8484+ meta = {
8585+ changelog = "https://github.com/cython/cython/blob/${version}/CHANGES.rst";
8686+ description = "An optimising static compiler for both the Python programming language and the extended Cython programming language";
8787+ homepage = "https://cython.org";
8888+ license = lib.licenses.asl20;
8989+ maintainers = with lib.maintainers; [ fridh ];
9090+ };
9191+}
···2121, xattr
2222, skia-pathops
2323, uharfbuzz
2424-, pytestCheckHook
2525-, pytest_7
2424+, pytest7CheckHook
2625}:
27262827buildPythonPackage rec {
···6564 nativeCheckInputs = [
6665 # test suite fails with pytest>=8.0.1
6766 # https://github.com/fonttools/fonttools/issues/3458
6868- (pytestCheckHook.override { pytest = pytest_7; })
6767+ pytest7CheckHook
6968 ] ++ lib.concatLists (lib.attrVals ([
7069 "woff"
7170 # "interpolatable" is not included because it only contains 2 tests at the time of writing but adds 270 extra dependencies
···6060 #
6161 postPatch = ''
6262 sed -i "/extra_compile_args.append('-std=c++14')/d" setup.py
6363+6464+ # The former function has been renamed into the latter in Python 3.12.
6565+ # Does not apply to all protobuf versions, hence --replace-warn.
6666+ substituteInPlace google/protobuf/internal/json_format_test.py \
6767+ --replace-warn assertRaisesRegexp assertRaisesRegex
6368 '';
64696570 nativeBuildInputs = lib.optional isPyPy tzdata;
···11-From 64de7911d2938fc3601fec39c08008465b9d4f6f Mon Sep 17 00:00:00 2001
22-From: Nick Cao <nickcao@nichi.co>
33-Date: Tue, 7 Feb 2023 17:12:50 +0800
44-Subject: [PATCH] python: enum: fix build for Python 3.11
55-MIME-Version: 1.0
66-Content-Type: text/plain; charset=UTF-8
77-Content-Transfer-Encoding: 8bit
88-99-Python 3.9 introduced Py_SET_SIZE function to set size instead of
1010-relying on Py_SIZE() as a macro [3.9].
1111-1212-Python 3.10 started to encourage to use Py_SET_SIZE instead of
1313-assigning into return value of Py_SIZE [3.10].
1414-1515-Python 3.11 flips the switch, turn Py_SIZE into a function [3.11],
1616-thus Py_SIZE(obj) will be a rvalue. We need to use Py_SET_SIZE
1717-to set size now.
1818-1919-[3.9]: https://docs.python.org/3.9/c-api/structures.html#c.Py_SET_SIZE
2020-[3.10]: https://docs.python.org/3.10/c-api/structures.html#c.Py_SIZE
2121-[3.11]: https://docs.python.org/3.11/c-api/structures.html#c.Py_SIZE
2222-2323-Adapted from https://github.com/mchehab/zbar/pull/231
2424-2525-Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
2626-Signed-off-by: Nick Cao <nickcao@nichi.co>
2727----
2828- python/enum.c | 8 ++++++++
2929- 1 file changed, 8 insertions(+)
3030-3131-diff --git a/python/enum.c b/python/enum.c
3232-index dfe1b1e..4833a20 100644
3333---- a/python/enum.c
3434-+++ b/python/enum.c
3535-@@ -52,7 +52,11 @@ enumitem_new (PyTypeObject *type,
3636-3737- /* we assume the "fast path" for a single-digit ints (see longobject.c) */
3838- /* this also holds if we get a small_int preallocated long */
3939-+#if PY_VERSION_HEX >= 0x030900A4
4040-+ Py_SET_SIZE(&self->val, Py_SIZE(longval));
4141-+#else
4242- Py_SIZE(&self->val) = Py_SIZE(longval);
4343-+#endif
4444- self->val.ob_digit[0] = longval->ob_digit[0];
4545- Py_DECREF(longval);
4646- #else
4747-@@ -143,7 +147,11 @@ zbarEnumItem_New (PyObject *byname,
4848-4949- /* we assume the "fast path" for a single-digit ints (see longobject.c) */
5050- /* this also holds if we get a small_int preallocated long */
5151-+#if PY_VERSION_HEX >= 0x030900A4
5252-+ Py_SET_SIZE(&self->val, Py_SIZE(longval));
5353-+#else
5454- Py_SIZE(&self->val) = Py_SIZE(longval);
5555-+#endif
5656- self->val.ob_digit[0] = longval->ob_digit[0];
5757- Py_DECREF(longval);
5858-5959---
6060-2.39.1
6161-
···2323 pytestCheckHook
2424 ];
25252626- pytestFlagsArray = [
2727- # pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
2828- "-W" "ignore::pytest.PytestRemovedIn8Warning"
2626+ disabledTestPaths = [
2727+ # https://github.com/celery/vine/issues/106
2828+ "t/unit/test_synchronization.py"
2929 ];
30303131 pythonImportsCheck = [
···3535 __darwinAllowLocalNetworking = true;
36363737 nativeCheckInputs = with python3.pkgs; [
3838- pytestCheckHook
3838+ pytest7CheckHook
3939 waitress
4040- ];
4141-4242- pytestFlagsArray = [
4343- # pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
4444- "-W" "ignore::pytest.PytestRemovedIn8Warning"
4540 ];
46414742 passthru.tests = {