···3031 nativeCheckInputs = [
32 git
33- pythonPackages.pytestCheckHook
34 ];
3536 # 1. git fails to run as it cannot detect the email address, so we set it
···3031 nativeCheckInputs = [
32 git
33+ pythonPackages.pytest7CheckHook
34 ];
3536 # 1. git fails to run as it cannot detect the email address, so we set it
···2, autoreconfHook
3, fetchPypi
4, buildPythonPackage
5-, cython_3
6, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
7}:
8···34 '';
3536 propagatedBuildInputs = [
37- cython_3
38 ] ++ lib.optionals pariSupport [
39 # When cysignals is built with pari, including cysignals into the
40 # buildInputs of another python package will cause cython to link against
···2, autoreconfHook
3, fetchPypi
4, buildPythonPackage
5+, cython
6, pariSupport ? true, pari # for interfacing with the PARI/GP signal handler
7}:
8···34 '';
3536 propagatedBuildInputs = [
37+ cython
38 ] ++ lib.optionals pariSupport [
39 # When cysignals is built with pari, including cysignals into the
40 # buildInputs of another python package will cause cython to link against
···2, stdenv
3, buildPythonPackage
4, fetchPypi
5-, fetchpatch
6, setuptools
7, python
8, pkg-config
···2526in buildPythonPackage rec {
27 pname = "cython";
28- version = "0.29.36";
29 pyproject = true;
3031 src = fetchPypi {
32 pname = "Cython";
33 inherit version;
34- hash = "sha256-QcDP0tdU44PJ7rle/8mqSrhH0Ml0cHfd18Dctow7wB8=";
35 };
3637- nativeBuildInputs = [
38 pkg-config
39 setuptools
40 ];
···43 gdb numpy ncurses
44 ];
4546- LC_ALL = "en_US.UTF-8";
47-48- patches = [
49- # backport Cython 3.0 trashcan support (https://github.com/cython/cython/pull/2842) to 0.X series.
50- # it does not affect Python code unless the code explicitly uses the feature.
51- # trashcan support is needed to avoid stack overflows during object deallocation in sage (https://trac.sagemath.org/ticket/27267)
52- ./trashcan.patch
53- # The above commit introduces custom trashcan macros, as well as
54- # compiler changes to use them in Cython-emitted code. The latter
55- # change is still useful, but the former has been upstreamed as of
56- # Python 3.8, and the patch below makes Cython use the upstream
57- # trashcan macros whenever available. This is needed for Python
58- # 3.11 support, because the API used in Cython's implementation
59- # changed: https://github.com/cython/cython/pull/4475
60- (fetchpatch {
61- name = "disable-trashcan.patch";
62- url = "https://github.com/cython/cython/commit/e337825cdcf5e94d38ba06a0cb0188e99ce0cc92.patch";
63- hash = "sha256-q0f63eetKrDpmP5Z4v8EuGxg26heSyp/62OYqhRoSso=";
64- })
65- ];
6667 checkPhase = ''
68 export HOME="$NIX_BUILD_TOP"
···21, xattr
22, skia-pathops
23, uharfbuzz
24-, pytestCheckHook
25-, pytest_7
26}:
2728buildPythonPackage rec {
···65 nativeCheckInputs = [
66 # test suite fails with pytest>=8.0.1
67 # https://github.com/fonttools/fonttools/issues/3458
68- (pytestCheckHook.override { pytest = pytest_7; })
69 ] ++ lib.concatLists (lib.attrVals ([
70 "woff"
71 # "interpolatable" is not included because it only contains 2 tests at the time of writing but adds 270 extra dependencies
···21, xattr
22, skia-pathops
23, uharfbuzz
24+, pytest7CheckHook
025}:
2627buildPythonPackage rec {
···64 nativeCheckInputs = [
65 # test suite fails with pytest>=8.0.1
66 # https://github.com/fonttools/fonttools/issues/3458
67+ pytest7CheckHook
68 ] ++ lib.concatLists (lib.attrVals ([
69 "woff"
70 # "interpolatable" is not included because it only contains 2 tests at the time of writing but adds 270 extra dependencies
···60 #
61 postPatch = ''
62 sed -i "/extra_compile_args.append('-std=c++14')/d" setup.py
63+64+ # The former function has been renamed into the latter in Python 3.12.
65+ # Does not apply to all protobuf versions, hence --replace-warn.
66+ substituteInPlace google/protobuf/internal/json_format_test.py \
67+ --replace-warn assertRaisesRegexp assertRaisesRegex
68 '';
6970 nativeBuildInputs = lib.optional isPyPy tzdata;
···1-From 64de7911d2938fc3601fec39c08008465b9d4f6f Mon Sep 17 00:00:00 2001
2-From: Nick Cao <nickcao@nichi.co>
3-Date: Tue, 7 Feb 2023 17:12:50 +0800
4-Subject: [PATCH] python: enum: fix build for Python 3.11
5-MIME-Version: 1.0
6-Content-Type: text/plain; charset=UTF-8
7-Content-Transfer-Encoding: 8bit
8-9-Python 3.9 introduced Py_SET_SIZE function to set size instead of
10-relying on Py_SIZE() as a macro [3.9].
11-12-Python 3.10 started to encourage to use Py_SET_SIZE instead of
13-assigning into return value of Py_SIZE [3.10].
14-15-Python 3.11 flips the switch, turn Py_SIZE into a function [3.11],
16-thus Py_SIZE(obj) will be a rvalue. We need to use Py_SET_SIZE
17-to set size now.
18-19-[3.9]: https://docs.python.org/3.9/c-api/structures.html#c.Py_SET_SIZE
20-[3.10]: https://docs.python.org/3.10/c-api/structures.html#c.Py_SIZE
21-[3.11]: https://docs.python.org/3.11/c-api/structures.html#c.Py_SIZE
22-23-Adapted from https://github.com/mchehab/zbar/pull/231
24-25-Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
26-Signed-off-by: Nick Cao <nickcao@nichi.co>
27----
28- python/enum.c | 8 ++++++++
29- 1 file changed, 8 insertions(+)
30-31-diff --git a/python/enum.c b/python/enum.c
32-index dfe1b1e..4833a20 100644
33---- a/python/enum.c
34-+++ b/python/enum.c
35-@@ -52,7 +52,11 @@ enumitem_new (PyTypeObject *type,
36-37- /* we assume the "fast path" for a single-digit ints (see longobject.c) */
38- /* this also holds if we get a small_int preallocated long */
39-+#if PY_VERSION_HEX >= 0x030900A4
40-+ Py_SET_SIZE(&self->val, Py_SIZE(longval));
41-+#else
42- Py_SIZE(&self->val) = Py_SIZE(longval);
43-+#endif
44- self->val.ob_digit[0] = longval->ob_digit[0];
45- Py_DECREF(longval);
46- #else
47-@@ -143,7 +147,11 @@ zbarEnumItem_New (PyObject *byname,
48-49- /* we assume the "fast path" for a single-digit ints (see longobject.c) */
50- /* this also holds if we get a small_int preallocated long */
51-+#if PY_VERSION_HEX >= 0x030900A4
52-+ Py_SET_SIZE(&self->val, Py_SIZE(longval));
53-+#else
54- Py_SIZE(&self->val) = Py_SIZE(longval);
55-+#endif
56- self->val.ob_digit[0] = longval->ob_digit[0];
57- Py_DECREF(longval);
58-59---
60-2.39.1
61-
···23 pytestCheckHook
24 ];
2526- pytestFlagsArray = [
27- # pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
28- "-W" "ignore::pytest.PytestRemovedIn8Warning"
29 ];
3031 pythonImportsCheck = [
···35 __darwinAllowLocalNetworking = true;
3637 nativeCheckInputs = with python3.pkgs; [
38- pytestCheckHook
39 waitress
40- ];
41-42- pytestFlagsArray = [
43- # pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
44- "-W" "ignore::pytest.PytestRemovedIn8Warning"
45 ];
4647 passthru.tests = {
···71 ];
7273 nativeCheckInputs = with python3.pkgs; [
74- (pytestCheckHook.override { pytest = pytest_7; })
75 httpretty
76 dmidecode
77 # needed for tests; at runtime we rather want the setuid wrapper
···71 ];
7273 nativeCheckInputs = with python3.pkgs; [
74+ pytest7CheckHook
75 httpretty
76 dmidecode
77 # needed for tests; at runtime we rather want the setuid wrapper