From 2db11f2b81f3609068ad2fe850cc79531a1d634a Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Sat, 26 Aug 2023 15:57:12 -0400 Subject: [PATCH] python3-lxml: patch and rebuild for Cython 3 --- .../patches/cython3-fix-test.patch | 32 +++++++++++++++++++ .../python3-lxml/patches/cython3-legacy.patch | 12 +++++++ ...-prefix-nsmap.diff => libxml-2.10.4.patch} | 12 ++++--- ...fix-tests-io.patch => libxml-2.11.0.patch} | 3 +- srcpkgs/python3-lxml/template | 2 +- 5 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 srcpkgs/python3-lxml/patches/cython3-fix-test.patch create mode 100644 srcpkgs/python3-lxml/patches/cython3-legacy.patch rename srcpkgs/python3-lxml/patches/{fix-test-html-prefix-nsmap.diff => libxml-2.10.4.patch} (56%) rename srcpkgs/python3-lxml/patches/{fix-tests-io.patch => libxml-2.11.0.patch} (83%) diff --git a/srcpkgs/python3-lxml/patches/cython3-fix-test.patch b/srcpkgs/python3-lxml/patches/cython3-fix-test.patch new file mode 100644 index 00000000000..70348622048 --- /dev/null +++ b/srcpkgs/python3-lxml/patches/cython3-fix-test.patch @@ -0,0 +1,32 @@ +diff --git a/src/lxml/tests/test_errors.py b/src/lxml/tests/test_errors.py +index c0aee744..4875f298 100644 +--- a/src/lxml/tests/test_errors.py ++++ b/src/lxml/tests/test_errors.py +@@ -28,7 +28,6 @@ class ErrorTestCase(HelperTestCase): + def test_element_cyclic_gc_none(self): + # test if cyclic reference can crash etree + Element = self.etree.Element +- getrefcount = sys.getrefcount + + # must disable tracing as it could change the refcounts + trace_func = sys.gettrace() +@@ -36,16 +35,16 @@ class ErrorTestCase(HelperTestCase): + sys.settrace(None) + gc.collect() + +- count = getrefcount(None) ++ count1 = gc.get_count() + + l = [Element('name'), Element('name')] + l.append(l) + + del l + gc.collect() +- count = getrefcount(None) - count ++ count2 = gc.get_count() + +- self.assertEqual(count, 0) ++ self.assertEqual(count1, count2) + finally: + sys.settrace(trace_func) + diff --git a/srcpkgs/python3-lxml/patches/cython3-legacy.patch b/srcpkgs/python3-lxml/patches/cython3-legacy.patch new file mode 100644 index 00000000000..3a01c85705c --- /dev/null +++ b/srcpkgs/python3-lxml/patches/cython3-legacy.patch @@ -0,0 +1,12 @@ +diff --git a/setupinfo.py b/setupinfo.py +index 5feb13bf..ea1b391c 100644 +--- a/setupinfo.py ++++ b/setupinfo.py +@@ -148,6 +148,7 @@ def ext_modules(static_include_dirs, static_library_dirs, + + cythonize_directives = { + 'binding': True, ++ 'legacy_implicit_noexcept': True, + } + if OPTION_WITH_COVERAGE: + cythonize_directives['linetrace'] = True diff --git a/srcpkgs/python3-lxml/patches/fix-test-html-prefix-nsmap.diff b/srcpkgs/python3-lxml/patches/libxml-2.10.4.patch similarity index 56% rename from srcpkgs/python3-lxml/patches/fix-test-html-prefix-nsmap.diff rename to srcpkgs/python3-lxml/patches/libxml-2.10.4.patch index 084769b69ae..4682eddd6f5 100644 --- a/srcpkgs/python3-lxml/patches/fix-test-html-prefix-nsmap.diff +++ b/srcpkgs/python3-lxml/patches/libxml-2.10.4.patch @@ -1,13 +1,17 @@ +From alpine: https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/py3-lxml + +the find above returns None with this version +-- diff --git a/src/lxml/tests/test_etree.py b/src/lxml/tests/test_etree.py -index 0339796d..de584c56 100644 +index 0339796..790c57a 100644 --- a/src/lxml/tests/test_etree.py +++ b/src/lxml/tests/test_etree.py -@@ -3072,8 +3072,6 @@ class ETreeOnlyTestCase(HelperTestCase): - el = etree.HTML('aa').find('.//page-description') +@@ -3073,7 +3073,7 @@ class ETreeOnlyTestCase(HelperTestCase): if etree.LIBXML_VERSION < (2, 9, 11): self.assertEqual({'hha': None}, el.nsmap) -- else: + else: - self.assertEqual({}, el.nsmap) ++ self.assertEqual(None, el) def test_getchildren(self): Element = self.etree.Element diff --git a/srcpkgs/python3-lxml/patches/fix-tests-io.patch b/srcpkgs/python3-lxml/patches/libxml-2.11.0.patch similarity index 83% rename from srcpkgs/python3-lxml/patches/fix-tests-io.patch rename to srcpkgs/python3-lxml/patches/libxml-2.11.0.patch index 9a3001d4e92..6ed59d3b2fe 100644 --- a/srcpkgs/python3-lxml/patches/fix-tests-io.patch +++ b/srcpkgs/python3-lxml/patches/libxml-2.11.0.patch @@ -1,3 +1,5 @@ +From alpine: https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/py3-lxml + diff --git a/src/lxml/tests/test_io.py b/src/lxml/tests/test_io.py index cbdbcef..efbd3fd 100644 --- a/src/lxml/tests/test_io.py @@ -10,4 +12,3 @@ index cbdbcef..efbd3fd 100644 f = tempfile.NamedTemporaryFile(delete=False) try: - diff --git a/srcpkgs/python3-lxml/template b/srcpkgs/python3-lxml/template index 8251b74c7b5..76756b84ded 100644 --- a/srcpkgs/python3-lxml/template +++ b/srcpkgs/python3-lxml/template @@ -1,7 +1,7 @@ # Template file for 'python3-lxml' pkgname=python3-lxml version=4.9.3 -revision=1 +revision=2 build_style=python3-module make_build_args="--with-cython" hostmakedepends="python3-Cython python3-setuptools"