1 |
commit: d0d8b0b1036bbb5fcd6ef7a375adbd8f087bc0d0 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun May 31 16:08:37 2020 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun May 31 16:33:35 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d0d8b0b1 |
7 |
|
8 |
dev-python/Babel: Port to py39, fix tests |
9 |
|
10 |
Closes: https://bugs.gentoo.org/714854 |
11 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
12 |
|
13 |
dev-python/Babel/Babel-2.8.0-r1.ebuild | 11 +- |
14 |
dev-python/Babel/files/Babel-2.8.0-py39.patch | 169 ++++++++++++++++++++++++++ |
15 |
2 files changed, 179 insertions(+), 1 deletion(-) |
16 |
|
17 |
diff --git a/dev-python/Babel/Babel-2.8.0-r1.ebuild b/dev-python/Babel/Babel-2.8.0-r1.ebuild |
18 |
index f970db31cb9..8dc11d6ec29 100644 |
19 |
--- a/dev-python/Babel/Babel-2.8.0-r1.ebuild |
20 |
+++ b/dev-python/Babel/Babel-2.8.0-r1.ebuild |
21 |
@@ -3,7 +3,7 @@ |
22 |
|
23 |
EAPI=7 |
24 |
|
25 |
-PYTHON_COMPAT=( pypy3 python{2_7,3_{6,7,8}} ) |
26 |
+PYTHON_COMPAT=( pypy3 python{2_7,3_{6..9}} ) |
27 |
PYTHON_REQ_USE="threads(+)" |
28 |
DISTUTILS_USE_SETUPTOOLS=rdepend |
29 |
|
30 |
@@ -24,3 +24,12 @@ DEPEND="${DEPEND} |
31 |
|
32 |
distutils_enable_sphinx docs |
33 |
distutils_enable_tests pytest |
34 |
+ |
35 |
+PATCHES=( |
36 |
+ "${FILESDIR}"/${P}-py39.patch |
37 |
+) |
38 |
+ |
39 |
+src_test() { |
40 |
+ local -x TZ=UTC |
41 |
+ distutils-r1_src_test |
42 |
+} |
43 |
|
44 |
diff --git a/dev-python/Babel/files/Babel-2.8.0-py39.patch b/dev-python/Babel/files/Babel-2.8.0-py39.patch |
45 |
new file mode 100644 |
46 |
index 00000000000..efada9c1d08 |
47 |
--- /dev/null |
48 |
+++ b/dev-python/Babel/files/Babel-2.8.0-py39.patch |
49 |
@@ -0,0 +1,169 @@ |
50 |
+From 167b71421f113e2210e4deefef5020402492e5be Mon Sep 17 00:00:00 2001 |
51 |
+From: Felix Schwarz <felix.schwarz@×××××××××××.eu> |
52 |
+Date: Tue, 5 May 2020 09:58:01 +0200 |
53 |
+Subject: [PATCH] stop using deprecated ElementTree methods "getchildren()" and |
54 |
+ "getiterator()" |
55 |
+ |
56 |
+Both methods were removed in Python 3.9 as mentioned in the release notes: |
57 |
+ |
58 |
+> Methods getchildren() and getiterator() of classes ElementTree and Element in |
59 |
+> the ElementTree module have been removed. They were deprecated in Python 3.2. |
60 |
+> Use iter(x) or list(x) instead of x.getchildren() and x.iter() or |
61 |
+> list(x.iter()) instead of x.getiterator(). |
62 |
+--- |
63 |
+ scripts/import_cldr.py | 18 +++++++++--------- |
64 |
+ 1 file changed, 9 insertions(+), 9 deletions(-) |
65 |
+ |
66 |
+diff --git a/scripts/import_cldr.py b/scripts/import_cldr.py |
67 |
+index 8993b68e..2ed3af91 100755 |
68 |
+--- a/scripts/import_cldr.py |
69 |
++++ b/scripts/import_cldr.py |
70 |
+@@ -598,7 +598,7 @@ def parse_calendar_months(data, calendar): |
71 |
+ for width in ctxt.findall('monthWidth'): |
72 |
+ width_type = width.attrib['type'] |
73 |
+ widths = ctxts.setdefault(width_type, {}) |
74 |
+- for elem in width.getiterator(): |
75 |
++ for elem in width.iter(): |
76 |
+ if elem.tag == 'month': |
77 |
+ _import_type_text(widths, elem, int(elem.attrib['type'])) |
78 |
+ elif elem.tag == 'alias': |
79 |
+@@ -616,7 +616,7 @@ def parse_calendar_days(data, calendar): |
80 |
+ for width in ctxt.findall('dayWidth'): |
81 |
+ width_type = width.attrib['type'] |
82 |
+ widths = ctxts.setdefault(width_type, {}) |
83 |
+- for elem in width.getiterator(): |
84 |
++ for elem in width.iter(): |
85 |
+ if elem.tag == 'day': |
86 |
+ _import_type_text(widths, elem, weekdays[elem.attrib['type']]) |
87 |
+ elif elem.tag == 'alias': |
88 |
+@@ -634,7 +634,7 @@ def parse_calendar_quarters(data, calendar): |
89 |
+ for width in ctxt.findall('quarterWidth'): |
90 |
+ width_type = width.attrib['type'] |
91 |
+ widths = ctxts.setdefault(width_type, {}) |
92 |
+- for elem in width.getiterator(): |
93 |
++ for elem in width.iter(): |
94 |
+ if elem.tag == 'quarter': |
95 |
+ _import_type_text(widths, elem, int(elem.attrib['type'])) |
96 |
+ elif elem.tag == 'alias': |
97 |
+@@ -649,7 +649,7 @@ def parse_calendar_eras(data, calendar): |
98 |
+ for width in calendar.findall('eras/*'): |
99 |
+ width_type = NAME_MAP[width.tag] |
100 |
+ widths = eras.setdefault(width_type, {}) |
101 |
+- for elem in width.getiterator(): |
102 |
++ for elem in width.iter(): |
103 |
+ if elem.tag == 'era': |
104 |
+ _import_type_text(widths, elem, type=int(elem.attrib.get('type'))) |
105 |
+ elif elem.tag == 'alias': |
106 |
+@@ -676,7 +676,7 @@ def parse_calendar_periods(data, calendar): |
107 |
+ def parse_calendar_date_formats(data, calendar): |
108 |
+ date_formats = data.setdefault('date_formats', {}) |
109 |
+ for format in calendar.findall('dateFormats'): |
110 |
+- for elem in format.getiterator(): |
111 |
++ for elem in format.iter(): |
112 |
+ if elem.tag == 'dateFormatLength': |
113 |
+ type = elem.attrib.get('type') |
114 |
+ if _should_skip_elem(elem, type, date_formats): |
115 |
+@@ -696,7 +696,7 @@ def parse_calendar_date_formats(data, calendar): |
116 |
+ def parse_calendar_time_formats(data, calendar): |
117 |
+ time_formats = data.setdefault('time_formats', {}) |
118 |
+ for format in calendar.findall('timeFormats'): |
119 |
+- for elem in format.getiterator(): |
120 |
++ for elem in format.iter(): |
121 |
+ if elem.tag == 'timeFormatLength': |
122 |
+ type = elem.attrib.get('type') |
123 |
+ if _should_skip_elem(elem, type, time_formats): |
124 |
+@@ -717,7 +717,7 @@ def parse_calendar_datetime_skeletons(data, calendar): |
125 |
+ datetime_formats = data.setdefault('datetime_formats', {}) |
126 |
+ datetime_skeletons = data.setdefault('datetime_skeletons', {}) |
127 |
+ for format in calendar.findall('dateTimeFormats'): |
128 |
+- for elem in format.getiterator(): |
129 |
++ for elem in format.iter(): |
130 |
+ if elem.tag == 'dateTimeFormatLength': |
131 |
+ type = elem.attrib.get('type') |
132 |
+ if _should_skip_elem(elem, type, datetime_formats): |
133 |
+@@ -880,7 +880,7 @@ def parse_interval_formats(data, tree): |
134 |
+ interval_formats[None] = elem.text |
135 |
+ elif elem.tag == "intervalFormatItem": |
136 |
+ skel_data = interval_formats.setdefault(elem.attrib["id"], {}) |
137 |
+- for item_sub in elem.getchildren(): |
138 |
++ for item_sub in elem: |
139 |
+ if item_sub.tag == "greatestDifference": |
140 |
+ skel_data[item_sub.attrib["id"]] = split_interval_pattern(item_sub.text) |
141 |
+ else: |
142 |
+@@ -903,7 +903,7 @@ def parse_currency_formats(data, tree): |
143 |
+ type = '%s:%s' % (type, curr_length_type) |
144 |
+ if _should_skip_elem(elem, type, currency_formats): |
145 |
+ continue |
146 |
+- for child in elem.getiterator(): |
147 |
++ for child in elem.iter(): |
148 |
+ if child.tag == 'alias': |
149 |
+ currency_formats[type] = Alias( |
150 |
+ _translate_alias(['currency_formats', elem.attrib['type']], |
151 |
+From 7bdaa28a55e8d8228d5434effa4b1473ab7b3669 Mon Sep 17 00:00:00 2001 |
152 |
+From: Felix Schwarz <felix.schwarz@×××××××××××.eu> |
153 |
+Date: Tue, 5 May 2020 08:05:56 +0000 |
154 |
+Subject: [PATCH] fix tests when using Python 3.9a6 |
155 |
+ |
156 |
+In Python 3.9a6 integer values for future flags were changed to prevent |
157 |
+collision with compiler flags. We need to retrieve these at runtime so |
158 |
+the test suite works with Python <= 3.8 as well as Python 3.9. |
159 |
+--- |
160 |
+ tests/test_util.py | 17 ++++++++++++----- |
161 |
+ 1 file changed, 12 insertions(+), 5 deletions(-) |
162 |
+ |
163 |
+diff --git a/tests/test_util.py b/tests/test_util.py |
164 |
+index a6a4450c..b9343aaa 100644 |
165 |
+--- a/tests/test_util.py |
166 |
++++ b/tests/test_util.py |
167 |
+@@ -11,6 +11,7 @@ |
168 |
+ # individuals. For the exact contribution history, see the revision |
169 |
+ # history and logs, available at http://babel.edgewall.org/log/. |
170 |
+ |
171 |
++import __future__ |
172 |
+ import unittest |
173 |
+ |
174 |
+ import pytest |
175 |
+@@ -20,6 +21,12 @@ |
176 |
+ from babel.util import parse_future_flags |
177 |
+ |
178 |
+ |
179 |
++class _FF: |
180 |
++ division = __future__.division.compiler_flag |
181 |
++ print_function = __future__.print_function.compiler_flag |
182 |
++ with_statement = __future__.with_statement.compiler_flag |
183 |
++ unicode_literals = __future__.unicode_literals.compiler_flag |
184 |
++ |
185 |
+ def test_distinct(): |
186 |
+ assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4] |
187 |
+ assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r'] |
188 |
+@@ -70,25 +77,25 @@ def test_parse_encoding_non_ascii(): |
189 |
+ from __future__ import print_function, |
190 |
+ division, with_statement, |
191 |
+ unicode_literals |
192 |
+-''', 0x10000 | 0x2000 | 0x8000 | 0x20000), |
193 |
++''', _FF.print_function | _FF.division | _FF.with_statement | _FF.unicode_literals), |
194 |
+ (''' |
195 |
+ from __future__ import print_function, division |
196 |
+ print('hello') |
197 |
+-''', 0x10000 | 0x2000), |
198 |
++''', _FF.print_function | _FF.division), |
199 |
+ (''' |
200 |
+ from __future__ import print_function, division, unknown,,,,, |
201 |
+ print 'hello' |
202 |
+-''', 0x10000 | 0x2000), |
203 |
++''', _FF.print_function | _FF.division), |
204 |
+ (''' |
205 |
+ from __future__ import ( |
206 |
+ print_function, |
207 |
+ division) |
208 |
+-''', 0x10000 | 0x2000), |
209 |
++''', _FF.print_function | _FF.division), |
210 |
+ (''' |
211 |
+ from __future__ import \\ |
212 |
+ print_function, \\ |
213 |
+ division |
214 |
+-''', 0x10000 | 0x2000), |
215 |
++''', _FF.print_function | _FF.division), |
216 |
+ ]) |
217 |
+ def test_parse_future(source, result): |
218 |
+ fp = BytesIO(source.encode('latin-1')) |