1 |
commit: baf79da44e543cc0fd12f64a2c99b49b66727f39 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Feb 9 10:44:56 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Feb 9 10:45:35 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=baf79da4 |
7 |
|
8 |
*/*: reformat with latest Black 22.1.0 |
9 |
|
10 |
Black is now stable so this shouldn't be needed in future. |
11 |
|
12 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
13 |
|
14 |
bin/filter-bash-environment.py | 18 ++++++------ |
15 |
bin/xattr-helper.py | 2 +- |
16 |
lib/portage/_sets/__init__.py | 2 +- |
17 |
lib/portage/package/ebuild/config.py | 16 ++++------ |
18 |
lib/portage/tests/bin/test_filter_bash_env.py | 4 +-- |
19 |
lib/portage/tests/dep/testAtom.py | 34 +++++++++++++--------- |
20 |
lib/portage/tests/process/test_PipeLogger.py | 14 ++++----- |
21 |
lib/portage/tests/process/test_PopenProcess.py | 2 +- |
22 |
.../tests/process/test_PopenProcessBlockingIO.py | 2 +- |
23 |
lib/portage/tests/process/test_poll.py | 2 +- |
24 |
lib/portage/tests/util/file_copy/test_copyfile.py | 6 ++-- |
25 |
lib/portage/tests/xpak/test_decodeint.py | 2 +- |
26 |
lib/portage/util/backoff.py | 2 +- |
27 |
lib/portage/util/lafilefixer.py | 6 ++-- |
28 |
repoman/lib/repoman/copyrights.py | 6 ++-- |
29 |
.../modules/scan/metadata/ebuild_metadata.py | 14 ++++----- |
30 |
repoman/lib/repoman/modules/vcs/cvs/changes.py | 2 +- |
31 |
17 files changed, 66 insertions(+), 68 deletions(-) |
32 |
|
33 |
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py |
34 |
index f36df091e..5ec795999 100755 |
35 |
--- a/bin/filter-bash-environment.py |
36 |
+++ b/bin/filter-bash-environment.py |
37 |
@@ -6,17 +6,17 @@ import os |
38 |
import re |
39 |
import sys |
40 |
|
41 |
-here_doc_re = re.compile(br".*\s<<[-]?(\w+)$") |
42 |
-func_start_re = re.compile(br"^[-\w]+\s*\(\)\s*$") |
43 |
-func_end_re = re.compile(br"^\}$") |
44 |
+here_doc_re = re.compile(rb".*\s<<[-]?(\w+)$") |
45 |
+func_start_re = re.compile(rb"^[-\w]+\s*\(\)\s*$") |
46 |
+func_end_re = re.compile(rb"^\}$") |
47 |
|
48 |
var_assign_re = re.compile( |
49 |
- br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$' |
50 |
+ rb'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$' |
51 |
) |
52 |
-close_quote_re = re.compile(br'(\\"|"|\')\s*$') |
53 |
-readonly_re = re.compile(br"^declare\s+-(\S*)r(\S*)\s+") |
54 |
+close_quote_re = re.compile(rb'(\\"|"|\')\s*$') |
55 |
+readonly_re = re.compile(rb"^declare\s+-(\S*)r(\S*)\s+") |
56 |
# declare without assignment |
57 |
-var_declare_re = re.compile(br"^declare(\s+-\S+)?\s+([^=\s]+)\s*$") |
58 |
+var_declare_re = re.compile(rb"^declare(\s+-\S+)?\s+([^=\s]+)\s*$") |
59 |
|
60 |
|
61 |
def have_end_quote(quote, line): |
62 |
@@ -146,8 +146,8 @@ if __name__ == "__main__": |
63 |
var_pattern = os.fsencode(args[0]).split() |
64 |
|
65 |
# Filter invalid variable names that are not supported by bash. |
66 |
- var_pattern.append(br"\d.*") |
67 |
- var_pattern.append(br".*\W.*") |
68 |
+ var_pattern.append(rb"\d.*") |
69 |
+ var_pattern.append(rb".*\W.*") |
70 |
|
71 |
var_pattern = b"^(" + b"|".join(var_pattern) + b")$" |
72 |
filter_bash_environment(re.compile(var_pattern), file_in, file_out) |
73 |
|
74 |
diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py |
75 |
index b62a4de44..9d519b61c 100755 |
76 |
--- a/bin/xattr-helper.py |
77 |
+++ b/bin/xattr-helper.py |
78 |
@@ -22,7 +22,7 @@ import sys |
79 |
from portage.util._xattr import xattr |
80 |
|
81 |
|
82 |
-_UNQUOTE_RE = re.compile(br"\\[0-7]{3}") |
83 |
+_UNQUOTE_RE = re.compile(rb"\\[0-7]{3}") |
84 |
_FS_ENCODING = sys.getfilesystemencoding() |
85 |
|
86 |
|
87 |
|
88 |
diff --git a/lib/portage/_sets/__init__.py b/lib/portage/_sets/__init__.py |
89 |
index 15f942b10..4d7b2c3ec 100644 |
90 |
--- a/lib/portage/_sets/__init__.py |
91 |
+++ b/lib/portage/_sets/__init__.py |
92 |
@@ -181,7 +181,7 @@ class SetConfig: |
93 |
import random |
94 |
|
95 |
while setname in parser.sections(): |
96 |
- setname = "%08d" % random.randint(0, 10 ** 10) |
97 |
+ setname = "%08d" % random.randint(0, 10**10) |
98 |
|
99 |
parser.add_section(setname) |
100 |
for k, v in options.items(): |
101 |
|
102 |
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py |
103 |
index 8fe51784e..99fd2c31e 100644 |
104 |
--- a/lib/portage/package/ebuild/config.py |
105 |
+++ b/lib/portage/package/ebuild/config.py |
106 |
@@ -3317,16 +3317,12 @@ class config: |
107 |
mydict.pop("EROOT", None) |
108 |
mydict.pop("ESYSROOT", None) |
109 |
|
110 |
- if ( |
111 |
- phase |
112 |
- not in ( |
113 |
- "pretend", |
114 |
- "setup", |
115 |
- "preinst", |
116 |
- "postinst", |
117 |
- ) |
118 |
- or not eapi_exports_replace_vars(eapi) |
119 |
- ): |
120 |
+ if phase not in ( |
121 |
+ "pretend", |
122 |
+ "setup", |
123 |
+ "preinst", |
124 |
+ "postinst", |
125 |
+ ) or not eapi_exports_replace_vars(eapi): |
126 |
mydict.pop("REPLACING_VERSIONS", None) |
127 |
|
128 |
if phase not in ("prerm", "postrm") or not eapi_exports_replace_vars(eapi): |
129 |
|
130 |
diff --git a/lib/portage/tests/bin/test_filter_bash_env.py b/lib/portage/tests/bin/test_filter_bash_env.py |
131 |
index 7f0bdf52f..501420560 100644 |
132 |
--- a/lib/portage/tests/bin/test_filter_bash_env.py |
133 |
+++ b/lib/portage/tests/bin/test_filter_bash_env.py |
134 |
@@ -16,7 +16,7 @@ class TestFilterBashEnv(TestCase): |
135 |
test_cases = ( |
136 |
( |
137 |
"RDEPEND BASH.* _EPATCH_ECLASS", |
138 |
- br"""declare -ir BASHPID="28997" |
139 |
+ rb"""declare -ir BASHPID="28997" |
140 |
declare -rx A="portage-2.3.24.tar.bz2" |
141 |
declare -- DESKTOP_DATABASE_DIR="/usr/share/applications" |
142 |
declare PDEPEND=" |
143 |
@@ -53,7 +53,7 @@ use_if_iuse () |
144 |
use $1 |
145 |
} |
146 |
""", |
147 |
- br"""declare -x A="portage-2.3.24.tar.bz2" |
148 |
+ rb"""declare -x A="portage-2.3.24.tar.bz2" |
149 |
declare -- DESKTOP_DATABASE_DIR="/usr/share/applications" |
150 |
declare PDEPEND=" |
151 |
!build? ( |
152 |
|
153 |
diff --git a/lib/portage/tests/dep/testAtom.py b/lib/portage/tests/dep/testAtom.py |
154 |
index 33139d83a..a6fd92dc3 100644 |
155 |
--- a/lib/portage/tests/dep/testAtom.py |
156 |
+++ b/lib/portage/tests/dep/testAtom.py |
157 |
@@ -553,22 +553,28 @@ class TestAtom(TestCase): |
158 |
other_use, validator.is_valid_flag, parent_use |
159 |
) |
160 |
if parent_use is None: |
161 |
- fail_msg = "Atom: %s, other_use: %s, iuse: %s, parent_use: %s, got: %s, expected: %s" % ( |
162 |
- atom, |
163 |
- " ".join(other_use), |
164 |
- " ".join(iuse), |
165 |
- "None", |
166 |
- str(violated_atom), |
167 |
- expected_violated_atom, |
168 |
+ fail_msg = ( |
169 |
+ "Atom: %s, other_use: %s, iuse: %s, parent_use: %s, got: %s, expected: %s" |
170 |
+ % ( |
171 |
+ atom, |
172 |
+ " ".join(other_use), |
173 |
+ " ".join(iuse), |
174 |
+ "None", |
175 |
+ str(violated_atom), |
176 |
+ expected_violated_atom, |
177 |
+ ) |
178 |
) |
179 |
else: |
180 |
- fail_msg = "Atom: %s, other_use: %s, iuse: %s, parent_use: %s, got: %s, expected: %s" % ( |
181 |
- atom, |
182 |
- " ".join(other_use), |
183 |
- " ".join(iuse), |
184 |
- " ".join(parent_use), |
185 |
- str(violated_atom), |
186 |
- expected_violated_atom, |
187 |
+ fail_msg = ( |
188 |
+ "Atom: %s, other_use: %s, iuse: %s, parent_use: %s, got: %s, expected: %s" |
189 |
+ % ( |
190 |
+ atom, |
191 |
+ " ".join(other_use), |
192 |
+ " ".join(iuse), |
193 |
+ " ".join(parent_use), |
194 |
+ str(violated_atom), |
195 |
+ expected_violated_atom, |
196 |
+ ) |
197 |
) |
198 |
self.assertEqual(str(violated_atom), expected_violated_atom, fail_msg) |
199 |
|
200 |
|
201 |
diff --git a/lib/portage/tests/process/test_PipeLogger.py b/lib/portage/tests/process/test_PipeLogger.py |
202 |
index 4d9234639..eb0bf053b 100644 |
203 |
--- a/lib/portage/tests/process/test_PipeLogger.py |
204 |
+++ b/lib/portage/tests/process/test_PipeLogger.py |
205 |
@@ -59,13 +59,13 @@ class PipeLoggerTestCase(TestCase): |
206 |
6, |
207 |
7, |
208 |
8, |
209 |
- 2 ** 5, |
210 |
- 2 ** 10, |
211 |
- 2 ** 12, |
212 |
- 2 ** 13, |
213 |
- 2 ** 14, |
214 |
- 2 ** 17, |
215 |
- 2 ** 17 + 1, |
216 |
+ 2**5, |
217 |
+ 2**10, |
218 |
+ 2**12, |
219 |
+ 2**13, |
220 |
+ 2**14, |
221 |
+ 2**17, |
222 |
+ 2**17 + 1, |
223 |
): |
224 |
test_string = x * "a" |
225 |
output = loop.run_until_complete( |
226 |
|
227 |
diff --git a/lib/portage/tests/process/test_PopenProcess.py b/lib/portage/tests/process/test_PopenProcess.py |
228 |
index 4135802cd..0ffc8d31b 100644 |
229 |
--- a/lib/portage/tests/process/test_PopenProcess.py |
230 |
+++ b/lib/portage/tests/process/test_PopenProcess.py |
231 |
@@ -86,7 +86,7 @@ class PopenPipeTestCase(TestCase): |
232 |
return content.decode("ascii", "replace") |
233 |
|
234 |
def testPopenPipe(self): |
235 |
- for x in (1, 2, 5, 6, 7, 8, 2 ** 5, 2 ** 10, 2 ** 12, 2 ** 13, 2 ** 14): |
236 |
+ for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14): |
237 |
test_string = x * "a" |
238 |
output = self._testPipeReader(test_string) |
239 |
self.assertEqual( |
240 |
|
241 |
diff --git a/lib/portage/tests/process/test_PopenProcessBlockingIO.py b/lib/portage/tests/process/test_PopenProcessBlockingIO.py |
242 |
index 3b7208c7e..1e334560f 100644 |
243 |
--- a/lib/portage/tests/process/test_PopenProcessBlockingIO.py |
244 |
+++ b/lib/portage/tests/process/test_PopenProcessBlockingIO.py |
245 |
@@ -62,7 +62,7 @@ class PopenPipeBlockingIOTestCase(TestCase): |
246 |
self.assertFalse(True, skip_reason) |
247 |
return |
248 |
|
249 |
- for x in (1, 2, 5, 6, 7, 8, 2 ** 5, 2 ** 10, 2 ** 12, 2 ** 13, 2 ** 14): |
250 |
+ for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14): |
251 |
test_string = x * "a" |
252 |
output = self._testPipeReader(test_string) |
253 |
self.assertEqual( |
254 |
|
255 |
diff --git a/lib/portage/tests/process/test_poll.py b/lib/portage/tests/process/test_poll.py |
256 |
index c523a8d8f..627157211 100644 |
257 |
--- a/lib/portage/tests/process/test_poll.py |
258 |
+++ b/lib/portage/tests/process/test_poll.py |
259 |
@@ -95,7 +95,7 @@ class PipeReaderTestCase(TestCase): |
260 |
return consumer.getvalue().decode("ascii", "replace") |
261 |
|
262 |
def _do_test(self, make_pipes): |
263 |
- for x in (1, 2, 5, 6, 7, 8, 2 ** 5, 2 ** 10, 2 ** 12, 2 ** 13, 2 ** 14): |
264 |
+ for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14): |
265 |
test_string = x * "a" |
266 |
(read_end, write_end), cleanup = make_pipes() |
267 |
try: |
268 |
|
269 |
diff --git a/lib/portage/tests/util/file_copy/test_copyfile.py b/lib/portage/tests/util/file_copy/test_copyfile.py |
270 |
index d7e74f26d..68e689792 100644 |
271 |
--- a/lib/portage/tests/util/file_copy/test_copyfile.py |
272 |
+++ b/lib/portage/tests/util/file_copy/test_copyfile.py |
273 |
@@ -43,13 +43,13 @@ class CopyFileSparseTestCase(TestCase): |
274 |
# sparse files. |
275 |
with open(src_path, "wb") as f: |
276 |
f.write(content) |
277 |
- f.seek(2 ** 17, 1) |
278 |
+ f.seek(2**17, 1) |
279 |
f.write(content) |
280 |
- f.seek(2 ** 18, 1) |
281 |
+ f.seek(2**18, 1) |
282 |
f.write(content) |
283 |
# Test that sparse blocks are handled correctly at |
284 |
# the end of the file (involves seek and truncate). |
285 |
- f.seek(2 ** 17, 1) |
286 |
+ f.seek(2**17, 1) |
287 |
|
288 |
copyfile(src_path, dest_path) |
289 |
|
290 |
|
291 |
diff --git a/lib/portage/tests/xpak/test_decodeint.py b/lib/portage/tests/xpak/test_decodeint.py |
292 |
index 25388d866..2d4df5f16 100644 |
293 |
--- a/lib/portage/tests/xpak/test_decodeint.py |
294 |
+++ b/lib/portage/tests/xpak/test_decodeint.py |
295 |
@@ -12,5 +12,5 @@ class testDecodeIntTestCase(TestCase): |
296 |
for n in range(1000): |
297 |
self.assertEqual(decodeint(encodeint(n)), n) |
298 |
|
299 |
- for n in (2 ** 32 - 1,): |
300 |
+ for n in (2**32 - 1,): |
301 |
self.assertEqual(decodeint(encodeint(n)), n) |
302 |
|
303 |
diff --git a/lib/portage/util/backoff.py b/lib/portage/util/backoff.py |
304 |
index d2c78ad76..f4a9bfc33 100644 |
305 |
--- a/lib/portage/util/backoff.py |
306 |
+++ b/lib/portage/util/backoff.py |
307 |
@@ -40,7 +40,7 @@ class ExponentialBackoff: |
308 |
@rtype: int |
309 |
""" |
310 |
try: |
311 |
- return min(self._limit, self._multiplier * (self._base ** tries)) |
312 |
+ return min(self._limit, self._multiplier * (self._base**tries)) |
313 |
except OverflowError: |
314 |
return self._limit |
315 |
|
316 |
|
317 |
diff --git a/lib/portage/util/lafilefixer.py b/lib/portage/util/lafilefixer.py |
318 |
index 59df30b4b..1fd97c242 100644 |
319 |
--- a/lib/portage/util/lafilefixer.py |
320 |
+++ b/lib/portage/util/lafilefixer.py |
321 |
@@ -40,8 +40,8 @@ inh_link_flags_re = re.compile(b"inherited_linker_flags='(?P<value>[^']*)'$") |
322 |
# replace 'X11R6/lib' and 'local/lib' with 'lib', no idea what's this about. |
323 |
X11_local_sub = re.compile(b"X11R6/lib|local/lib") |
324 |
# get rid of the '..' |
325 |
-pkgconfig_sub1 = re.compile(br"usr/lib[^/]*/pkgconfig/\.\./\.\.") |
326 |
-pkgconfig_sub2 = re.compile(br"(?P<usrlib>usr/lib[^/]*)/pkgconfig/\.\.") |
327 |
+pkgconfig_sub1 = re.compile(rb"usr/lib[^/]*/pkgconfig/\.\./\.\.") |
328 |
+pkgconfig_sub2 = re.compile(rb"(?P<usrlib>usr/lib[^/]*)/pkgconfig/\.\.") |
329 |
|
330 |
# detect flags that should go into inherited_linker_flags instead of dependency_libs |
331 |
flag_re = re.compile( |
332 |
@@ -135,7 +135,7 @@ def rewrite_lafile(contents): |
333 |
|
334 |
ladir = X11_local_sub.sub(b"lib", ladir) |
335 |
ladir = pkgconfig_sub1.sub(b"usr", ladir) |
336 |
- ladir = pkgconfig_sub2.sub(br"\g<usrlib>", ladir) |
337 |
+ ladir = pkgconfig_sub2.sub(rb"\g<usrlib>", ladir) |
338 |
|
339 |
if ladir not in libladir: |
340 |
libladir.append(ladir) |
341 |
|
342 |
diff --git a/repoman/lib/repoman/copyrights.py b/repoman/lib/repoman/copyrights.py |
343 |
index 3a6de76f8..199f5efbf 100644 |
344 |
--- a/repoman/lib/repoman/copyrights.py |
345 |
+++ b/repoman/lib/repoman/copyrights.py |
346 |
@@ -15,10 +15,10 @@ from portage import util |
347 |
|
348 |
|
349 |
_copyright_re1 = re.compile( |
350 |
- br"^(# Copyright \d\d\d\d)-\d\d\d\d( Gentoo (Foundation|Authors))\b" |
351 |
+ rb"^(# Copyright \d\d\d\d)-\d\d\d\d( Gentoo (Foundation|Authors))\b" |
352 |
) |
353 |
_copyright_re2 = re.compile( |
354 |
- br"^(# Copyright )(\d\d\d\d)( Gentoo (Foundation|Authors))\b" |
355 |
+ rb"^(# Copyright )(\d\d\d\d)( Gentoo (Foundation|Authors))\b" |
356 |
) |
357 |
|
358 |
|
359 |
@@ -58,7 +58,7 @@ def update_copyright_year(year, line): |
360 |
year = _unicode_encode(year) |
361 |
line = _unicode_encode(line) |
362 |
|
363 |
- line = _copyright_re1.sub(br"\1-" + year + b" Gentoo Authors", line) |
364 |
+ line = _copyright_re1.sub(rb"\1-" + year + b" Gentoo Authors", line) |
365 |
line = _copyright_re2.sub(_copyright_repl(year), line) |
366 |
if not is_bytes: |
367 |
line = _unicode_decode(line) |
368 |
|
369 |
diff --git a/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py b/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py |
370 |
index 4709f8336..fd0552ce7 100644 |
371 |
--- a/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py |
372 |
+++ b/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py |
373 |
@@ -36,15 +36,11 @@ class EbuildMetadata(ScanBase): |
374 |
ebuild = kwargs.get("ebuild").get() |
375 |
for pos, missing_var in enumerate(self.repo_settings.qadata.missingvars): |
376 |
if not ebuild.metadata.get(missing_var): |
377 |
- if ( |
378 |
- kwargs.get("catdir") |
379 |
- in ( |
380 |
- "acct-group", |
381 |
- "acct-user", |
382 |
- "virtual", |
383 |
- ) |
384 |
- and missing_var in ("HOMEPAGE", "LICENSE") |
385 |
- ): |
386 |
+ if kwargs.get("catdir") in ( |
387 |
+ "acct-group", |
388 |
+ "acct-user", |
389 |
+ "virtual", |
390 |
+ ) and missing_var in ("HOMEPAGE", "LICENSE"): |
391 |
continue |
392 |
if ebuild.live_ebuild and missing_var == "KEYWORDS": |
393 |
continue |
394 |
|
395 |
diff --git a/repoman/lib/repoman/modules/vcs/cvs/changes.py b/repoman/lib/repoman/modules/vcs/cvs/changes.py |
396 |
index 5f898dae0..be382f291 100644 |
397 |
--- a/repoman/lib/repoman/modules/vcs/cvs/changes.py |
398 |
+++ b/repoman/lib/repoman/modules/vcs/cvs/changes.py |
399 |
@@ -61,7 +61,7 @@ class Changes(ChangesBase): |
400 |
|
401 |
@param headers: file headers |
402 |
""" |
403 |
- cvs_header_re = re.compile(br"^#\s*\$Header.*\$$") |
404 |
+ cvs_header_re = re.compile(rb"^#\s*\$Header.*\$$") |
405 |
attic_str = b"/Attic/" |
406 |
attic_replace = b"/" |
407 |
for x in headers: |