From b6c701539d2c1e19ce4f18659fbf3f10abb7a1e2 Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Mon, 7 Aug 2023 07:10:48 +0000 Subject: [PATCH] dev-python/cython: Sync with Gentoo It's from Gentoo commit e1e8c193a6ce07f105dc3767bed420b7010eefd9. --- .../portage-stable/dev-python/cython/Manifest | 3 +- ...beta3-r2.ebuild => cython-3.0.0-r1.ebuild} | 22 +- ...n-3.0.0_rc2.ebuild => cython-3.0.0.ebuild} | 0 .../cython-3.0.0-version-stderr-stdout.patch | 35 +++ .../files/cython-3.0.0_beta3-const-iter.patch | 207 ------------------ .../files/cython-3.0.0_beta3-py312-long.patch | 28 --- 6 files changed, 49 insertions(+), 246 deletions(-) rename sdk_container/src/third_party/portage-stable/dev-python/cython/{cython-3.0.0_beta3-r2.ebuild => cython-3.0.0-r1.ebuild} (80%) rename sdk_container/src/third_party/portage-stable/dev-python/cython/{cython-3.0.0_rc2.ebuild => cython-3.0.0.ebuild} (100%) create mode 100644 sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0-version-stderr-stdout.patch delete mode 100644 sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch delete mode 100644 sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-py312-long.patch diff --git a/sdk_container/src/third_party/portage-stable/dev-python/cython/Manifest b/sdk_container/src/third_party/portage-stable/dev-python/cython/Manifest index 2678fda9c1..17c5782636 100644 --- a/sdk_container/src/third_party/portage-stable/dev-python/cython/Manifest +++ b/sdk_container/src/third_party/portage-stable/dev-python/cython/Manifest @@ -1,5 +1,4 @@ DIST cython-0.29.34.gh.tar.gz 2114639 BLAKE2B c5f70fd3e6074d9030a1035bc98d71b703e0f391b61bd91f3ffba2c35a29a98b9ff8ef2047e7c75743ead280f0f06a924abe84ae8bf7696b65da662a3c58ee0c SHA512 51679d1304d0f87dfb51e60c753f1ce60027f855a91cf130a5dcf84353884a7dcf09c01701945ae2f9173f8f095890c377d5faac28c2f01d7f764609c0130411 DIST cython-0.29.35.gh.tar.gz 2115190 BLAKE2B ac23abbd2b560ee52a79840d995a4cf36ddb3a8705b9327010f1ad6add8028185c15703efcc1d59b581d65b5de38e123c0f07c36fe6ffe54a6efee7512161344 SHA512 35d679d94e1f731e004b83fb4ae0d569703b0800c913012308146b1c54463ce12cb1cf3733e24162fb357f179444c5ca31108a37850e6c749ddebac5175119f5 DIST cython-0.29.36.gh.tar.gz 2115333 BLAKE2B 6d43779c7222ff65d7de3a35ec18ef636480807d53480a8f94cc8c92d462fcc2f4d201a3bbf6e840a11fd33025e32c53f85626b05c131d10eed2859cdca7eb2d SHA512 a086fe1a11290cd3c870b891e61a0a0e2595bab9c26888024a758b6950c07059346d682fa9349e46c0af89805abbdd750059b3189960b8ce18007dfb5eb4391a -DIST cython-3.0.0b3.gh.tar.gz 2688784 BLAKE2B 933bb48b2bf5169c973a36c877a36eae28b80409a7ff395b82a14ac0740247496df3c9f2d69884c823b7475069f0c75d6cbbb964b88de60b38082e6e36659bff SHA512 f1d0fdcec4bc6b0f6cb66078592424fdcb7a028b79c5b9d41280ae112235736d11c9f4f793e810007e880ae0def195ac25999db59065c7f7bdcfab84b06bf7d3 -DIST cython-3.0.0rc2.gh.tar.gz 2713358 BLAKE2B 5d1e1043e0785c4e79441e47ab6d03b7dbdff8728946707acd39452c1a20e3527e3142bbf09d140d28e233ef0ae0e870650f5f77a8d2a1d084199b5b39937463 SHA512 42ff1b3f2509c90be6007b9156454ae89c1be26a9dde6ca9c109b0cfa3de30797eeeffef38ea1bfe37a9c8e062c776c8cb755826f8c25aa7c9703fbb031bf643 +DIST cython-3.0.0.gh.tar.gz 2713478 BLAKE2B 16be50b463cf155417fee02b4529bbde8c4402bac0098ddf2cb05e33ac4c5b455bf7595b046b2bc6edcc8121f2c6be3b7af60c3c721a37bebcf4c654cd41a43f SHA512 a9bf6f0a78accd0624bc2a61329541d97d60257ae3a6b6601f73bd9122427a3d460129b317f000d3061a4dfe3e6a6de59342354862ded13e85c7eb622ee39f9a diff --git a/sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0_beta3-r2.ebuild b/sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0-r1.ebuild similarity index 80% rename from sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0_beta3-r2.ebuild rename to sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0-r1.ebuild index bbe34ee3f7..5455a20d02 100644 --- a/sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0_beta3-r2.ebuild +++ b/sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0-r1.ebuild @@ -11,7 +11,7 @@ PYTHON_REQ_USE="threads(+)" inherit distutils-r1 multiprocessing toolchain-funcs -MY_P=${P/_beta/b} +MY_P=${P/_rc/rc} DESCRIPTION="A Python to C compiler" HOMEPAGE=" https://cython.org/ @@ -19,7 +19,7 @@ HOMEPAGE=" https://pypi.org/project/Cython/ " SRC_URI=" - https://github.com/cython/cython/archive/${PV/_beta/b}.tar.gz + https://github.com/cython/cython/archive/${PV/_rc/rc}.tar.gz -> ${MY_P}.gh.tar.gz " S=${WORKDIR}/${MY_P} @@ -43,11 +43,7 @@ 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" - # backport upstream fix e.g. for dev-python/pysimdjson on py3.12 - "${FILESDIR}/${P}-py312-long.patch" - # should fix dev-python/symengine - # https://github.com/cython/cython/pull/5483 - "${FILESDIR}/${P}-const-iter.patch" + "${FILESDIR}/${P}-version-stderr-stdout.patch" ) distutils_enable_sphinx docs \ @@ -68,11 +64,19 @@ python_test() { return fi + # Needed to avoid confusing cache tests + unset CYTHON_FORCE_REGEN + 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}" runtests.py \ + -vv \ + -j "$(makeopts_jobs)" \ + --work-dir "${BUILD_DIR}"/tests \ + --no-examples \ + --no-code-style \ + || die "Tests fail with ${EPYTHON}" } python_install_all() { diff --git a/sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0_rc2.ebuild b/sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0.ebuild similarity index 100% rename from sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0_rc2.ebuild rename to sdk_container/src/third_party/portage-stable/dev-python/cython/cython-3.0.0.ebuild diff --git a/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0-version-stderr-stdout.patch b/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0-version-stderr-stdout.patch new file mode 100644 index 0000000000..7a12c6eead --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0-version-stderr-stdout.patch @@ -0,0 +1,35 @@ +https://bugs.gentoo.org/911333 +https://github.com/cython/cython/pull/5572 +https://github.com/cython/cython/commit/ca69b359b040bf6c0fc90692bbea3bdd9d7877e6 + +From ca69b359b040bf6c0fc90692bbea3bdd9d7877e6 Mon Sep 17 00:00:00 2001 +From: Eli Schwartz +Date: Fri, 28 Jul 2023 06:52:03 -0400 +Subject: [PATCH] Only write the version to stderr, if it's a separate file + descriptor from stdout (GH-5572) + +At least one project tries to detect the Cython version by redirecting stderr to +stdout and capturing it. This is done in pure POSIX shell, so it probably seemed +like the simple and obvious solution for a less capable programming language +given that no output at all was expected on stdout. + +But the result is that the version number appears twice, and then gets misparsed +and ends up triggering bad assumptions in the code running cython. + +It turns out that it's pretty easy to just print once, though. Detect when +stdout and stderr are redirected to the same location, and only print once. + +See https://github.com/cython/cython/issues/5504 +Fixes https://bugs.gentoo.org/911333 +--- a/Cython/Compiler/Main.py ++++ b/Cython/Compiler/Main.py +@@ -776,7 +776,7 @@ def main(command_line = 0): + print("Cython version %s" % __version__) + # For legacy reasons, we also write the version to stderr. + # New tools should expect it in stdout, but existing ones still pipe from stderr. +- if not sys.stderr.isatty(): ++ if not sys.stderr.isatty() and os.fstat(1) != os.fstat(2): + sys.stderr.write("Cython version %s\n" % __version__) + if options.working_path!="": + os.chdir(options.working_path) + diff --git a/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch b/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch deleted file mode 100644 index 18822f1290..0000000000 --- a/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-const-iter.patch +++ /dev/null @@ -1,207 +0,0 @@ -From 913b8fadc5fc45306764c0ede472e1bc3b606d10 Mon Sep 17 00:00:00 2001 -From: Isuru Fernando -Date: Mon, 12 Jun 2023 13:42:09 -0500 -Subject: [PATCH 1/4] Don't remove const for reverse iteration - ---- - Cython/Compiler/ExprNodes.py | 27 --------------------------- - Cython/Includes/libcpp/map.pxd | 8 ++++++-- - 2 files changed, 6 insertions(+), 29 deletions(-) - -diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py -index ad4701b7bb6..275a6233da5 100644 ---- a/Cython/Compiler/ExprNodes.py -+++ b/Cython/Compiler/ExprNodes.py -@@ -3268,32 +3268,6 @@ def free_temps(self, code): - ExprNode.free_temps(self, code) - - --def remove_const(item_type): -- """ -- Removes the constness of a given type and its underlying templates -- if any. -- -- This is to solve the compilation error when the temporary variable used to -- store the result of an iterator cannot be changed due to its constness. -- For example, the value_type of std::map, which will also be the type of -- the temporarry variable, is std::pair. This means the first -- component of the variable cannot be reused to store the result of each -- iteration, which leads to a compilation error. -- """ -- if item_type.is_const: -- item_type = item_type.cv_base_type -- if item_type.is_typedef: -- item_type = remove_const(item_type.typedef_base_type) -- if item_type.is_cpp_class and item_type.templates: -- templates = [remove_const(t) if t.is_const else t for t in item_type.templates] -- template_type = item_type.template_type -- item_type = PyrexTypes.CppClassType( -- template_type.name, template_type.scope, -- template_type.cname, template_type.base_classes, -- templates, template_type) -- return item_type -- -- - class NextNode(AtomicExprNode): - # Used as part of for statement implementation. - # Implements result = next(iterator) -@@ -3336,7 +3310,6 @@ def infer_type(self, env, iterator_type=None): - - def analyse_types(self, env): - self.type = self.infer_type(env, self.iterator.type) -- self.type = remove_const(self.type) - self.is_temp = 1 - return self - -diff --git a/Cython/Includes/libcpp/map.pxd b/Cython/Includes/libcpp/map.pxd -index d81af66e09a..2c2c5c82adf 100644 ---- a/Cython/Includes/libcpp/map.pxd -+++ b/Cython/Includes/libcpp/map.pxd -@@ -50,7 +50,9 @@ cdef extern from "" namespace "std" nogil: - cppclass reverse_iterator: - reverse_iterator() except + - reverse_iterator(reverse_iterator&) except + -- value_type& operator*() -+ # correct would be value_type& but this does not work -+ # well with cython's code gen -+ pair[T, U]& operator*() - reverse_iterator operator++() - reverse_iterator operator--() - reverse_iterator operator++(int) -@@ -63,7 +65,9 @@ cdef extern from "" namespace "std" nogil: - const_reverse_iterator() except + - const_reverse_iterator(reverse_iterator&) except + - operator=(reverse_iterator&) except + -- const value_type& operator*() -+ # correct would be const value_type& but this does not work -+ # well with cython's code gen -+ const pair[T, U]& operator*() - const_reverse_iterator operator++() - const_reverse_iterator operator--() - const_reverse_iterator operator++(int) - -From cb804f989eaa9938e72d0336d82bb7aa0003455f Mon Sep 17 00:00:00 2001 -From: Isuru Fernando -Date: Mon, 12 Jun 2023 13:57:58 -0500 -Subject: [PATCH 2/4] Add test from gh5478 - ---- - tests/run/cpp_iterators.pyx | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/tests/run/cpp_iterators.pyx b/tests/run/cpp_iterators.pyx -index 81048d0b36b..424168fa825 100644 ---- a/tests/run/cpp_iterators.pyx -+++ b/tests/run/cpp_iterators.pyx -@@ -7,6 +7,7 @@ from libcpp.map cimport map as stdmap - from libcpp.set cimport set as stdset - from libcpp.string cimport string - from libcpp.vector cimport vector -+from libcpp.memory cimport shared_ptr, make_shared - from cython.operator cimport dereference as deref - - cdef extern from "cpp_iterators_simple.h": -@@ -272,6 +273,27 @@ def test_iteration_over_attribute_of_call(): - for i in get_object_with_iterable_attribute().vec: - print(i) - -+cdef extern from *: -+ # TODO: support make_shared[const int] -+ shared_ptr[const int] make_shared_const_int "std::make_shared"(int) -+ -+def test_iteration_over_shared_const_ptr_set(py_v): -+ """ -+ >>> test_iteration_over_shared_const_ptr_set[2, 4, 6]) -+ 6 -+ 4 -+ 2 -+ """ -+ cdef stdset[shared_ptr[const int]] s -+ cdef int i -+ for e in py_v: -+ i = e -+ s.insert(make_shared_const_int(i)) -+ -+ cdef shared_ptr[const int] a -+ for a in s: -+ print(deref(a)) -+ - def test_iteration_over_reversed_list(py_v): - """ - >>> test_iteration_over_reversed_list([2, 4, 6]) - -From a9bfacdcf5358e9d5a1d3c8ab0dd2eff6f18018a Mon Sep 17 00:00:00 2001 -From: Isuru Fernando -Date: Mon, 12 Jun 2023 14:07:37 -0500 -Subject: [PATCH 3/4] Fix multimap too - ---- - Cython/Includes/libcpp/map.pxd | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/Cython/Includes/libcpp/map.pxd b/Cython/Includes/libcpp/map.pxd -index 2c2c5c82adf..eb739509ac1 100644 ---- a/Cython/Includes/libcpp/map.pxd -+++ b/Cython/Includes/libcpp/map.pxd -@@ -177,7 +177,9 @@ cdef extern from "" namespace "std" nogil: - cppclass reverse_iterator: - reverse_iterator() except + - reverse_iterator(reverse_iterator&) except + -- value_type& operator*() -+ # correct would be value_type& but this does not work -+ # well with cython's code gen -+ pair[T, U]& operator*() - reverse_iterator operator++() - reverse_iterator operator--() - reverse_iterator operator++(int) -@@ -190,7 +192,9 @@ cdef extern from "" namespace "std" nogil: - const_reverse_iterator() except + - const_reverse_iterator(reverse_iterator&) except + - operator=(reverse_iterator&) except + -- const value_type& operator*() -+ # correct would be const value_type& but this does not work -+ # well with cython's code gen -+ const pair[T, U]& operator*() - const_reverse_iterator operator++() - const_reverse_iterator operator--() - const_reverse_iterator operator++(int) - -From 0528cd937e6d4606eb0902ee8d8db672ee7f88fe Mon Sep 17 00:00:00 2001 -From: Isuru Fernando -Date: Mon, 12 Jun 2023 17:50:41 -0500 -Subject: [PATCH 4/4] Fix test - ---- - tests/run/cpp_iterators.pyx | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/tests/run/cpp_iterators.pyx b/tests/run/cpp_iterators.pyx -index 424168fa825..57d2716bea5 100644 ---- a/tests/run/cpp_iterators.pyx -+++ b/tests/run/cpp_iterators.pyx -@@ -277,18 +277,17 @@ cdef extern from *: - # TODO: support make_shared[const int] - shared_ptr[const int] make_shared_const_int "std::make_shared"(int) - --def test_iteration_over_shared_const_ptr_set(py_v): -+def test_iteration_over_shared_const_ptr_vector(py_v): - """ -- >>> test_iteration_over_shared_const_ptr_set[2, 4, 6]) -- 6 -- 4 -+ >>> test_iteration_over_shared_const_ptr_vector([2, 4, 6]) - 2 -+ 4 -+ 6 - """ -- cdef stdset[shared_ptr[const int]] s -+ cdef vector[shared_ptr[const int]] s - cdef int i -- for e in py_v: -- i = e -- s.insert(make_shared_const_int(i)) -+ for i in py_v: -+ s.push_back(make_shared_const_int(i)) - - cdef shared_ptr[const int] a - for a in s: diff --git a/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-py312-long.patch b/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-py312-long.patch deleted file mode 100644 index fb849eca86..0000000000 --- a/sdk_container/src/third_party/portage-stable/dev-python/cython/files/cython-3.0.0_beta3-py312-long.patch +++ /dev/null @@ -1,28 +0,0 @@ -From d82e4e34582e908d315b912a60d81d5759850df5 Mon Sep 17 00:00:00 2001 -From: Stefan Behnel -Date: Mon, 29 May 2023 21:58:15 +0200 -Subject: [PATCH] Fix the argument type passed into the new - "PyUnstable_Long_Compact*()" C-API functions in CPython 3.12. - ---- - Cython/Utility/TypeConversion.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Cython/Utility/TypeConversion.c b/Cython/Utility/TypeConversion.c -index efc5c1373..09e87d81c 100644 ---- a/Cython/Utility/TypeConversion.c -+++ b/Cython/Utility/TypeConversion.c -@@ -149,8 +149,8 @@ static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); - ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * __Pyx_PyLong_DigitCount(x)) - - #if defined(PyUnstable_Long_IsCompact) && defined(PyUnstable_Long_CompactValue) -- #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact(x) -- #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue(x) -+ #define __Pyx_PyLong_IsCompact(x) PyUnstable_Long_IsCompact((PyLongObject*) x) -+ #define __Pyx_PyLong_CompactValue(x) PyUnstable_Long_CompactValue((PyLongObject*) x) - #else - #define __Pyx_PyLong_IsCompact(x) (((PyLongObject*)x)->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS)) - #define __Pyx_PyLong_CompactValue(x) ((1 - (Py_ssize_t) __Pyx_PyLong_Sign(x)) * (Py_ssize_t) __Pyx_PyLong_Digits(x)[0]) --- -2.41.0 -