1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python{2_7,3_{6,7}} )
7 PYTHON_REQ_USE="sqlite?,threads(+)"
9 # The usual required for tests
10 DISTUTILS_IN_SOURCE_BUILD=1
14 DESCRIPTION="RDF library containing a triple store and parser/serializer"
15 HOMEPAGE="https://github.com/RDFLib/rdflib https://pypi.org/project/rdflib/"
16 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
20 KEYWORDS="~alpha ~amd64 ~arm ~arm64 hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
21 IUSE="doc berkdb examples mysql redland sqlite test"
22 RESTRICT="!test? ( test )"
25 dev-python/isodate[${PYTHON_USEDEP}]
26 dev-python/html5lib[${PYTHON_USEDEP}]
27 dev-python/pyparsing[${PYTHON_USEDEP}]
28 berkdb? ( dev-python/bsddb3[${PYTHON_USEDEP}] )
29 mysql? ( dev-python/mysql-python[$(python_gen_usedep 'python2*')] )
30 redland? ( dev-libs/redland-bindings[python,$(python_gen_usedep 'python2*')] )"
32 dev-python/setuptools[${PYTHON_USEDEP}]
33 doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
35 dev-python/sparql-wrapper[${PYTHON_USEDEP}]
36 >=dev-python/nose-1.3.1-r1[${PYTHON_USEDEP}]
40 # Python 3.7 StopIteration bug
41 "${FILESDIR}"/${PN}-4.2.2-python3.7-StopIteration.patch
44 python_prepare_all() {
45 # Upstream manufactured .pyc files which promptly break distutils' src_test
46 find -name "*.py[oc~]" -delete || die
48 # Bug 358189; take out tests that attempt to connect to the network
49 sed -e "/'--with-doctest',/d" -e "/'--doctest-extension=.doctest',/d" \
50 -e "/'--doctest-tests',/d" -i run_tests.py || die
52 sed -e "s: 'sphinx.ext.intersphinx',::" -i docs/conf.py || die
54 # doc build requires examples folder at the upper level of docs
57 ln -sf ../examples . || die
61 distutils-r1_python_prepare_all
64 python_compile_all() {
65 # https://github.com/RDFLib/rdflib/issues/510
68 einfo "Several warnings and Errors present in the build"
69 einfo "For a complete build, it is required to install"
70 einfo "github.com/gjhiggins/n3_pygments_lexer and"
71 einfo "github.com/gjhiggins/sparql_pygments_lexer"
72 einfo "outside portage via pip or by cloning. These have not been"
73 einfo "given a tagged release by the author and are not in portage"
77 HTML_DOCS=( docs/_build/html/. )
82 # the default; nose with: --where=./ does not work for python3
83 if python_is_python3; then
84 pushd "${BUILD_DIR}/src/" >/dev/null || die
85 "${EPYTHON}" ./run_tests.py || die "Tests failed under ${EPYTHON}"
86 popd >/dev/null || die
88 "${EPYTHON}" ./run_tests.py || die "Tests failed under ${EPYTHON}"
92 python_install_all() {
93 distutils-r1_python_install_all
97 docompress -x /usr/share/doc/${PF}/examples