From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id EE8AC15806E for ; Tue, 6 Jun 2023 05:34:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1EA6CE088D; Tue, 6 Jun 2023 05:34:44 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0397DE088D for ; Tue, 6 Jun 2023 05:34:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 230CD34067D for ; Tue, 6 Jun 2023 05:34:43 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 66DEC8DC for ; Tue, 6 Jun 2023 05:34:41 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686029671.fff86605fbd568f23e4af7cc6bf3536294fdbafc.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/lxml/files/, dev-python/lxml/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-python/lxml/files/lxml-4.9.2-py3.12-backport-unicode-fix.patch dev-python/lxml/lxml-4.9.2-r1.ebuild X-VCS-Directories: dev-python/lxml/ dev-python/lxml/files/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: fff86605fbd568f23e4af7cc6bf3536294fdbafc X-VCS-Branch: master Date: Tue, 6 Jun 2023 05:34:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 91e5ca13-a47e-46d2-9fcd-c37760911890 X-Archives-Hash: 3364bb4bed82a8634fb2587e67c2a0da commit: fff86605fbd568f23e4af7cc6bf3536294fdbafc Author: Violet Purcell inventati org> AuthorDate: Tue Jun 6 03:25:00 2023 +0000 Commit: Sam James gentoo 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 inventati.org> Closes: https://github.com/gentoo/gentoo/pull/31327 Signed-off-by: Sam James 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 +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-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 +}