1 |
commit: 861fb47c4f3c853ba2aabc53b0b6acbbeb7ceeaa |
2 |
Author: Patrick McLean <patrick.mclean <AT> sony <DOT> com> |
3 |
AuthorDate: Tue Nov 26 23:53:34 2019 +0000 |
4 |
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Nov 27 01:13:37 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=861fb47c |
7 |
|
8 |
dev-python/html5lib: revbump, EAPI=7, py38 |
9 |
|
10 |
Copyright: Sony Interactive Entertainment Inc. |
11 |
Package-Manager: Portage-2.3.79, Repoman-2.3.18 |
12 |
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org> |
13 |
|
14 |
.../html5lib-python-1.0.1-support-pytest4.patch | 270 +++++++++++++++++++++ |
15 |
...l5lib-1.0.1.ebuild => html5lib-1.0.1-r1.ebuild} | 20 +- |
16 |
dev-python/html5lib/html5lib-1.0.1.ebuild | 2 + |
17 |
3 files changed, 284 insertions(+), 8 deletions(-) |
18 |
|
19 |
diff --git a/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch b/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch |
20 |
new file mode 100644 |
21 |
index 00000000000..98c9fb23fc7 |
22 |
--- /dev/null |
23 |
+++ b/dev-python/html5lib/files/html5lib-python-1.0.1-support-pytest4.patch |
24 |
@@ -0,0 +1,270 @@ |
25 |
+From 2699544837e68b12f1740a7eb56882a0dc0a4008 Mon Sep 17 00:00:00 2001 |
26 |
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@×××××××.cz> |
27 |
+Date: Thu, 28 Mar 2019 01:45:43 +0100 |
28 |
+Subject: [PATCH 1/4] Support pytest 4 |
29 |
+ |
30 |
+Fixes https://github.com/html5lib/html5lib-python/issues/411 |
31 |
+--- |
32 |
+ html5lib/tests/test_encoding.py | 4 ++-- |
33 |
+ html5lib/tests/test_sanitizer.py | 14 +++++++------- |
34 |
+ html5lib/tests/test_serializer.py | 2 +- |
35 |
+ html5lib/tests/test_stream.py | 7 ++++--- |
36 |
+ html5lib/tests/test_treewalkers.py | 2 +- |
37 |
+ requirements-test.txt | 2 +- |
38 |
+ tox.ini | 2 +- |
39 |
+ 7 files changed, 17 insertions(+), 16 deletions(-) |
40 |
+ |
41 |
+diff --git a/html5lib/tests/test_encoding.py b/html5lib/tests/test_encoding.py |
42 |
+index 9a411c77..97b6ca2a 100644 |
43 |
+--- a/html5lib/tests/test_encoding.py |
44 |
++++ b/html5lib/tests/test_encoding.py |
45 |
+@@ -99,8 +99,8 @@ def test_encoding(): |
46 |
+ for filename in get_data_files("encoding"): |
47 |
+ tests = _TestData(filename, b"data", encoding=None) |
48 |
+ for test in tests: |
49 |
+- yield (runParserEncodingTest, test[b'data'], test[b'encoding']) |
50 |
+- yield (runPreScanEncodingTest, test[b'data'], test[b'encoding']) |
51 |
++ runParserEncodingTest(test[b'data'], test[b'encoding']) |
52 |
++ runPreScanEncodingTest(test[b'data'], test[b'encoding']) |
53 |
+ |
54 |
+ |
55 |
+ # pylint:disable=wrong-import-position |
56 |
+diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py |
57 |
+index 45046d57..1b7285fc 100644 |
58 |
+--- a/html5lib/tests/test_sanitizer.py |
59 |
++++ b/html5lib/tests/test_sanitizer.py |
60 |
+@@ -67,19 +67,19 @@ def test_sanitizer(): |
61 |
+ 'tfoot', 'th', 'thead', 'tr', 'select']: |
62 |
+ continue # TODO |
63 |
+ if tag_name == 'image': |
64 |
+- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, |
65 |
++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
66 |
+ "<img title=\"1\"/>foo <bad>bar</bad> baz", |
67 |
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
68 |
+ elif tag_name == 'br': |
69 |
+- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, |
70 |
++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
71 |
+ "<br title=\"1\"/>foo <bad>bar</bad> baz<br/>", |
72 |
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
73 |
+ elif tag_name in constants.voidElements: |
74 |
+- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, |
75 |
++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
76 |
+ "<%s title=\"1\"/>foo <bad>bar</bad> baz" % tag_name, |
77 |
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
78 |
+ else: |
79 |
+- yield (runSanitizerTest, "test_should_allow_%s_tag" % tag_name, |
80 |
++ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
81 |
+ "<%s title=\"1\">foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name), |
82 |
+ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
83 |
+ |
84 |
+@@ -93,7 +93,7 @@ def test_sanitizer(): |
85 |
+ attribute_value = 'foo' |
86 |
+ if attribute_name in sanitizer.attr_val_is_uri: |
87 |
+ attribute_value = '%s://sub.domain.tld/path/object.ext' % sanitizer.allowed_protocols[0] |
88 |
+- yield (runSanitizerTest, "test_should_allow_%s_attribute" % attribute_name, |
89 |
++ runSanitizerTest("test_should_allow_%s_attribute" % attribute_name, |
90 |
+ "<p %s=\"%s\">foo <bad>bar</bad> baz</p>" % (attribute_name, attribute_value), |
91 |
+ "<p %s='%s'>foo <bad>bar</bad> baz</p>" % (attribute_name, attribute_value)) |
92 |
+ |
93 |
+@@ -101,7 +101,7 @@ def test_sanitizer(): |
94 |
+ rest_of_uri = '//sub.domain.tld/path/object.ext' |
95 |
+ if protocol == 'data': |
96 |
+ rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' |
97 |
+- yield (runSanitizerTest, "test_should_allow_uppercase_%s_uris" % protocol, |
98 |
++ runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, |
99 |
+ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri), |
100 |
+ """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri)) |
101 |
+ |
102 |
+@@ -110,7 +110,7 @@ def test_sanitizer(): |
103 |
+ if protocol == 'data': |
104 |
+ rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' |
105 |
+ protocol = protocol.upper() |
106 |
+- yield (runSanitizerTest, "test_should_allow_uppercase_%s_uris" % protocol, |
107 |
++ runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, |
108 |
+ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri), |
109 |
+ """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri)) |
110 |
+ |
111 |
+diff --git a/html5lib/tests/test_serializer.py b/html5lib/tests/test_serializer.py |
112 |
+index c23592af..a4250935 100644 |
113 |
+--- a/html5lib/tests/test_serializer.py |
114 |
++++ b/html5lib/tests/test_serializer.py |
115 |
+@@ -222,4 +222,4 @@ def test_serializer(): |
116 |
+ with open(filename) as fp: |
117 |
+ tests = json.load(fp) |
118 |
+ for test in tests['tests']: |
119 |
+- yield runSerializerTest, test["input"], test["expected"], test.get("options", {}) |
120 |
++ runSerializerTest(test["input"], test["expected"], test.get("options", {})) |
121 |
+diff --git a/html5lib/tests/test_stream.py b/html5lib/tests/test_stream.py |
122 |
+index 27c39538..a9b3ebbe 100644 |
123 |
+--- a/html5lib/tests/test_stream.py |
124 |
++++ b/html5lib/tests/test_stream.py |
125 |
+@@ -308,9 +308,10 @@ def test_invalid_codepoints(inp, num): |
126 |
+ ("'\\uD800\\uD800\\uD800'", 3), |
127 |
+ ("'a\\uD800a\\uD800a\\uD800a'", 3), |
128 |
+ ("'\\uDFFF\\uDBFF'", 2), |
129 |
+- pytest.mark.skipif(sys.maxunicode == 0xFFFF, |
130 |
+- ("'\\uDBFF\\uDFFF'", 2), |
131 |
+- reason="narrow Python")]) |
132 |
++ pytest.param( |
133 |
++ "'\\uDBFF\\uDFFF'", 2, |
134 |
++ mark=pytest.mark.skipif(sys.maxunicode == 0xFFFF, |
135 |
++ reason="narrow Python"))]) |
136 |
+ def test_invalid_codepoints_surrogates(inp, num): |
137 |
+ inp = eval(inp) # pylint:disable=eval-used |
138 |
+ fp = StringIO(inp) |
139 |
+diff --git a/html5lib/tests/test_treewalkers.py b/html5lib/tests/test_treewalkers.py |
140 |
+index 67fc89e5..c2323b7e 100644 |
141 |
+--- a/html5lib/tests/test_treewalkers.py |
142 |
++++ b/html5lib/tests/test_treewalkers.py |
143 |
+@@ -99,7 +99,7 @@ def test_treewalker_six_mix(): |
144 |
+ |
145 |
+ for tree in sorted(treeTypes.items()): |
146 |
+ for intext, attrs, expected in sm_tests: |
147 |
+- yield runTreewalkerEditTest, intext, expected, attrs, tree |
148 |
++ runTreewalkerEditTest(intext, expected, attrs, tree) |
149 |
+ |
150 |
+ |
151 |
+ @pytest.mark.parametrize("tree,char", itertools.product(sorted(treeTypes.items()), ["x", "\u1234"])) |
152 |
+diff --git a/requirements-test.txt b/requirements-test.txt |
153 |
+index 4e223a3f..b936e0fa 100644 |
154 |
+--- a/requirements-test.txt |
155 |
++++ b/requirements-test.txt |
156 |
+@@ -4,7 +4,7 @@ tox |
157 |
+ |
158 |
+ flake8<3.0 |
159 |
+ |
160 |
+-pytest==3.2.5 |
161 |
++pytest>=4.3,<4.4 |
162 |
+ coverage |
163 |
+ pytest-expect>=1.1,<2.0 |
164 |
+ mock |
165 |
+diff --git a/html5lib/tests/test_encoding.py b/html5lib/tests/test_encoding.py |
166 |
+index 97b6ca2a..9f137e7a 100644 |
167 |
+--- a/html5lib/tests/test_encoding.py |
168 |
++++ b/html5lib/tests/test_encoding.py |
169 |
+@@ -95,6 +95,7 @@ def runPreScanEncodingTest(data, encoding): |
170 |
+ assert encoding == stream.charEncoding[0].name, errorMessage(data, encoding, stream.charEncoding[0].name) |
171 |
+ |
172 |
+ |
173 |
++@×××××××××××.skip(reason="broken under pytest4") |
174 |
+ def test_encoding(): |
175 |
+ for filename in get_data_files("encoding"): |
176 |
+ tests = _TestData(filename, b"data", encoding=None) |
177 |
+ |
178 |
+From 8ded69fdc0ae45f0531e1633927beb2190ab18a6 Mon Sep 17 00:00:00 2001 |
179 |
+From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@××××.eu> |
180 |
+Date: Fri, 8 Nov 2019 15:28:00 +0100 |
181 |
+Subject: [PATCH 3/4] Make flake8 happy |
182 |
+ |
183 |
+--- |
184 |
+ html5lib/tests/test_sanitizer.py | 44 ++++++++++++++++++++------------ |
185 |
+ 1 file changed, 27 insertions(+), 17 deletions(-) |
186 |
+ |
187 |
+diff --git a/html5lib/tests/test_sanitizer.py b/html5lib/tests/test_sanitizer.py |
188 |
+index 1b7285fc..a29d5ef3 100644 |
189 |
+--- a/html5lib/tests/test_sanitizer.py |
190 |
++++ b/html5lib/tests/test_sanitizer.py |
191 |
+@@ -63,25 +63,32 @@ def test_sanitizer(): |
192 |
+ for ns, tag_name in sanitizer.allowed_elements: |
193 |
+ if ns != constants.namespaces["html"]: |
194 |
+ continue |
195 |
+- if tag_name in ['caption', 'col', 'colgroup', 'optgroup', 'option', 'table', 'tbody', 'td', |
196 |
+- 'tfoot', 'th', 'thead', 'tr', 'select']: |
197 |
++ if tag_name in ['caption', 'col', 'colgroup', 'optgroup', 'option', |
198 |
++ 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', |
199 |
++ 'tr', 'select']: |
200 |
+ continue # TODO |
201 |
+ if tag_name == 'image': |
202 |
+ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
203 |
+- "<img title=\"1\"/>foo <bad>bar</bad> baz", |
204 |
+- "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
205 |
++ "<img title=\"1\"/>foo <bad>bar</bad> baz", |
206 |
++ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % |
207 |
++ (tag_name, tag_name)) |
208 |
+ elif tag_name == 'br': |
209 |
+ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
210 |
+- "<br title=\"1\"/>foo <bad>bar</bad> baz<br/>", |
211 |
+- "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
212 |
++ "<br title=\"1\"/>foo <bad>bar</bad> baz<br/>", |
213 |
++ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % |
214 |
++ (tag_name, tag_name)) |
215 |
+ elif tag_name in constants.voidElements: |
216 |
+ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
217 |
+- "<%s title=\"1\"/>foo <bad>bar</bad> baz" % tag_name, |
218 |
+- "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
219 |
++ "<%s title=\"1\"/>foo <bad>bar</bad> baz" % |
220 |
++ tag_name, |
221 |
++ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % |
222 |
++ (tag_name, tag_name)) |
223 |
+ else: |
224 |
+ runSanitizerTest("test_should_allow_%s_tag" % tag_name, |
225 |
+- "<%s title=\"1\">foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name), |
226 |
+- "<%s title='1'>foo <bad>bar</bad> baz</%s>" % (tag_name, tag_name)) |
227 |
++ "<%s title=\"1\">foo <bad>bar</bad> baz</%s>" % |
228 |
++ (tag_name, tag_name), |
229 |
++ "<%s title='1'>foo <bad>bar</bad> baz</%s>" % |
230 |
++ (tag_name, tag_name)) |
231 |
+ |
232 |
+ for ns, attribute_name in sanitizer.allowed_attributes: |
233 |
+ if ns is not None: |
234 |
+@@ -92,18 +99,21 @@ def test_sanitizer(): |
235 |
+ continue |
236 |
+ attribute_value = 'foo' |
237 |
+ if attribute_name in sanitizer.attr_val_is_uri: |
238 |
+- attribute_value = '%s://sub.domain.tld/path/object.ext' % sanitizer.allowed_protocols[0] |
239 |
++ attribute_value = '%s://sub.domain.tld/path/object.ext' \ |
240 |
++ % sanitizer.allowed_protocols[0] |
241 |
+ runSanitizerTest("test_should_allow_%s_attribute" % attribute_name, |
242 |
+- "<p %s=\"%s\">foo <bad>bar</bad> baz</p>" % (attribute_name, attribute_value), |
243 |
+- "<p %s='%s'>foo <bad>bar</bad> baz</p>" % (attribute_name, attribute_value)) |
244 |
++ "<p %s=\"%s\">foo <bad>bar</bad> baz</p>" % |
245 |
++ (attribute_name, attribute_value), |
246 |
++ "<p %s='%s'>foo <bad>bar</bad> baz</p>" % |
247 |
++ (attribute_name, attribute_value)) |
248 |
+ |
249 |
+ for protocol in sanitizer.allowed_protocols: |
250 |
+ rest_of_uri = '//sub.domain.tld/path/object.ext' |
251 |
+ if protocol == 'data': |
252 |
+ rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' |
253 |
+ runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, |
254 |
+- "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri), |
255 |
+- """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri)) |
256 |
++ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri), |
257 |
++ '<img src="%s:%s">foo</a>' % (protocol, rest_of_uri)) |
258 |
+ |
259 |
+ for protocol in sanitizer.allowed_protocols: |
260 |
+ rest_of_uri = '//sub.domain.tld/path/object.ext' |
261 |
+@@ -111,8 +121,8 @@ def test_sanitizer(): |
262 |
+ rest_of_uri = 'image/png;base64,aGVsbG8gd29ybGQ=' |
263 |
+ protocol = protocol.upper() |
264 |
+ runSanitizerTest("test_should_allow_uppercase_%s_uris" % protocol, |
265 |
+- "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri), |
266 |
+- """<img src="%s:%s">foo</a>""" % (protocol, rest_of_uri)) |
267 |
++ "<img src=\"%s:%s\">foo</a>" % (protocol, rest_of_uri), |
268 |
++ '<img src="%s:%s">foo</a>' % (protocol, rest_of_uri)) |
269 |
+ |
270 |
+ |
271 |
+ def test_lowercase_color_codes_in_style(): |
272 |
+ |
273 |
+From b4d066b2d9b4ea1135183c6500565c2ab8758bf1 Mon Sep 17 00:00:00 2001 |
274 |
+From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= <mcepl@××××.eu> |
275 |
+Date: Fri, 8 Nov 2019 16:17:19 +0100 |
276 |
+Subject: [PATCH 4/4] No limits on the upper version of pytest |
277 |
+ |
278 |
+--- |
279 |
+ requirements-test.txt | 2 +- |
280 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
281 |
+ |
282 |
+diff --git a/requirements-test.txt b/requirements-test.txt |
283 |
+index b936e0fa..1cd46922 100644 |
284 |
+--- a/requirements-test.txt |
285 |
++++ b/requirements-test.txt |
286 |
+@@ -4,7 +4,7 @@ tox |
287 |
+ |
288 |
+ flake8<3.0 |
289 |
+ |
290 |
+-pytest>=4.3,<4.4 |
291 |
++pytest>=4.3 |
292 |
+ coverage |
293 |
+ pytest-expect>=1.1,<2.0 |
294 |
+ mock |
295 |
|
296 |
diff --git a/dev-python/html5lib/html5lib-1.0.1.ebuild b/dev-python/html5lib/html5lib-1.0.1-r1.ebuild |
297 |
similarity index 63% |
298 |
copy from dev-python/html5lib/html5lib-1.0.1.ebuild |
299 |
copy to dev-python/html5lib/html5lib-1.0.1-r1.ebuild |
300 |
index e6da9bacdd2..751b9bc332d 100644 |
301 |
--- a/dev-python/html5lib/html5lib-1.0.1.ebuild |
302 |
+++ b/dev-python/html5lib/html5lib-1.0.1-r1.ebuild |
303 |
@@ -1,9 +1,9 @@ |
304 |
# Copyright 1999-2019 Gentoo Authors |
305 |
# Distributed under the terms of the GNU General Public License v2 |
306 |
|
307 |
-EAPI=6 |
308 |
+EAPI=7 |
309 |
|
310 |
-PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy pypy3 ) |
311 |
+PYTHON_COMPAT=( python{2_7,3_{5,6,7,8}} pypy{,3} ) |
312 |
PYTHON_REQ_USE="xml(+)" |
313 |
|
314 |
inherit distutils-r1 |
315 |
@@ -14,19 +14,23 @@ SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" |
316 |
|
317 |
LICENSE="MIT" |
318 |
SLOT="0" |
319 |
-KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 sparc x86 ~x64-macos" |
320 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-macos" |
321 |
IUSE="test" |
322 |
|
323 |
RDEPEND=">=dev-python/six-1.9[${PYTHON_USEDEP}] |
324 |
dev-python/webencodings[${PYTHON_USEDEP}]" |
325 |
-DEPEND="${RDEPEND} |
326 |
+BDEPEND="${RDEPEND} |
327 |
dev-python/setuptools[${PYTHON_USEDEP}] |
328 |
test? ( |
329 |
- dev-python/pytest[${PYTHON_USEDEP}] |
330 |
dev-python/pytest-expect[${PYTHON_USEDEP}] |
331 |
dev-python/mock[${PYTHON_USEDEP}] |
332 |
)" |
333 |
|
334 |
-python_test() { |
335 |
- py.test -v || die "Tests fail with ${EPYTHON}" |
336 |
-} |
337 |
+RESTRICT+=" !test? ( test )" |
338 |
+ |
339 |
+PATCHES=( |
340 |
+ # https://github.com/html5lib/html5lib-python/pull/429 |
341 |
+ "${FILESDIR}/html5lib-python-1.0.1-support-pytest4.patch" |
342 |
+) |
343 |
+ |
344 |
+distutils_enable_tests pytest |
345 |
|
346 |
diff --git a/dev-python/html5lib/html5lib-1.0.1.ebuild b/dev-python/html5lib/html5lib-1.0.1.ebuild |
347 |
index e6da9bacdd2..c67285351b0 100644 |
348 |
--- a/dev-python/html5lib/html5lib-1.0.1.ebuild |
349 |
+++ b/dev-python/html5lib/html5lib-1.0.1.ebuild |
350 |
@@ -27,6 +27,8 @@ DEPEND="${RDEPEND} |
351 |
dev-python/mock[${PYTHON_USEDEP}] |
352 |
)" |
353 |
|
354 |
+RESTRICT="!test? ( test )" |
355 |
+ |
356 |
python_test() { |
357 |
py.test -v || die "Tests fail with ${EPYTHON}" |
358 |
} |