Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/lxml/
Date: Wed, 23 Feb 2022 10:34:26
Message-Id: 1645612459.5440145f6af81a30b339dcc71bf887324b99c995.mgorny@gentoo
1 commit: 5440145f6af81a30b339dcc71bf887324b99c995
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 23 10:26:44 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 23 10:34:19 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5440145f
7
8 dev-python/lxml: Migrate to PEP517 build
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/lxml/lxml-4.8.0-r1.ebuild | 100 +++++++++++++++++++++++++++++++++++
13 1 file changed, 100 insertions(+)
14
15 diff --git a/dev-python/lxml/lxml-4.8.0-r1.ebuild b/dev-python/lxml/lxml-4.8.0-r1.ebuild
16 new file mode 100644
17 index 000000000000..62574e22e13f
18 --- /dev/null
19 +++ b/dev-python/lxml/lxml-4.8.0-r1.ebuild
20 @@ -0,0 +1,100 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +DISTUTILS_USE_PEP517=setuptools
27 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
28 +
29 +inherit distutils-r1 optfeature toolchain-funcs
30 +
31 +DESCRIPTION="A Pythonic binding for the libxml2 and libxslt libraries"
32 +HOMEPAGE="https://lxml.de/ https://pypi.org/project/lxml/ https://github.com/lxml/lxml"
33 +SRC_URI="https://github.com/lxml/lxml/archive/${P}.tar.gz"
34 +S=${WORKDIR}/lxml-${P}
35 +
36 +LICENSE="BSD ElementTree GPL-2 PSF-2"
37 +SLOT="0"
38 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
39 +IUSE="doc examples +threads test"
40 +RESTRICT="!test? ( test )"
41 +
42 +# Note: lib{xml2,xslt} are used as C libraries, not Python modules.
43 +RDEPEND="
44 + >=dev-libs/libxml2-2.9.12-r2
45 + >=dev-libs/libxslt-1.1.28"
46 +DEPEND="${RDEPEND}"
47 +BDEPEND="
48 + virtual/pkgconfig
49 + dev-python/cython[${PYTHON_USEDEP}]
50 + doc? (
51 + $(python_gen_any_dep '
52 + dev-python/docutils[${PYTHON_USEDEP}]
53 + dev-python/pygments[${PYTHON_USEDEP}]
54 + dev-python/sphinx[${PYTHON_USEDEP}]
55 + dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]
56 + ')
57 + )
58 + test? ( dev-python/cssselect[${PYTHON_USEDEP}] )
59 + "
60 +
61 +PATCHES=(
62 + "${FILESDIR}"/${PN}-4.6.0-tests-pypy.patch
63 +)
64 +
65 +python_check_deps() {
66 + use doc || return 0
67 + has_version "dev-python/docutils[${PYTHON_USEDEP}]" &&
68 + has_version "dev-python/pygments[${PYTHON_USEDEP}]" &&
69 + has_version "dev-python/sphinx[${PYTHON_USEDEP}]" &&
70 + has_version "dev-python/sphinx_rtd_theme[${PYTHON_USEDEP}]"
71 +}
72 +
73 +python_prepare_all() {
74 + # avoid replacing PYTHONPATH in tests.
75 + sed -i -e '/sys\.path/d' test.py || die
76 +
77 + # don't use some random SDK on Darwin
78 + sed -i -e '/_ldflags =/s/=.*isysroot.*darwin.*None/= None/' \
79 + setupinfo.py || die
80 +
81 + distutils-r1_python_prepare_all
82 +}
83 +
84 +python_compile() {
85 + tc-export PKG_CONFIG
86 + distutils-r1_python_compile
87 +}
88 +
89 +python_compile_all() {
90 + use doc && emake html
91 +}
92 +
93 +python_test() {
94 + local dir=${BUILD_DIR}/test$(python_get_sitedir)/lxml
95 + local -x PATH=${BUILD_DIR}/test/usr/bin:${PATH}
96 +
97 + cp -al "${BUILD_DIR}"/{install,test} || die
98 + cp -al src/lxml/tests "${dir}/" || die
99 + cp -al src/lxml/html/tests "${dir}/html/" || die
100 + ln -rs "${S}"/doc "${dir}"/../../ || die
101 +
102 + "${EPYTHON}" test.py -vv --all-levels -p || die "Test ${test} fails with ${EPYTHON}"
103 +}
104 +
105 +python_install_all() {
106 + if use doc; then
107 + local DOCS=( README.rst *.txt doc/*.txt )
108 + local HTML_DOCS=( doc/html/. )
109 + fi
110 + if use examples; then
111 + dodoc -r samples
112 + fi
113 +
114 + distutils-r1_python_install_all
115 +}
116 +
117 +pkg_postinst() {
118 + optfeature "Support for BeautifulSoup as a parser backend" dev-python/beautifulsoup4
119 + optfeature "Translates CSS selectors to XPath 1.0 expressions" dev-python/cssselect
120 +}