Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/rdflib/, dev-python/rdflib/files/
Date: Sun, 21 Apr 2019 12:19:37
Message-Id: 1555849142.9f7091cb8622b9b530f2311481ee32f0e4f22396.soap@gentoo
1 commit: 9f7091cb8622b9b530f2311481ee32f0e4f22396
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 21 12:19:02 2019 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 21 12:19:02 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9f7091cb
7
8 dev-python/rdflib: Add python3_7 to PYTHON_COMPAT
9
10 Package-Manager: Portage-2.3.62, Repoman-2.3.12
11 Signed-off-by: David Seifert <soap <AT> gentoo.org>
12
13 .../rdflib-4.2.2-python3.7-StopIteration.patch | 72 ++++++++++++++++
14 dev-python/rdflib/rdflib-4.2.2-r1.ebuild | 99 ++++++++++++++++++++++
15 2 files changed, 171 insertions(+)
16
17 diff --git a/dev-python/rdflib/files/rdflib-4.2.2-python3.7-StopIteration.patch b/dev-python/rdflib/files/rdflib-4.2.2-python3.7-StopIteration.patch
18 new file mode 100644
19 index 00000000000..389d220dc1b
20 --- /dev/null
21 +++ b/dev-python/rdflib/files/rdflib-4.2.2-python3.7-StopIteration.patch
22 @@ -0,0 +1,72 @@
23 +Traceback (most recent call last):
24 + File "/var/tmp/portage/dev-python/rdflib-4.2.2/work/rdflib-4.2.2-python3_7/build/src/rdflib/plugins/sparql/evaluate.py", line 330, in evalSlice
25 + next(res)
26 +StopIteration
27 +
28 +The above exception was the direct cause of the following exception:
29 +
30 +Traceback (most recent call last):
31 + File "/usr/lib/python3.7/site-packages/nose/case.py", line 197, in runTest
32 + self.test(*self.arg)
33 + File "/var/tmp/portage/dev-python/rdflib-4.2.2/work/rdflib-4.2.2-python3_7/build/src/test/test_dawg.py", line 434, in query_test
34 + set(res2)
35 + File "/var/tmp/portage/dev-python/rdflib-4.2.2/work/rdflib-4.2.2-python3_7/build/src/rdflib/query.py", line 258, in __iter__
36 + for b in self._genbindings:
37 +RuntimeError: generator raised StopIteration
38 +
39 +Patch backported from
40 +https://github.com/RDFLib/rdflib/commit/58c45d6f30af88a22f60edcb9a459648a885e226
41 +
42 +--- a/rdflib/plugins/sparql/evaluate.py
43 ++++ b/rdflib/plugins/sparql/evaluate.py
44 +@@ -15,6 +15,7 @@
45 + """
46 +
47 + import collections
48 ++import itertools
49 +
50 + from rdflib import Variable, Graph, BNode, URIRef, Literal
51 +
52 +@@ -323,22 +324,9 @@
53 +
54 +
55 + def evalSlice(ctx, slice):
56 +- # import pdb; pdb.set_trace()
57 + res = evalPart(ctx, slice.p)
58 +- i = 0
59 +- while i < slice.start:
60 +- res.next()
61 +- i += 1
62 +- i = 0
63 +- for x in res:
64 +- i += 1
65 +- if slice.length is None:
66 +- yield x
67 +- else:
68 +- if i <= slice.length:
69 +- yield x
70 +- else:
71 +- break
72 ++
73 ++ return itertools.islice(res, slice.start, slice.start+slice.length if slice.length is not None else None)
74 +
75 +
76 + def evalReduced(ctx, part):
77 +--- a/rdflib/query.py
78 ++++ b/rdflib/query.py
79 +@@ -1,5 +1,6 @@
80 +
81 + import os
82 ++import itertools
83 + import shutil
84 + import tempfile
85 + import warnings
86 +@@ -181,7 +182,7 @@
87 + return self._bindings
88 +
89 + def _set_bindings(self, b):
90 +- if isinstance(b, types.GeneratorType):
91 ++ if isinstance(b, (types.GeneratorType, itertools.islice)):
92 + self._genbindings = b
93 + self._bindings = []
94 + else:
95
96 diff --git a/dev-python/rdflib/rdflib-4.2.2-r1.ebuild b/dev-python/rdflib/rdflib-4.2.2-r1.ebuild
97 new file mode 100644
98 index 00000000000..2181a2dec6c
99 --- /dev/null
100 +++ b/dev-python/rdflib/rdflib-4.2.2-r1.ebuild
101 @@ -0,0 +1,99 @@
102 +# Copyright 1999-2019 Gentoo Authors
103 +# Distributed under the terms of the GNU General Public License v2
104 +
105 +EAPI=7
106 +
107 +PYTHON_COMPAT=( python{2_7,3_{5,6,7}} )
108 +PYTHON_REQ_USE="sqlite?,threads(+)"
109 +
110 +# The usual required for tests
111 +DISTUTILS_IN_SOURCE_BUILD=1
112 +
113 +inherit distutils-r1
114 +
115 +DESCRIPTION="RDF library containing a triple store and parser/serializer"
116 +HOMEPAGE="https://github.com/RDFLib/rdflib https://pypi.org/project/rdflib/"
117 +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
118 +
119 +LICENSE="BSD"
120 +SLOT="0"
121 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
122 +IUSE="doc berkdb examples mysql redland sqlite test"
123 +RESTRICT="!test? ( test )"
124 +
125 +RDEPEND="
126 + dev-python/isodate[${PYTHON_USEDEP}]
127 + dev-python/html5lib[${PYTHON_USEDEP}]
128 + dev-python/pyparsing[${PYTHON_USEDEP}]
129 + berkdb? ( dev-python/bsddb3[${PYTHON_USEDEP}] )
130 + mysql? ( dev-python/mysql-python[$(python_gen_usedep 'python2*')] )
131 + redland? ( dev-libs/redland-bindings[python,$(python_gen_usedep 'python2*')] )"
132 +DEPEND="${RDEPEND}
133 + dev-python/setuptools[${PYTHON_USEDEP}]
134 + doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
135 + test? (
136 + dev-python/sparql-wrapper[${PYTHON_USEDEP}]
137 + >=dev-python/nose-1.3.1-r1[${PYTHON_USEDEP}]
138 + )"
139 +
140 +PATCHES=(
141 + # Python 3.7 StopIteration bug
142 + "${FILESDIR}"/${PN}-4.2.2-python3.7-StopIteration.patch
143 +)
144 +
145 +python_prepare_all() {
146 + # Upstream manufactured .pyc files which promptly break distutils' src_test
147 + find -name "*.py[oc~]" -delete || die
148 +
149 + # Bug 358189; take out tests that attempt to connect to the network
150 + sed -e "/'--with-doctest',/d" -e "/'--doctest-extension=.doctest',/d" \
151 + -e "/'--doctest-tests',/d" -i run_tests.py || die
152 +
153 + sed -e "s: 'sphinx.ext.intersphinx',::" -i docs/conf.py || die
154 +
155 + # doc build requires examples folder at the upper level of docs
156 + if use doc; then
157 + cd docs || die
158 + ln -sf ../examples . || die
159 + cd ../ || die
160 + fi
161 +
162 + distutils-r1_python_prepare_all
163 +}
164 +
165 +python_compile_all() {
166 + # https://github.com/RDFLib/rdflib/issues/510
167 + if use doc; then
168 + einfo ""
169 + einfo "Several warnings and Errors present in the build"
170 + einfo "For a complete build, it is required to install"
171 + einfo "github.com/gjhiggins/n3_pygments_lexer and"
172 + einfo "github.com/gjhiggins/sparql_pygments_lexer"
173 + einfo "outside portage via pip or by cloning. These have not been"
174 + einfo "given a tagged release by the author and are not in portage"
175 + einfo ""
176 +
177 + emake -C docs html
178 + HTML_DOCS=( docs/_build/html/. )
179 + fi
180 +}
181 +
182 +python_test() {
183 + # the default; nose with: --where=./ does not work for python3
184 + if python_is_python3; then
185 + pushd "${BUILD_DIR}/src/" >/dev/null || die
186 + "${EPYTHON}" ./run_tests.py || die "Tests failed under ${EPYTHON}"
187 + popd >/dev/null || die
188 + else
189 + "${EPYTHON}" ./run_tests.py || die "Tests failed under ${EPYTHON}"
190 + fi
191 +}
192 +
193 +python_install_all() {
194 + distutils-r1_python_install_all
195 +
196 + if use examples; then
197 + dodoc -r examples
198 + docompress -x /usr/share/doc/${PF}/examples
199 + fi
200 +}