From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/lxml/files/, dev-python/lxml/
Date: Tue, 6 Jun 2023 05:34:41 +0000 (UTC) [thread overview]
Message-ID: <1686029671.fff86605fbd568f23e4af7cc6bf3536294fdbafc.sam@gentoo> (raw)
commit: fff86605fbd568f23e4af7cc6bf3536294fdbafc
Author: Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Tue Jun 6 03:25:00 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jun 6 05:34:31 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fff86605
dev-python/lxml: Backport py3.12 unicode fix
Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/31327
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../lxml-4.9.2-py3.12-backport-unicode-fix.patch | 33 ++++++
dev-python/lxml/lxml-4.9.2-r1.ebuild | 116 +++++++++++++++++++++
2 files changed, 149 insertions(+)
diff --git a/dev-python/lxml/files/lxml-4.9.2-py3.12-backport-unicode-fix.patch b/dev-python/lxml/files/lxml-4.9.2-py3.12-backport-unicode-fix.patch
new file mode 100644
index 000000000000..d1ca31d1b909
--- /dev/null
+++ b/dev-python/lxml/files/lxml-4.9.2-py3.12-backport-unicode-fix.patch
@@ -0,0 +1,33 @@
+Upstream: https://github.com/lxml/lxml/commit/a1f2231dfdd31a37f2c55bc9ae4ac33e92221227
+
+From a1f2231dfdd31a37f2c55bc9ae4ac33e92221227 Mon Sep 17 00:00:00 2001
+From: Stefan Behnel <stefan_ml@behnel.de>
+Date: Fri, 12 May 2023 09:49:34 +0200
+Subject: [PATCH] Adapt unicode parsing to Py3.12.
+
+---
+ src/lxml/includes/etree_defs.h | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/src/lxml/includes/etree_defs.h b/src/lxml/includes/etree_defs.h
+index e671fa85d..d42f2158c 100644
+--- a/src/lxml/includes/etree_defs.h
++++ b/src/lxml/includes/etree_defs.h
+@@ -120,6 +120,16 @@ static PyObject* PyBytes_FromFormat(const char* format, ...) {
+ # define _lx_PySlice_GetIndicesEx(o, l, b, e, s, sl) PySlice_GetIndicesEx(((PySliceObject*)o), l, b, e, s, sl)
+ #endif
+
++#if PY_VERSION_HEX >= 0x030B00A1
++/* Python 3.12 doesn't have wstr Unicode strings any more. */
++#undef PyUnicode_GET_DATA_SIZE
++#define PyUnicode_GET_DATA_SIZE(ustr) (0)
++#undef PyUnicode_AS_DATA
++#define PyUnicode_AS_DATA(ustr) (NULL)
++#undef PyUnicode_IS_READY
++#define PyUnicode_IS_READY(ustr) (1)
++#endif
++
+ #ifdef WITHOUT_THREADING
+ # undef PyEval_SaveThread
+ # define PyEval_SaveThread() (NULL)
+
diff --git a/dev-python/lxml/lxml-4.9.2-r1.ebuild b/dev-python/lxml/lxml-4.9.2-r1.ebuild
new file mode 100644
index 000000000000..9b26e534fcf8
--- /dev/null
+++ b/dev-python/lxml/lxml-4.9.2-r1.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DISTUTILS_EXT=1
+DISTUTILS_USE_PEP517=setuptools
+PYTHON_COMPAT=( python3_{10..12} pypy3 )
+
+inherit distutils-r1 optfeature toolchain-funcs
+
+DESCRIPTION="A Pythonic binding for the libxml2 and libxslt libraries"
+HOMEPAGE="
+ https://lxml.de/
+ https://pypi.org/project/lxml/
+ https://github.com/lxml/lxml/
+"
+SRC_URI="
+ https://github.com/lxml/lxml/archive/${P}.tar.gz
+ -> ${P}.gh.tar.gz
+"
+S=${WORKDIR}/lxml-${P}
+
+LICENSE="BSD ElementTree GPL-2 PSF-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="doc examples +threads test"
+RESTRICT="!test? ( test )"
+
+# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
+DEPEND="
+ >=dev-libs/libxml2-2.9.12-r2
+ >=dev-libs/libxslt-1.1.28
+"
+RDEPEND="
+ ${DEPEND}
+"
+BDEPEND="
+ virtual/pkgconfig
+ <dev-python/cython-3[${PYTHON_USEDEP}]
+ >=dev-python/cython-0.29.29[${PYTHON_USEDEP}]
+ doc? (
+ $(python_gen_any_dep '
+ dev-python/docutils[${PYTHON_USEDEP}]
+ dev-python/pygments[${PYTHON_USEDEP}]
+ dev-python/sphinx[${PYTHON_USEDEP}]
+ dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]
+ ')
+ )
+ test? (
+ dev-python/cssselect[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.6.0-tests-pypy.patch
+ "${FILESDIR}"/${P}-py3.12-drop-deprecated-imp.patch
+ "${FILESDIR}"/${P}-py3.12-backport-unicode-fix.patch
+)
+
+python_check_deps() {
+ use doc || return 0
+ python_has_version -b "dev-python/docutils[${PYTHON_USEDEP}]" &&
+ python_has_version -b "dev-python/pygments[${PYTHON_USEDEP}]" &&
+ python_has_version -b "dev-python/sphinx[${PYTHON_USEDEP}]" &&
+ python_has_version -b "dev-python/sphinx-rtd-theme[${PYTHON_USEDEP}]"
+}
+
+python_prepare_all() {
+ # avoid replacing PYTHONPATH in tests.
+ sed -i -e '/sys\.path/d' test.py || die
+
+ # don't use some random SDK on Darwin
+ sed -i -e '/_ldflags =/s/=.*isysroot.*darwin.*None/= None/' \
+ setupinfo.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_compile() {
+ tc-export PKG_CONFIG
+ distutils-r1_python_compile
+}
+
+python_compile_all() {
+ use doc && emake html
+}
+
+python_test() {
+ local dir=${BUILD_DIR}/test$(python_get_sitedir)/lxml
+ local -x PATH=${BUILD_DIR}/test/usr/bin:${PATH}
+
+ cp -al "${BUILD_DIR}"/{install,test} || die
+ cp -al src/lxml/tests "${dir}/" || die
+ cp -al src/lxml/html/tests "${dir}/html/" || die
+ ln -rs "${S}"/doc "${dir}"/../../ || die
+
+ "${EPYTHON}" test.py -vv --all-levels -p || die "Test ${test} fails with ${EPYTHON}"
+}
+
+python_install_all() {
+ if use doc; then
+ local DOCS=( README.rst *.txt doc/*.txt )
+ local HTML_DOCS=( doc/html/. )
+ fi
+ if use examples; then
+ dodoc -r samples
+ fi
+
+ distutils-r1_python_install_all
+}
+
+pkg_postinst() {
+ optfeature "Support for BeautifulSoup as a parser backend" dev-python/beautifulsoup4
+ optfeature "Translates CSS selectors to XPath 1.0 expressions" dev-python/cssselect
+}
next reply other threads:[~2023-06-06 5:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-06 5:34 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-03-01 7:11 [gentoo-commits] repo/gentoo:master commit in: dev-python/lxml/files/, dev-python/lxml/ Michał Górny
2024-07-02 5:00 Michał Górny
2024-01-09 8:09 Michał Górny
2023-11-16 18:25 Michał Górny
2023-10-25 5:54 Michał Górny
2023-05-25 3:18 Sam James
2021-12-11 23:24 Michał Górny
2020-11-27 8:43 Michał Górny
2020-10-17 19:01 Michał Górny
2019-11-27 2:18 Patrick McLean
2016-12-22 22:46 Lars Wendler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1686029671.fff86605fbd568f23e4af7cc6bf3536294fdbafc.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox