Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] Eliminate basestring/long/_unicode py3 compat
Date: Wed, 15 Jul 2020 06:08:20
Message-Id: 20200715060751.3383552-1-mgorny@gentoo.org
1 Replace basestring and _unicode hacks with str, and long with int.
2
3 Signed-off-by: Michał Górny <mgorny@g.o>
4 ---
5 bin/egencache | 7 +--
6 lib/_emerge/BinpkgFetcher.py | 5 +-
7 lib/_emerge/BlockerCache.py | 19 ++-----
8 lib/_emerge/BlockerDB.py | 4 +-
9 lib/_emerge/FakeVartree.py | 11 +---
10 lib/_emerge/JobStatusDisplay.py | 7 +--
11 lib/_emerge/Package.py | 27 ++++-----
12 lib/_emerge/Scheduler.py | 5 +-
13 lib/_emerge/actions.py | 21 +++----
14 lib/_emerge/create_world_atom.py | 8 +--
15 lib/_emerge/depgraph.py | 15 ++---
16 lib/_emerge/main.py | 4 +-
17 lib/_emerge/resolver/output.py | 26 ++++-----
18 lib/_emerge/resolver/output_helpers.py | 6 +-
19 lib/_emerge/resolver/slot_collision.py | 6 +-
20 lib/portage/__init__.py | 12 ++--
21 lib/portage/_emirrordist/MirrorDistTask.py | 7 +--
22 lib/portage/_emirrordist/main.py | 9 +--
23 lib/portage/_sets/base.py | 7 +--
24 lib/portage/cache/flat_hash.py | 5 +-
25 lib/portage/cache/fs_template.py | 7 +--
26 lib/portage/cache/index/pkg_desc_index.py | 10 +---
27 lib/portage/cache/metadata.py | 8 +--
28 lib/portage/cache/sqlite.py | 7 +--
29 lib/portage/cache/template.py | 19 ++-----
30 lib/portage/cvstree.py | 3 -
31 lib/portage/dbapi/bintree.py | 55 ++++++++-----------
32 lib/portage/dbapi/porttree.py | 6 +-
33 lib/portage/dbapi/vartree.py | 33 +++++------
34 lib/portage/dep/__init__.py | 50 +++++++----------
35 lib/portage/eclass_cache.py | 10 +---
36 lib/portage/elog/__init__.py | 5 +-
37 lib/portage/elog/mod_echo.py | 5 +-
38 lib/portage/elog/mod_syslog.py | 5 +-
39 lib/portage/emaint/modules/binhost/binhost.py | 9 +--
40 lib/portage/emaint/modules/sync/sync.py | 9 +--
41 lib/portage/exception.py | 9 +--
42 lib/portage/getbinpkg.py | 5 +-
43 lib/portage/locks.py | 17 +++---
44 lib/portage/mail.py | 7 +--
45 lib/portage/manifest.py | 12 +---
46 lib/portage/package/ebuild/config.py | 11 ++--
47 lib/portage/package/ebuild/doebuild.py | 8 +--
48 .../package/ebuild/getmaskingstatus.py | 7 +--
49 lib/portage/process.py | 5 +-
50 lib/portage/proxy/lazyimport.py | 7 +--
51 lib/portage/repository/config.py | 5 +-
52 lib/portage/sync/getaddrinfo_validate.py | 6 +-
53 lib/portage/sync/modules/rsync/rsync.py | 7 +--
54 lib/portage/tests/dep/test_match_from_list.py | 7 +--
55 .../tests/resolver/ResolverPlayground.py | 9 +--
56 .../tests/unicode/test_string_format.py | 7 +--
57 lib/portage/update.py | 16 ++----
58 lib/portage/util/__init__.py | 8 +--
59 lib/portage/util/_dyn_libs/LinkageMapELF.py | 6 +-
60 .../util/_dyn_libs/PreservedLibsRegistry.py | 7 +--
61 lib/portage/util/_urlopen.py | 9 +--
62 lib/portage/util/changelog.py | 10 ++--
63 lib/portage/util/compression_probe.py | 4 +-
64 lib/portage/util/configparser.py | 9 +--
65 lib/portage/util/env_update.py | 7 +--
66 lib/portage/util/install_mask.py | 9 +--
67 lib/portage/versions.py | 17 ++----
68 lib/portage/xml/metadata.py | 12 ++--
69 repoman/lib/repoman/__init__.py | 7 +--
70 repoman/lib/repoman/main.py | 2 -
71 repoman/lib/repoman/metadata.py | 5 --
72 .../modules/scan/metadata/ebuild_metadata.py | 5 +-
73 repoman/lib/repoman/utilities.py | 3 -
74 69 files changed, 227 insertions(+), 490 deletions(-)
75
76 diff --git a/bin/egencache b/bin/egencache
77 index d172319f8..0847d73a7 100755
78 --- a/bin/egencache
79 +++ b/bin/egencache
80 @@ -75,9 +75,6 @@ else:
81 else:
82 from portage.xml.metadata import parse_metadata_use
83
84 -if sys.hexversion >= 0x3000000:
85 - # pylint: disable=W0622
86 - long = int
87
88 def parse_args(args):
89 usage = "egencache [options] <action> ... [atom] ..."
90 @@ -344,7 +341,7 @@ class GenCache(object):
91 max_mtime = ec_hash.mtime
92 if max_mtime == sc.mtime:
93 max_mtime += 1
94 - max_mtime = long(max_mtime)
95 + max_mtime = int(max_mtime)
96 try:
97 os.utime(ebuild_hash.location, (max_mtime, max_mtime))
98 except OSError as e:
99 @@ -709,7 +706,7 @@ class GenChangeLogs(object):
100 # This cp has not been added to the repo.
101 return
102
103 - lmod = long(lmod)
104 + lmod = int(lmod)
105
106 try:
107 cmod = os.stat('ChangeLog')[stat.ST_MTIME]
108 diff --git a/lib/_emerge/BinpkgFetcher.py b/lib/_emerge/BinpkgFetcher.py
109 index 2e5861cc1..c26c9bd6b 100644
110 --- a/lib/_emerge/BinpkgFetcher.py
111 +++ b/lib/_emerge/BinpkgFetcher.py
112 @@ -17,9 +17,6 @@ from portage import os
113 from portage.util._async.AsyncTaskFuture import AsyncTaskFuture
114 from portage.util._pty import _create_pty_or_pipe
115
116 -if sys.hexversion >= 0x3000000:
117 - long = int
118 -
119
120 class BinpkgFetcher(CompositeTask):
121
122 @@ -185,7 +182,7 @@ class _BinpkgFetcherProcess(SpawnProcess):
123 self.pkg.cpv)].get("_mtime_")
124 if remote_mtime is not None:
125 try:
126 - remote_mtime = long(remote_mtime)
127 + remote_mtime = int(remote_mtime)
128 except ValueError:
129 pass
130 else:
131 diff --git a/lib/_emerge/BlockerCache.py b/lib/_emerge/BlockerCache.py
132 index 53342d6d6..d0beb46ac 100644
133 --- a/lib/_emerge/BlockerCache.py
134 +++ b/lib/_emerge/BlockerCache.py
135 @@ -1,4 +1,4 @@
136 -# Copyright 1999-2013 Gentoo Foundation
137 +# Copyright 1999-2020 Gentoo Authors
138 # Distributed under the terms of the GNU General Public License v2
139
140 import errno
141 @@ -13,13 +13,6 @@ try:
142 except ImportError:
143 import pickle
144
145 -if sys.hexversion >= 0x3000000:
146 - basestring = str
147 - long = int
148 - _unicode = str
149 -else:
150 - _unicode = unicode
151 -
152 class BlockerCache(portage.cache.mappings.MutableMapping):
153 """This caches blockers of installed packages so that dep_check does not
154 have to be done for every single installed package on every invocation of
155 @@ -82,7 +75,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
156 # corruption is detected as soon as possible.
157 invalid_items = set()
158 for k, v in self._cache_data["blockers"].items():
159 - if not isinstance(k, basestring):
160 + if not isinstance(k, str):
161 invalid_items.add(k)
162 continue
163 try:
164 @@ -97,7 +90,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
165 invalid_items.add(k)
166 continue
167 counter, atoms = v
168 - if not isinstance(counter, (int, long)):
169 + if not isinstance(counter, int):
170 invalid_items.add(k)
171 continue
172 if not isinstance(atoms, (list, tuple)):
173 @@ -105,7 +98,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
174 continue
175 invalid_atom = False
176 for atom in atoms:
177 - if not isinstance(atom, basestring):
178 + if not isinstance(atom, str):
179 invalid_atom = True
180 break
181 if atom[:1] != "!" or \
182 @@ -164,8 +157,8 @@ class BlockerCache(portage.cache.mappings.MutableMapping):
183 @param blocker_data: An object with counter and atoms attributes.
184 @type blocker_data: BlockerData
185 """
186 - self._cache_data["blockers"][_unicode(cpv)] = (blocker_data.counter,
187 - tuple(_unicode(x) for x in blocker_data.atoms))
188 + self._cache_data["blockers"][str(cpv)] = (blocker_data.counter,
189 + tuple(str(x) for x in blocker_data.atoms))
190 self._modified.add(cpv)
191
192 def __iter__(self):
193 diff --git a/lib/_emerge/BlockerDB.py b/lib/_emerge/BlockerDB.py
194 index 5b3b01c37..6122e73a8 100644
195 --- a/lib/_emerge/BlockerDB.py
196 +++ b/lib/_emerge/BlockerDB.py
197 @@ -1,4 +1,4 @@
198 -# Copyright 1999-2018 Gentoo Foundation
199 +# Copyright 1999-2020 Gentoo Authors
200 # Distributed under the terms of the GNU General Public License v2
201
202 import sys
203 @@ -13,8 +13,6 @@ from _emerge.BlockerCache import BlockerCache
204 from _emerge.Package import Package
205 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
206
207 -if sys.hexversion >= 0x3000000:
208 - long = int
209
210 class BlockerDB(object):
211
212 diff --git a/lib/_emerge/FakeVartree.py b/lib/_emerge/FakeVartree.py
213 index 3f82e97e9..8a9a82d8e 100644
214 --- a/lib/_emerge/FakeVartree.py
215 +++ b/lib/_emerge/FakeVartree.py
216 @@ -1,4 +1,4 @@
217 -# Copyright 1999-2013 Gentoo Foundation
218 +# Copyright 1999-2020 Gentoo Authors
219 # Distributed under the terms of the GNU General Public License v2
220
221 from __future__ import unicode_literals
222 @@ -19,11 +19,6 @@ from portage.update import grab_updates, parse_updates, update_dbentries
223 from portage.versions import _pkg_str
224 from _emerge.resolver.DbapiProvidesIndex import PackageDbapiProvidesIndex
225
226 -if sys.hexversion >= 0x3000000:
227 - long = int
228 - _unicode = str
229 -else:
230 - _unicode = unicode
231
232 class FakeVardbGetPath(object):
233 """
234 @@ -167,7 +162,7 @@ class FakeVartree(vartree):
235 raise _DynamicDepsNotApplicable()
236 for k, v in built_slot_operator_atoms.items():
237 live_metadata[k] += (" " +
238 - " ".join(_unicode(atom) for atom in v))
239 + " ".join(str(atom) for atom in v))
240
241 self.dbapi.aux_update(pkg.cpv, live_metadata)
242 except _DynamicDepsNotApplicable:
243 @@ -249,7 +244,7 @@ class FakeVartree(vartree):
244 if pkg is not None:
245 counter, mtime = real_vardb.aux_get(cpv, validation_keys)
246 try:
247 - counter = long(counter)
248 + counter = int(counter)
249 except ValueError:
250 counter = 0
251
252 diff --git a/lib/_emerge/JobStatusDisplay.py b/lib/_emerge/JobStatusDisplay.py
253 index b8e142af9..df6a4b522 100644
254 --- a/lib/_emerge/JobStatusDisplay.py
255 +++ b/lib/_emerge/JobStatusDisplay.py
256 @@ -1,4 +1,4 @@
257 -# Copyright 1999-2015 Gentoo Foundation
258 +# Copyright 1999-2020 Gentoo Authors
259 # Distributed under the terms of the GNU General Public License v2
260
261 from __future__ import unicode_literals
262 @@ -16,9 +16,6 @@ from portage.output import xtermTitle
263
264 from _emerge.getloadavg import getloadavg
265
266 -if sys.hexversion >= 0x3000000:
267 - basestring = str
268 -
269 class JobStatusDisplay(object):
270
271 _bound_properties = ("curval", "failed", "running")
272 @@ -61,7 +58,7 @@ class JobStatusDisplay(object):
273 object.__setattr__(self, "_term_codes", term_codes)
274 encoding = sys.getdefaultencoding()
275 for k, v in self._term_codes.items():
276 - if not isinstance(v, basestring):
277 + if not isinstance(v, str):
278 self._term_codes[k] = v.decode(encoding, 'replace')
279
280 if self._isatty:
281 diff --git a/lib/_emerge/Package.py b/lib/_emerge/Package.py
282 index 3d7df2437..69064bd4e 100644
283 --- a/lib/_emerge/Package.py
284 +++ b/lib/_emerge/Package.py
285 @@ -1,4 +1,4 @@
286 -# Copyright 1999-2018 Gentoo Foundation
287 +# Copyright 1999-2020 Gentoo Authors
288 # Distributed under the terms of the GNU General Public License v2
289
290 from __future__ import unicode_literals
291 @@ -21,13 +21,6 @@ from portage.exception import InvalidData, InvalidDependString
292 from portage.localization import _
293 from _emerge.Task import Task
294
295 -if sys.hexversion >= 0x3000000:
296 - basestring = str
297 - long = int
298 - _unicode = str
299 -else:
300 - _unicode = unicode
301 -
302 class Package(Task):
303
304 __hash__ = Task.__hash__
305 @@ -222,7 +215,7 @@ class Package(Task):
306 else:
307 raise TypeError("root_config argument is required")
308
309 - elements = [type_name, root, _unicode(cpv), operation]
310 + elements = [type_name, root, str(cpv), operation]
311
312 # For installed (and binary) packages we don't care for the repo
313 # when it comes to hashing, because there can only be one cpv.
314 @@ -515,7 +508,7 @@ class Package(Task):
315 cpv_color = "PKG_NOMERGE"
316
317 build_id_str = ""
318 - if isinstance(self.cpv.build_id, long) and self.cpv.build_id > 0:
319 + if isinstance(self.cpv.build_id, int) and self.cpv.build_id > 0:
320 build_id_str = "-%s" % self.cpv.build_id
321
322 s = "(%s, %s" \
323 @@ -714,7 +707,7 @@ class Package(Task):
324 @return: True if all flags are valid USE values which may
325 be specified in USE dependencies, False otherwise.
326 """
327 - if isinstance(flags, basestring):
328 + if isinstance(flags, str):
329 flags = [flags]
330
331 for flag in flags:
332 @@ -727,7 +720,7 @@ class Package(Task):
333 """
334 @return: A list of flags missing from IUSE.
335 """
336 - if isinstance(flags, basestring):
337 + if isinstance(flags, str):
338 flags = [flags]
339 missing_iuse = []
340 for flag in flags:
341 @@ -873,14 +866,14 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase):
342 getattr(self, "_set_" + k.lower())(k, v)
343
344 def _set_inherited(self, k, v):
345 - if isinstance(v, basestring):
346 + if isinstance(v, str):
347 v = frozenset(v.split())
348 self._pkg.inherited = v
349
350 def _set_counter(self, k, v):
351 - if isinstance(v, basestring):
352 + if isinstance(v, str):
353 try:
354 - v = long(v.strip())
355 + v = int(v.strip())
356 except ValueError:
357 v = 0
358 self._pkg.counter = v
359 @@ -898,9 +891,9 @@ class _PackageMetadataWrapper(_PackageMetadataWrapperBase):
360 pass
361
362 def _set__mtime_(self, k, v):
363 - if isinstance(v, basestring):
364 + if isinstance(v, str):
365 try:
366 - v = long(v.strip())
367 + v = int(v.strip())
368 except ValueError:
369 v = 0
370 self._pkg.mtime = v
371 diff --git a/lib/_emerge/Scheduler.py b/lib/_emerge/Scheduler.py
372 index 6f4564000..79f04ba1d 100644
373 --- a/lib/_emerge/Scheduler.py
374 +++ b/lib/_emerge/Scheduler.py
375 @@ -63,9 +63,6 @@ from _emerge.PackageMerge import PackageMerge
376 from _emerge.PollScheduler import PollScheduler
377 from _emerge.SequentialTaskQueue import SequentialTaskQueue
378
379 -if sys.hexversion >= 0x3000000:
380 - basestring = str
381 -
382 # enums
383 FAILURE = 1
384
385 @@ -1141,7 +1138,7 @@ class Scheduler(PollScheduler):
386 if phase not in logentries:
387 continue
388 for msgtype, msgcontent in logentries[phase]:
389 - if isinstance(msgcontent, basestring):
390 + if isinstance(msgcontent, str):
391 msgcontent = [msgcontent]
392 for line in msgcontent:
393 printer.eerror(line.strip("\n"))
394 diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
395 index 392f98d4d..4a0843ff5 100644
396 --- a/lib/_emerge/actions.py
397 +++ b/lib/_emerge/actions.py
398 @@ -94,11 +94,6 @@ from _emerge.UnmergeDepPriority import UnmergeDepPriority
399 from _emerge.UseFlagDisplay import pkg_use_display
400 from _emerge.UserQuery import UserQuery
401
402 -if sys.hexversion >= 0x3000000:
403 - long = int
404 - _unicode = str
405 -else:
406 - _unicode = unicode
407
408 def action_build(emerge_config, trees=DeprecationWarning,
409 mtimedb=DeprecationWarning, myopts=DeprecationWarning,
410 @@ -854,7 +849,7 @@ def _calc_depclean(settings, trees, ldpath_mtimes,
411 protected_set.add("=" + pkg.cpv)
412 continue
413 except portage.exception.InvalidDependString as e:
414 - show_invalid_depstring_notice(pkg, _unicode(e))
415 + show_invalid_depstring_notice(pkg, str(e))
416 del e
417 protected_set.add("=" + pkg.cpv)
418 continue
419 @@ -907,7 +902,7 @@ def _calc_depclean(settings, trees, ldpath_mtimes,
420 protected_set.add("=" + pkg.cpv)
421 continue
422 except portage.exception.InvalidDependString as e:
423 - show_invalid_depstring_notice(pkg, _unicode(e))
424 + show_invalid_depstring_notice(pkg, str(e))
425 del e
426 protected_set.add("=" + pkg.cpv)
427 continue
428 @@ -924,7 +919,7 @@ def _calc_depclean(settings, trees, ldpath_mtimes,
429 if excluded_set.findAtomForPackage(pkg):
430 required_sets['__excluded__'].add("=" + pkg.cpv)
431 except portage.exception.InvalidDependString as e:
432 - show_invalid_depstring_notice(pkg, _unicode(e))
433 + show_invalid_depstring_notice(pkg, str(e))
434 del e
435 required_sets['__excluded__'].add("=" + pkg.cpv)
436
437 @@ -989,14 +984,14 @@ def _calc_depclean(settings, trees, ldpath_mtimes,
438 # visible in the unevaluated form of the atom. In this
439 # case, we must display the unevaluated atom, so that
440 # the user can see the conditional USE deps that would
441 - # otherwise be invisible. Use Atom(_unicode(atom)) to
442 + # otherwise be invisible. Use Atom(str(atom)) to
443 # test for a package where this case would matter. This
444 # is not necessarily the same as atom.without_use,
445 - # since Atom(_unicode(atom)) may still contain some
446 + # since Atom(str(atom)) may still contain some
447 # USE dependencies that remain after evaluation of
448 # conditionals.
449 if atom.package and atom != atom.unevaluated_atom and \
450 - vardb.match(Atom(_unicode(atom))):
451 + vardb.match(Atom(str(atom))):
452 msg.append(" %s (%s) pulled in by:" %
453 (atom.unevaluated_atom, atom))
454 else:
455 @@ -1068,7 +1063,7 @@ def _calc_depclean(settings, trees, ldpath_mtimes,
456 key=operator.attrgetter('package'))
457 parent_strs.append("%s requires %s" %
458 (getattr(parent, "cpv", parent),
459 - ", ".join(_unicode(atom) for atom in atoms)))
460 + ", ".join(str(atom) for atom in atoms)))
461 parent_strs.sort()
462 msg = []
463 msg.append(" %s pulled in by:\n" % (child_node.cpv,))
464 @@ -1541,7 +1536,7 @@ def action_deselect(settings, trees, opts, atoms):
465
466 writemsg_stdout(
467 ">>> %s %s from \"%s\" favorites file...\n" %
468 - (action_desc, colorize("INFORM", _unicode(atom)),
469 + (action_desc, colorize("INFORM", str(atom)),
470 filename), noiselevel=-1)
471
472 if '--ask' in opts:
473 diff --git a/lib/_emerge/create_world_atom.py b/lib/_emerge/create_world_atom.py
474 index a7f3e30bf..c4b8ccb69 100644
475 --- a/lib/_emerge/create_world_atom.py
476 +++ b/lib/_emerge/create_world_atom.py
477 @@ -6,10 +6,6 @@ import sys
478 from portage.dep import Atom, _repo_separator
479 from portage.exception import InvalidData
480
481 -if sys.hexversion >= 0x3000000:
482 - _unicode = str
483 -else:
484 - _unicode = unicode
485
486 def create_world_atom(pkg, args_set, root_config, before_install=False):
487 """Create a new atom for the world file if one does not exist. If the
488 @@ -43,7 +39,7 @@ def create_world_atom(pkg, args_set, root_config, before_install=False):
489 for cpv in portdb.match(Atom(cp)):
490 for repo in repos:
491 try:
492 - available_slots.add(portdb._pkg_str(_unicode(cpv), repo).slot)
493 + available_slots.add(portdb._pkg_str(str(cpv), repo).slot)
494 except (KeyError, InvalidData):
495 pass
496
497 @@ -98,7 +94,7 @@ def create_world_atom(pkg, args_set, root_config, before_install=False):
498 for repo in repos:
499 try:
500 matched_slots.add(
501 - portdb._pkg_str(_unicode(cpv), repo).slot)
502 + portdb._pkg_str(str(cpv), repo).slot)
503 except (KeyError, InvalidData):
504 pass
505
506 diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
507 index ec90e59df..42ab5eaad 100644
508 --- a/lib/_emerge/depgraph.py
509 +++ b/lib/_emerge/depgraph.py
510 @@ -88,13 +88,6 @@ from _emerge.resolver.slot_collision import slot_conflict_handler
511 from _emerge.resolver.circular_dependency import circular_dependency_handler
512 from _emerge.resolver.output import Display, format_unmatched_atom
513
514 -if sys.hexversion >= 0x3000000:
515 - basestring = str
516 - long = int
517 - _unicode = str
518 -else:
519 - _unicode = unicode
520 -
521 # Exposes a depgraph interface to dep_check.
522 _dep_check_graph_interface = collections.namedtuple('_dep_check_graph_interface',(
523 # Indicates a removal action, like depclean or prune.
524 @@ -311,7 +304,7 @@ class _rebuild_config(object):
525 ["BUILD_TIME"])
526 except KeyError:
527 continue
528 - if bin_build_time != _unicode(parent.build_time):
529 + if bin_build_time != str(parent.build_time):
530 # 2) Remote binary package is valid, and local package
531 # is not up to date. Force reinstall.
532 reinstall = True
533 @@ -5761,7 +5754,7 @@ class depgraph(object):
534 other_installed, other_keys in dbs:
535 try:
536 if portage.dep._match_slot(atom,
537 - other_db._pkg_str(_unicode(cpv), None)):
538 + other_db._pkg_str(str(cpv), None)):
539 slot_available = True
540 break
541 except (KeyError, InvalidData):
542 @@ -9263,7 +9256,7 @@ class depgraph(object):
543 filename = "world"
544 writemsg_stdout(
545 ">>> Recording %s in \"%s\" favorites file...\n" %
546 - (colorize("INFORM", _unicode(a)), filename), noiselevel=-1)
547 + (colorize("INFORM", str(a)), filename), noiselevel=-1)
548 world_set.update(all_added)
549
550 if world_locked:
551 @@ -9458,7 +9451,7 @@ class depgraph(object):
552 depgraph_sets = self._dynamic_config.sets[root_config.root]
553 args = []
554 for x in favorites:
555 - if not isinstance(x, basestring):
556 + if not isinstance(x, str):
557 continue
558 if x in ("system", "world"):
559 x = SETPREFIX + x
560 diff --git a/lib/_emerge/main.py b/lib/_emerge/main.py
561 index 95855ef2d..727e6d368 100644
562 --- a/lib/_emerge/main.py
563 +++ b/lib/_emerge/main.py
564 @@ -1,4 +1,4 @@
565 -# Copyright 1999-2019 Gentoo Authors
566 +# Copyright 1999-2020 Gentoo Authors
567 # Distributed under the terms of the GNU General Public License v2
568
569 from __future__ import print_function
570 @@ -22,8 +22,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
571 from portage import os
572 from portage.sync import _SUBMODULE_PATH_MAP
573
574 -if sys.hexversion >= 0x3000000:
575 - long = int
576
577 options=[
578 "--alphabetical",
579 diff --git a/lib/_emerge/resolver/output.py b/lib/_emerge/resolver/output.py
580 index ed88cc51f..f638d3557 100644
581 --- a/lib/_emerge/resolver/output.py
582 +++ b/lib/_emerge/resolver/output.py
583 @@ -1,4 +1,4 @@
584 -# Copyright 2010-2019 Gentoo Authors
585 +# Copyright 2010-2020 Gentoo Authors
586 # Distributed under the terms of the GNU General Public License v2
587
588 """Resolver output display operation.
589 @@ -34,12 +34,6 @@ from _emerge.resolver.output_helpers import ( _DisplayConfig, _tree_display,
590 _PackageCounters, _create_use_string, _calc_changelog, PkgInfo)
591 from _emerge.show_invalid_depstring_notice import show_invalid_depstring_notice
592
593 -if sys.hexversion >= 0x3000000:
594 - basestring = str
595 - _unicode = str
596 -else:
597 - _unicode = unicode
598 -
599 class Display(object):
600 """Formats and outputs the depgrah supplied it for merge/re-merge, etc.
601
602 @@ -88,19 +82,19 @@ class Display(object):
603 addl = "%s " % (colorize(self.blocker_style, "B"),)
604 addl += self.empty_space_in_brackets()
605 self.resolved = dep_expand(
606 - _unicode(blocker.atom).lstrip("!"), mydb=self.vardb,
607 + str(blocker.atom).lstrip("!"), mydb=self.vardb,
608 settings=self.pkgsettings
609 )
610 if self.conf.columns and self.conf.quiet:
611 - addl += " " + colorize(self.blocker_style, _unicode(self.resolved))
612 + addl += " " + colorize(self.blocker_style, str(self.resolved))
613 else:
614 addl = "[%s %s] %s%s" % \
615 (colorize(self.blocker_style, "blocks"),
616 addl, self.indent,
617 - colorize(self.blocker_style, _unicode(self.resolved))
618 + colorize(self.blocker_style, str(self.resolved))
619 )
620 block_parents = self.conf.blocker_parents.parent_nodes(blocker)
621 - block_parents = set(_unicode(pnode.cpv) for pnode in block_parents)
622 + block_parents = set(str(pnode.cpv) for pnode in block_parents)
623 block_parents = ", ".join(block_parents)
624 if blocker.atom.blocker.overlap.forbid:
625 blocking_desc = "hard blocking"
626 @@ -109,7 +103,7 @@ class Display(object):
627 if self.resolved != blocker.atom:
628 addl += colorize(self.blocker_style,
629 " (\"%s\" is %s %s)" %
630 - (_unicode(blocker.atom).lstrip("!"),
631 + (str(blocker.atom).lstrip("!"),
632 blocking_desc, block_parents))
633 else:
634 addl += colorize(self.blocker_style,
635 @@ -316,7 +310,7 @@ class Display(object):
636 depstr, = db.aux_get(pkg.cpv,
637 ["SRC_URI"], myrepo=pkg.repo)
638 show_invalid_depstring_notice(
639 - pkg, _unicode(e))
640 + pkg, str(e))
641 raise
642 except SignatureException:
643 # missing/invalid binary package SIZE signature
644 @@ -447,7 +441,7 @@ class Display(object):
645 ver_str = self._append_slot(ver_str, pkg, pkg_info)
646 ver_str = self._append_repository(ver_str, pkg, pkg_info)
647 if self.conf.quiet:
648 - myprint = _unicode(pkg_info.attr_display) + " " + self.indent + \
649 + myprint = str(pkg_info.attr_display) + " " + self.indent + \
650 self.pkgprint(pkg_info.cp, pkg_info)
651 myprint = myprint+darkblue(" "+ver_str)+" "
652 myprint = myprint+pkg_info.oldbest
653 @@ -486,7 +480,7 @@ class Display(object):
654 ver_str = self._append_slot(ver_str, pkg, pkg_info)
655 ver_str = self._append_repository(ver_str, pkg, pkg_info)
656 if self.conf.quiet:
657 - myprint = _unicode(pkg_info.attr_display) + " " + self.indent + \
658 + myprint = str(pkg_info.attr_display) + " " + self.indent + \
659 self.pkgprint(pkg_info.cp, pkg_info)
660 myprint = myprint+" "+green(ver_str)+" "
661 myprint = myprint+pkg_info.oldbest
662 @@ -543,7 +537,7 @@ class Display(object):
663 @param show_repos: bool.
664 """
665 for msg in self.print_msg:
666 - if isinstance(msg, basestring):
667 + if isinstance(msg, str):
668 writemsg_stdout("%s\n" % (msg,), noiselevel=-1)
669 continue
670 myprint, self.verboseadd, repoadd = msg
671 diff --git a/lib/_emerge/resolver/output_helpers.py b/lib/_emerge/resolver/output_helpers.py
672 index b83717e93..8939663be 100644
673 --- a/lib/_emerge/resolver/output_helpers.py
674 +++ b/lib/_emerge/resolver/output_helpers.py
675 @@ -1,4 +1,4 @@
676 -# Copyright 2010-2014 Gentoo Foundation
677 +# Copyright 2010-2020 Gentoo Authors
678 # Distributed under the terms of the GNU General Public License v2
679
680 """Contains private support functions for the Display class
681 @@ -30,10 +30,6 @@ from _emerge.Blocker import Blocker
682 from _emerge.Package import Package
683
684
685 -if sys.hexversion >= 0x3000000:
686 - basestring = str
687 -
688 -
689 class _RepoDisplay(object):
690 def __init__(self, roots):
691 self._shown_repos = {}
692 diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py
693 index 682a3a0a5..9aa80e923 100644
694 --- a/lib/_emerge/resolver/slot_collision.py
695 +++ b/lib/_emerge/resolver/slot_collision.py
696 @@ -1,4 +1,4 @@
697 -# Copyright 2010-2014 Gentoo Foundation
698 +# Copyright 2010-2020 Gentoo Authors
699 # Distributed under the terms of the GNU General Public License v2
700
701 from __future__ import print_function, unicode_literals
702 @@ -16,8 +16,6 @@ from portage._sets.base import InternalPackageSet
703 from portage.util import writemsg
704 from portage.versions import cpv_getversion, vercmp
705
706 -if sys.hexversion >= 0x3000000:
707 - basestring = str
708
709 class slot_conflict_handler(object):
710 """This class keeps track of all slot conflicts and provides
711 @@ -1125,7 +1123,7 @@ class _solution_candidate_generator(object):
712 def __init__(self, value=None):
713 self.value = value
714 def __eq__(self, other):
715 - if isinstance(other, basestring):
716 + if isinstance(other, str):
717 return self.value == other
718 else:
719 return self.value == other.value
720 diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py
721 index 60dbea693..c7ba014fb 100644
722 --- a/lib/portage/__init__.py
723 +++ b/lib/portage/__init__.py
724 @@ -1,4 +1,4 @@
725 -# Copyright 1998-2019 Gentoo Authors
726 +# Copyright 1998-2020 Gentoo Authors
727 # Distributed under the terms of the GNU General Public License v2
728
729 from __future__ import unicode_literals
730 @@ -135,10 +135,6 @@ except ImportError as e:
731 sys.stderr.write(" "+str(e)+"\n\n")
732 raise
733
734 -if sys.hexversion >= 0x3000000:
735 - # pylint: disable=W0622
736 - basestring = str
737 - long = int
738
739 # We use utf_8 encoding everywhere. Previously, we used
740 # sys.getfilesystemencoding() for the 'merge' encoding, but that had
741 @@ -478,7 +474,7 @@ def _eapi_is_deprecated(eapi):
742 return eapi in _deprecated_eapis
743
744 def eapi_is_supported(eapi):
745 - if not isinstance(eapi, basestring):
746 + if not isinstance(eapi, str):
747 # Only call str() when necessary since with python2 it
748 # can trigger UnicodeEncodeError if EAPI is corrupt.
749 eapi = str(eapi)
750 @@ -619,10 +615,10 @@ if VERSION == 'HEAD':
751 head_timestamp = None
752 if len(output_lines) > 3:
753 try:
754 - head_timestamp = long(output_lines[3])
755 + head_timestamp = int(output_lines[3])
756 except ValueError:
757 pass
758 - timestamp = long(time.time())
759 + timestamp = int(time.time())
760 if head_timestamp is not None and timestamp > head_timestamp:
761 timestamp = timestamp - head_timestamp
762 if not patchlevel:
763 diff --git a/lib/portage/_emirrordist/MirrorDistTask.py b/lib/portage/_emirrordist/MirrorDistTask.py
764 index 8eb3081c6..c0cf30112 100644
765 --- a/lib/portage/_emirrordist/MirrorDistTask.py
766 +++ b/lib/portage/_emirrordist/MirrorDistTask.py
767 @@ -1,4 +1,4 @@
768 -# Copyright 2013-2018 Gentoo Foundation
769 +# Copyright 2013-2020 Gentoo Authors
770 # Distributed under the terms of the GNU General Public License v2
771
772 import errno
773 @@ -18,9 +18,6 @@ from _emerge.CompositeTask import CompositeTask
774 from .FetchIterator import FetchIterator
775 from .DeletionIterator import DeletionIterator
776
777 -if sys.hexversion >= 0x3000000:
778 - # pylint: disable=W0622
779 - long = int
780
781 class MirrorDistTask(CompositeTask):
782
783 @@ -111,7 +108,7 @@ class MirrorDistTask(CompositeTask):
784 recycle_db[filename] = (st.st_size, start_time)
785 else:
786 r_size, r_time = value
787 - if long(r_size) != st.st_size:
788 + if int(r_size) != st.st_size:
789 recycle_db[filename] = (st.st_size, start_time)
790 elif r_time + r_deletion_delay < start_time:
791 if self._config.options.dry_run:
792 diff --git a/lib/portage/_emirrordist/main.py b/lib/portage/_emirrordist/main.py
793 index ce0c2929f..23f6468c5 100644
794 --- a/lib/portage/_emirrordist/main.py
795 +++ b/lib/portage/_emirrordist/main.py
796 @@ -1,4 +1,4 @@
797 -# Copyright 2013-2015 Gentoo Foundation
798 +# Copyright 2013-2020 Gentoo Authors
799 # Distributed under the terms of the GNU General Public License v2
800
801 import argparse
802 @@ -14,9 +14,6 @@ from portage.util._eventloop.global_event_loop import global_event_loop
803 from .Config import Config
804 from .MirrorDistTask import MirrorDistTask
805
806 -if sys.hexversion >= 0x3000000:
807 - # pylint: disable=W0622
808 - long = int
809
810 seconds_per_day = 24 * 60 * 60
811
812 @@ -318,7 +315,7 @@ def emirrordist_main(args):
813 parser.error("--scheduled-deletion-log requires --deletion-db")
814
815 if options.deletion_delay is not None:
816 - options.deletion_delay = long(options.deletion_delay)
817 + options.deletion_delay = int(options.deletion_delay)
818 if options.deletion_db is None:
819 parser.error("--deletion-delay requires --deletion-db")
820
821 @@ -391,7 +388,7 @@ def emirrordist_main(args):
822
823 if options.recycle_deletion_delay is not None:
824 options.recycle_deletion_delay = \
825 - long(options.recycle_deletion_delay)
826 + int(options.recycle_deletion_delay)
827
828 if options.fetch_log_dir is not None:
829 options.fetch_log_dir = normalize_path(
830 diff --git a/lib/portage/_sets/base.py b/lib/portage/_sets/base.py
831 index aba295602..4d0a42179 100644
832 --- a/lib/portage/_sets/base.py
833 +++ b/lib/portage/_sets/base.py
834 @@ -1,4 +1,4 @@
835 -# Copyright 2007-2018 Gentoo Foundation
836 +# Copyright 2007-2020 Gentoo Authors
837 # Distributed under the terms of the GNU General Public License v2
838
839 import sys
840 @@ -6,9 +6,6 @@ from portage.dep import Atom, ExtendedAtomDict, best_match_to_list, match_from_l
841 from portage.exception import InvalidAtom
842 from portage.versions import cpv_getkey
843
844 -if sys.hexversion >= 0x3000000:
845 - # pylint: disable=W0622
846 - basestring = str
847
848 OPERATIONS = ["merge", "unmerge"]
849
850 @@ -74,7 +71,7 @@ class PackageSet(object):
851 self._nonatoms.clear()
852 for a in atoms:
853 if not isinstance(a, Atom):
854 - if isinstance(a, basestring):
855 + if isinstance(a, str):
856 a = a.strip()
857 if not a:
858 continue
859 diff --git a/lib/portage/cache/flat_hash.py b/lib/portage/cache/flat_hash.py
860 index 451ea9e51..4d517143d 100644
861 --- a/lib/portage/cache/flat_hash.py
862 +++ b/lib/portage/cache/flat_hash.py
863 @@ -1,4 +1,4 @@
864 -# Copyright 2005-2019 Gentoo Authors
865 +# Copyright 2005-2020 Gentoo Authors
866 # Distributed under the terms of the GNU General Public License v2
867 # Author(s): Brian Harring (ferringb@g.o)
868
869 @@ -18,9 +18,6 @@ from portage import _unicode_encode
870 from portage.exception import InvalidData
871 from portage.versions import _pkg_str
872
873 -if sys.hexversion >= 0x3000000:
874 - # pylint: disable=W0622
875 - long = int
876
877 class database(fs_template.FsBased):
878
879 diff --git a/lib/portage/cache/fs_template.py b/lib/portage/cache/fs_template.py
880 index e3c3c12c2..7d6ff2bbe 100644
881 --- a/lib/portage/cache/fs_template.py
882 +++ b/lib/portage/cache/fs_template.py
883 @@ -1,4 +1,4 @@
884 -# Copyright 2005-2014 Gentoo Foundation
885 +# Copyright 2005-2020 Gentoo Authors
886 # Distributed under the terms of the GNU General Public License v2
887 # Author(s): Brian Harring (ferringb@g.o)
888
889 @@ -14,9 +14,6 @@ lazyimport(globals(),
890 )
891 del lazyimport
892
893 -if sys.hexversion >= 0x3000000:
894 - # pylint: disable=W0622
895 - long = int
896
897 class FsBased(template.database):
898 """template wrapping fs needed options, and providing _ensure_access as a way to
899 @@ -44,7 +41,7 @@ class FsBased(template.database):
900 try:
901 apply_permissions(path, gid=self._gid, mode=self._perms)
902 if mtime != -1:
903 - mtime=long(mtime)
904 + mtime=int(mtime)
905 os.utime(path, (mtime, mtime))
906 except (PortageException, EnvironmentError):
907 return False
908 diff --git a/lib/portage/cache/index/pkg_desc_index.py b/lib/portage/cache/index/pkg_desc_index.py
909 index dbcbb8313..fa9287fe6 100644
910 --- a/lib/portage/cache/index/pkg_desc_index.py
911 +++ b/lib/portage/cache/index/pkg_desc_index.py
912 @@ -1,4 +1,4 @@
913 -# Copyright 2014 Gentoo Foundation
914 +# Copyright 2014-2020 Gentoo Authors
915 # Distributed under the terms of the GNU General Public License v2
916
917 from __future__ import unicode_literals
918 @@ -8,15 +8,11 @@ import sys
919
920 from portage.versions import _pkg_str
921
922 -if sys.hexversion >= 0x3000000:
923 - _unicode = str
924 -else:
925 - _unicode = unicode
926
927 pkg_desc_index_node = collections.namedtuple("pkg_desc_index_node",
928 ["cp", "cpv_list", "desc"])
929
930 -class pkg_node(_unicode):
931 +class pkg_node(str):
932 """
933 A minimal package node class. For performance reasons, inputs
934 are not validated.
935 @@ -29,7 +25,7 @@ class pkg_node(_unicode):
936 self.__dict__['build_time'] = None
937
938 def __new__(cls, cp, version, repo=None):
939 - return _unicode.__new__(cls, cp + "-" + version)
940 + return str.__new__(cls, cp + "-" + version)
941
942 def __setattr__(self, name, value):
943 raise AttributeError("pkg_node instances are immutable",
944 diff --git a/lib/portage/cache/metadata.py b/lib/portage/cache/metadata.py
945 index 45a057d08..b3daec274 100644
946 --- a/lib/portage/cache/metadata.py
947 +++ b/lib/portage/cache/metadata.py
948 @@ -1,4 +1,4 @@
949 -# Copyright 2005-2018 Gentoo Foundation
950 +# Copyright 2005-2020 Gentoo Authors
951 # Author(s): Brian Harring (ferringb@g.o)
952 # License: GPL2
953
954 @@ -15,10 +15,6 @@ import portage.eclass_cache
955 from portage.cache.template import reconstruct_eclasses
956 from portage.cache.mappings import ProtectedDict
957
958 -if sys.hexversion >= 0x3000000:
959 - # pylint: disable=W0622
960 - basestring = str
961 - long = int
962
963 # this is the old cache format, flat_list. count maintained here.
964 magic_line_count = 22
965 @@ -76,7 +72,7 @@ class database(flat_hash.database):
966 raise cache_errors.CacheCorruption(cpv, e)
967 else:
968 d["_eclasses_"] = {}
969 - elif isinstance(d["_eclasses_"], basestring):
970 + elif isinstance(d["_eclasses_"], str):
971 # We skip this if flat_hash.database._parse_data() was called above
972 # because it calls reconstruct_eclasses() internally.
973 d["_eclasses_"] = reconstruct_eclasses(None, d["_eclasses_"])
974 diff --git a/lib/portage/cache/sqlite.py b/lib/portage/cache/sqlite.py
975 index 69150f679..5be5d6dd0 100644
976 --- a/lib/portage/cache/sqlite.py
977 +++ b/lib/portage/cache/sqlite.py
978 @@ -1,4 +1,4 @@
979 -# Copyright 1999-2014 Gentoo Foundation
980 +# Copyright 1999-2020 Gentoo Authors
981 # Distributed under the terms of the GNU General Public License v2
982
983 from __future__ import division, unicode_literals
984 @@ -12,9 +12,6 @@ from portage import _unicode_decode
985 from portage.util import writemsg
986 from portage.localization import _
987
988 -if sys.hexversion >= 0x3000000:
989 - # pylint: disable=W0622
990 - basestring = str
991
992 class database(fs_template.FsBased):
993
994 @@ -64,7 +61,7 @@ class database(fs_template.FsBased):
995
996 def _db_escape_string(self, s):
997 """meta escaping, returns quoted string for use in sql statements"""
998 - if not isinstance(s, basestring):
999 + if not isinstance(s, str):
1000 # Avoid potential UnicodeEncodeError in python-2.x by
1001 # only calling str() when it's absolutely necessary.
1002 s = str(s)
1003 diff --git a/lib/portage/cache/template.py b/lib/portage/cache/template.py
1004 index 6b4878347..d7fff3e32 100644
1005 --- a/lib/portage/cache/template.py
1006 +++ b/lib/portage/cache/template.py
1007 @@ -1,4 +1,4 @@
1008 -# Copyright 2005-2014 Gentoo Foundation
1009 +# Copyright 2005-2020 Gentoo Authors
1010 # Distributed under the terms of the GNU General Public License v2
1011 # Author(s): Brian Harring (ferringb@g.o)
1012
1013 @@ -9,13 +9,6 @@ import sys
1014 import warnings
1015 import operator
1016
1017 -if sys.hexversion >= 0x3000000:
1018 - # pylint: disable=W0622
1019 - _unicode = str
1020 - basestring = str
1021 - long = int
1022 -else:
1023 - _unicode = unicode
1024
1025 class database(object):
1026 # this is for metadata/cache transfer.
1027 @@ -94,10 +87,10 @@ class database(object):
1028 d.pop('_mtime_', None)
1029 else:
1030 try:
1031 - mtime = long(mtime)
1032 + mtime = int(mtime)
1033 except ValueError:
1034 raise cache_errors.CacheCorruption(cpv,
1035 - '_mtime_ conversion to long failed: %s' % (mtime,))
1036 + '_mtime_ conversion to int failed: %s' % (mtime,))
1037 d['_mtime_'] = mtime
1038 return d
1039
1040 @@ -278,7 +271,7 @@ class database(object):
1041 for key,match in match_dict.items():
1042 # XXX this sucks.
1043 try:
1044 - if isinstance(match, basestring):
1045 + if isinstance(match, str):
1046 restricts[key] = re.compile(match).match
1047 else:
1048 restricts[key] = re.compile(match[0],match[1]).match
1049 @@ -306,7 +299,7 @@ _keysorter = operator.itemgetter(0)
1050 def serialize_eclasses(eclass_dict, chf_type='mtime', paths=True):
1051 """takes a dict, returns a string representing said dict"""
1052 """The "new format", which causes older versions of <portage-2.1.2 to
1053 - traceback with a ValueError due to failed long() conversion. This format
1054 + traceback with a ValueError due to failed int() conversion. This format
1055 isn't currently written, but the the capability to read it is already built
1056 in.
1057 return "\t".join(["%s\t%s" % (k, str(v)) \
1058 @@ -335,7 +328,7 @@ def _md5_deserializer(md5):
1059
1060 _chf_deserializers = {
1061 'md5': _md5_deserializer,
1062 - 'mtime': long,
1063 + 'mtime': int,
1064 }
1065
1066
1067 diff --git a/lib/portage/cvstree.py b/lib/portage/cvstree.py
1068 index 87bbed8bb..808939d61 100644
1069 --- a/lib/portage/cvstree.py
1070 +++ b/lib/portage/cvstree.py
1071 @@ -14,9 +14,6 @@ from portage import os
1072 from portage import _encodings
1073 from portage import _unicode_encode
1074
1075 -if sys.hexversion >= 0x3000000:
1076 - # pylint: disable=W0622
1077 - long = int
1078
1079 # [D]/Name/Version/Date/Flags/Tags
1080
1081 diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py
1082 index 311c9a78a..ab8e65b62 100644
1083 --- a/lib/portage/dbapi/bintree.py
1084 +++ b/lib/portage/dbapi/bintree.py
1085 @@ -1,4 +1,4 @@
1086 -# Copyright 1998-2019 Gentoo Authors
1087 +# Copyright 1998-2020 Gentoo Authors
1088 # Distributed under the terms of the GNU General Public License v2
1089
1090 from __future__ import unicode_literals
1091 @@ -59,13 +59,6 @@ try:
1092 except ImportError:
1093 from urlparse import urlparse
1094
1095 -if sys.hexversion >= 0x3000000:
1096 - # pylint: disable=W0622
1097 - _unicode = str
1098 - basestring = str
1099 - long = int
1100 -else:
1101 - _unicode = unicode
1102
1103 class UseCachedCopyOfRemoteIndex(Exception):
1104 # If the local copy is recent enough
1105 @@ -166,9 +159,9 @@ class bindbapi(fakedbapi):
1106 metadata_bytes = portage.xpak.tbz2(tbz2_path).get_data()
1107 def getitem(k):
1108 if k == "_mtime_":
1109 - return _unicode(st[stat.ST_MTIME])
1110 + return str(st[stat.ST_MTIME])
1111 elif k == "SIZE":
1112 - return _unicode(st.st_size)
1113 + return str(st.st_size)
1114 v = metadata_bytes.get(_unicode_encode(k,
1115 encoding=_encodings['repo.content'],
1116 errors='backslashreplace'))
1117 @@ -470,7 +463,7 @@ class binarytree(object):
1118 # sanity check
1119 for atom in (origcp, newcp):
1120 if not isjustname(atom):
1121 - raise InvalidPackageName(_unicode(atom))
1122 + raise InvalidPackageName(str(atom))
1123 mynewcat = catsplit(newcp)[0]
1124 origmatches=self.dbapi.cp_list(origcp)
1125 moves = 0
1126 @@ -494,7 +487,7 @@ class binarytree(object):
1127 if not isvalidatom(newcp, eapi=mycpv.eapi):
1128 continue
1129
1130 - mynewcpv = mycpv.replace(mycpv_cp, _unicode(newcp), 1)
1131 + mynewcpv = mycpv.replace(mycpv_cp, str(newcp), 1)
1132 myoldpkg = catsplit(mycpv)[1]
1133 mynewpkg = catsplit(mynewcpv)[1]
1134
1135 @@ -727,12 +720,12 @@ class binarytree(object):
1136 match = None
1137 for d in possibilities:
1138 try:
1139 - if long(d["_mtime_"]) != s[stat.ST_MTIME]:
1140 + if int(d["_mtime_"]) != s[stat.ST_MTIME]:
1141 continue
1142 except (KeyError, ValueError):
1143 continue
1144 try:
1145 - if long(d["SIZE"]) != long(s.st_size):
1146 + if int(d["SIZE"]) != int(s.st_size):
1147 continue
1148 except (KeyError, ValueError):
1149 continue
1150 @@ -819,7 +812,7 @@ class binarytree(object):
1151
1152 if pkg_metadata.get("BUILD_ID"):
1153 try:
1154 - build_id = long(pkg_metadata["BUILD_ID"])
1155 + build_id = int(pkg_metadata["BUILD_ID"])
1156 except ValueError:
1157 writemsg(_("!!! Binary package has "
1158 "invalid BUILD_ID: '%s'\n") %
1159 @@ -849,8 +842,8 @@ class binarytree(object):
1160 noiselevel=-1)
1161 continue
1162 if build_id is not None:
1163 - pkg_metadata["BUILD_ID"] = _unicode(build_id)
1164 - pkg_metadata["SIZE"] = _unicode(s.st_size)
1165 + pkg_metadata["BUILD_ID"] = str(build_id)
1166 + pkg_metadata["SIZE"] = str(s.st_size)
1167 # Discard items used only for validation above.
1168 pkg_metadata.pop("CATEGORY")
1169 pkg_metadata.pop("PF")
1170 @@ -864,13 +857,13 @@ class binarytree(object):
1171 pkgindex._pkg_slot_dict())
1172 if d:
1173 try:
1174 - if long(d["_mtime_"]) != s[stat.ST_MTIME]:
1175 + if int(d["_mtime_"]) != s[stat.ST_MTIME]:
1176 d.clear()
1177 except (KeyError, ValueError):
1178 d.clear()
1179 if d:
1180 try:
1181 - if long(d["SIZE"]) != long(s.st_size):
1182 + if int(d["SIZE"]) != int(s.st_size):
1183 d.clear()
1184 except (KeyError, ValueError):
1185 d.clear()
1186 @@ -1096,12 +1089,12 @@ class binarytree(object):
1187 writemsg(_("\n\n!!! Error fetching binhost package" \
1188 " info from '%s'\n") % _hide_url_passwd(base_url))
1189 # With Python 2, the EnvironmentError message may
1190 - # contain bytes or unicode, so use _unicode to ensure
1191 + # contain bytes or unicode, so use str to ensure
1192 # safety with all locales (bug #532784).
1193 try:
1194 - error_msg = _unicode(e)
1195 + error_msg = str(e)
1196 except UnicodeDecodeError as uerror:
1197 - error_msg = _unicode(uerror.object,
1198 + error_msg = str(uerror.object,
1199 encoding='utf_8', errors='replace')
1200 writemsg("!!! %s\n\n" % error_msg)
1201 del e
1202 @@ -1244,7 +1237,7 @@ class binarytree(object):
1203 # attributes, so that we can later distinguish that it
1204 # is identical to its remote counterpart.
1205 build_id = self._parse_build_id(basename)
1206 - metadata["BUILD_ID"] = _unicode(build_id)
1207 + metadata["BUILD_ID"] = str(build_id)
1208 cpv = _pkg_str(cpv, metadata=metadata,
1209 settings=self.settings, db=self.dbapi)
1210 binpkg = portage.xpak.tbz2(full_path)
1211 @@ -1296,9 +1289,9 @@ class binarytree(object):
1212 binary_metadata = portage.xpak.tbz2(filename).get_data()
1213 for k in keys:
1214 if k == "_mtime_":
1215 - metadata[k] = _unicode(st[stat.ST_MTIME])
1216 + metadata[k] = str(st[stat.ST_MTIME])
1217 elif k == "SIZE":
1218 - metadata[k] = _unicode(st.st_size)
1219 + metadata[k] = str(st.st_size)
1220 else:
1221 v = binary_metadata.get(_unicode_encode(k))
1222 if v is None:
1223 @@ -1356,7 +1349,7 @@ class binarytree(object):
1224 contents = codecs.getwriter(_encodings['repo.content'])(io.BytesIO())
1225 pkgindex.write(contents)
1226 contents = contents.getvalue()
1227 - atime = mtime = long(pkgindex.header["TIMESTAMP"])
1228 + atime = mtime = int(pkgindex.header["TIMESTAMP"])
1229 output_files = [(atomic_ofstream(self._pkgindex_file, mode="wb"),
1230 self._pkgindex_file, None)]
1231
1232 @@ -1391,8 +1384,8 @@ class binarytree(object):
1233
1234 d["CPV"] = cpv
1235 st = os.lstat(pkg_path)
1236 - d["_mtime_"] = _unicode(st[stat.ST_MTIME])
1237 - d["SIZE"] = _unicode(st.st_size)
1238 + d["_mtime_"] = str(st[stat.ST_MTIME])
1239 + d["SIZE"] = str(st.st_size)
1240
1241 rel_path = pkg_path[len(self.pkgdir)+1:]
1242 # record location if it's non-default
1243 @@ -1471,7 +1464,7 @@ class binarytree(object):
1244 """
1245 if not (self.settings.profile_path and
1246 "IUSE_IMPLICIT" in self.settings):
1247 - header.setdefault("VERSION", _unicode(self._pkgindex_version))
1248 + header.setdefault("VERSION", str(self._pkgindex_version))
1249 return
1250
1251 portdir = normalize_path(os.path.realpath(self.settings["PORTDIR"]))
1252 @@ -1482,7 +1475,7 @@ class binarytree(object):
1253 if profile_path.startswith(profiles_base):
1254 profile_path = profile_path[len(profiles_base):]
1255 header["PROFILE"] = profile_path
1256 - header["VERSION"] = _unicode(self._pkgindex_version)
1257 + header["VERSION"] = str(self._pkgindex_version)
1258 base_uri = self.settings.get("PORTAGE_BINHOST_HEADER_URI")
1259 if base_uri:
1260 header["URI"] = base_uri
1261 @@ -1657,7 +1650,7 @@ class binarytree(object):
1262 if hyphen != -1:
1263 build_id = filename[hyphen+1:-suffixlen]
1264 try:
1265 - build_id = long(build_id)
1266 + build_id = int(build_id)
1267 except ValueError:
1268 pass
1269 return build_id
1270 diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py
1271 index ed992d1e2..e1ec2a3f1 100644
1272 --- a/lib/portage/dbapi/porttree.py
1273 +++ b/lib/portage/dbapi/porttree.py
1274 @@ -55,10 +55,6 @@ try:
1275 except ImportError:
1276 from urlparse import urlparse
1277
1278 -if sys.hexversion >= 0x3000000:
1279 - # pylint: disable=W0622
1280 - basestring = str
1281 - long = int
1282
1283 def close_portdbapi_caches():
1284 # The python interpreter does _not_ guarantee that destructors are
1285 @@ -999,7 +995,7 @@ class portdbapi(dbapi):
1286 # stable sort by version produces results ordered by
1287 # (pkg.version, repo.priority).
1288 if mytree is not None:
1289 - if isinstance(mytree, basestring):
1290 + if isinstance(mytree, str):
1291 repos = [self.repositories.get_repo_for_location(mytree)]
1292 else:
1293 # assume it's iterable
1294 diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
1295 index 80ca0ab80..9e173449e 100644
1296 --- a/lib/portage/dbapi/vartree.py
1297 +++ b/lib/portage/dbapi/vartree.py
1298 @@ -107,13 +107,6 @@ try:
1299 except ImportError:
1300 import pickle
1301
1302 -if sys.hexversion >= 0x3000000:
1303 - # pylint: disable=W0622
1304 - basestring = str
1305 - long = int
1306 - _unicode = str
1307 -else:
1308 - _unicode = unicode
1309
1310 class vardbapi(dbapi):
1311
1312 @@ -351,7 +344,7 @@ class vardbapi(dbapi):
1313 def cpv_counter(self, mycpv):
1314 "This method will grab the COUNTER. Returns a counter value."
1315 try:
1316 - return long(self.aux_get(mycpv, ["COUNTER"])[0])
1317 + return int(self.aux_get(mycpv, ["COUNTER"])[0])
1318 except (KeyError, ValueError):
1319 pass
1320 writemsg_level(_("portage: COUNTER for %s was corrupted; " \
1321 @@ -404,7 +397,7 @@ class vardbapi(dbapi):
1322 if not isvalidatom(newcp, eapi=mycpv.eapi):
1323 continue
1324
1325 - mynewcpv = mycpv.replace(mycpv_cp, _unicode(newcp), 1)
1326 + mynewcpv = mycpv.replace(mycpv_cp, str(newcp), 1)
1327 mynewcat = catsplit(newcp)[0]
1328 origpath = self.getpath(mycpv)
1329 if not os.path.exists(origpath):
1330 @@ -759,7 +752,7 @@ class vardbapi(dbapi):
1331 pkg_data = None
1332 else:
1333 cache_mtime, metadata = pkg_data
1334 - if not isinstance(cache_mtime, (float, long, int)) or \
1335 + if not isinstance(cache_mtime, (float, int)) or \
1336 not isinstance(metadata, dict):
1337 pkg_data = None
1338
1339 @@ -771,7 +764,7 @@ class vardbapi(dbapi):
1340
1341 # Handle truncated mtime in order to avoid cache
1342 # invalidation for livecd squashfs (bug 564222).
1343 - elif long(cache_mtime) == mydir_stat.st_mtime:
1344 + elif int(cache_mtime) == mydir_stat.st_mtime:
1345 cache_valid = True
1346 else:
1347 # Cache may contain integer mtime.
1348 @@ -796,7 +789,7 @@ class vardbapi(dbapi):
1349 cache_data.update(metadata)
1350 for aux_key in cache_these:
1351 cache_data[aux_key] = mydata[aux_key]
1352 - self._aux_cache["packages"][_unicode(mycpv)] = \
1353 + self._aux_cache["packages"][str(mycpv)] = \
1354 (mydir_mtime, cache_data)
1355 self._aux_cache["modified"].add(mycpv)
1356
1357 @@ -1090,7 +1083,7 @@ class vardbapi(dbapi):
1358 mode='r', encoding=_encodings['repo.content'],
1359 errors='replace') as f:
1360 try:
1361 - counter = long(f.readline().strip())
1362 + counter = int(f.readline().strip())
1363 except (OverflowError, ValueError) as e:
1364 writemsg(_("!!! COUNTER file is corrupt: '%s'\n") %
1365 self._counter_path, noiselevel=-1)
1366 @@ -1249,7 +1242,7 @@ class vardbapi(dbapi):
1367 if new_needed is not None:
1368 f = atomic_ofstream(os.path.join(pkg.dbdir, LinkageMap._needed_aux_key))
1369 for entry in new_needed:
1370 - f.write(_unicode(entry))
1371 + f.write(str(entry))
1372 f.close()
1373 f = atomic_ofstream(os.path.join(pkg.dbdir, "CONTENTS"))
1374 write_contents(new_contents, root, f)
1375 @@ -1321,7 +1314,7 @@ class vardbapi(dbapi):
1376 counter = int(counter)
1377 except ValueError:
1378 counter = 0
1379 - return (_unicode(cpv), counter, mtime)
1380 + return (str(cpv), counter, mtime)
1381
1382 class _owners_db(object):
1383
1384 @@ -1450,7 +1443,7 @@ class vardbapi(dbapi):
1385 len(hash_value) != 3:
1386 continue
1387 cpv, counter, mtime = hash_value
1388 - if not isinstance(cpv, basestring):
1389 + if not isinstance(cpv, str):
1390 continue
1391 try:
1392 current_hash = hash_pkg(cpv)
1393 @@ -3890,7 +3883,7 @@ class dblink(object):
1394 for phase, messages in logentries.items():
1395 for key, lines in messages:
1396 funcname = funcnames[key]
1397 - if isinstance(lines, basestring):
1398 + if isinstance(lines, str):
1399 lines = [lines]
1400 for line in lines:
1401 for line in line.split('\n'):
1402 @@ -4908,7 +4901,7 @@ class dblink(object):
1403 self._installed_instance is not None
1404
1405 # this is supposed to merge a list of files. There will be 2 forms of argument passing.
1406 - if isinstance(stufftomerge, basestring):
1407 + if isinstance(stufftomerge, str):
1408 #A directory is specified. Figure out protection paths, listdir() it and process it.
1409 mergelist = [join(stufftomerge, child) for child in \
1410 os.listdir(join(srcroot, stufftomerge))]
1411 @@ -5447,7 +5440,7 @@ class dblink(object):
1412
1413 def setfile(self,fname,data):
1414 kwargs = {}
1415 - if fname == 'environment.bz2' or not isinstance(data, basestring):
1416 + if fname == 'environment.bz2' or not isinstance(data, str):
1417 kwargs['mode'] = 'wb'
1418 else:
1419 kwargs['mode'] = 'w'
1420 @@ -5504,7 +5497,7 @@ class dblink(object):
1421
1422 build_time = backup_dblink.getfile('BUILD_TIME')
1423 try:
1424 - build_time = long(build_time.strip())
1425 + build_time = int(build_time.strip())
1426 except ValueError:
1427 build_time = 0
1428
1429 diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py
1430 index 314338f7c..f1894bb3f 100644
1431 --- a/lib/portage/dep/__init__.py
1432 +++ b/lib/portage/dep/__init__.py
1433 @@ -32,12 +32,6 @@ from portage.versions import _cp, _cpv, _pkg_str, _slot, _unknown_repo, _vr, \
1434 catpkgsplit, vercmp, ververify
1435 import portage.cache.mappings
1436
1437 -if sys.hexversion >= 0x3000000:
1438 - # pylint: disable=W0622
1439 - basestring = str
1440 - _unicode = str
1441 -else:
1442 - _unicode = unicode
1443
1444 # \w is [a-zA-Z0-9_]
1445
1446 @@ -354,7 +348,7 @@ class paren_normalize(list):
1447 return dest
1448 i = iter(src)
1449 for x in i:
1450 - if isinstance(x, basestring):
1451 + if isinstance(x, str):
1452 if x in ('||', '^^'):
1453 y = self._zap_parens(next(i), [], disjunction=True)
1454 if len(y) == 1:
1455 @@ -559,13 +553,12 @@ def _use_reduce_cached(depstr, uselist, masklist, matchall, excludeall, \
1456 stack[level].extend(l)
1457 continue
1458
1459 - if stack[level] and isinstance(stack[level][-1],
1460 - basestring):
1461 + if stack[level] and isinstance(stack[level][-1], str):
1462 if stack[level][-1] == "||" and not l:
1463 #Optimize: || ( ) -> .
1464 if not eapi_attrs.empty_groups_always_true:
1465 # in EAPI 7+, we need to fail here
1466 - l.append((token_class or _unicode)("__const__/empty-any-of"))
1467 + l.append((token_class or str)("__const__/empty-any-of"))
1468 stack[level].pop()
1469 elif stack[level][-1][-1] == "?":
1470 #The last token before the '(' that matches the current ')'
1471 @@ -588,8 +581,7 @@ def _use_reduce_cached(depstr, uselist, masklist, matchall, excludeall, \
1472 #ends in a non-operator. This is almost equivalent to stack[level][-1]=="||",
1473 #expect that it skips empty levels.
1474 while k>=0:
1475 - if stack[k] and isinstance(stack[k][-1],
1476 - basestring):
1477 + if stack[k] and isinstance(stack[k][-1], str):
1478 if stack[k][-1] == "||":
1479 return k
1480 elif stack[k][-1][-1] != "?":
1481 @@ -1230,7 +1222,7 @@ class _use_dep(object):
1482 return _use_dep(tokens, self._eapi_attrs, enabled_flags=enabled_flags, disabled_flags=disabled_flags,
1483 missing_enabled=missing_enabled, missing_disabled=missing_disabled, required=self.required)
1484
1485 -class Atom(_unicode):
1486 +class Atom(str):
1487
1488 """
1489 For compatibility with existing atom string manipulation code, this
1490 @@ -1257,7 +1249,7 @@ class Atom(_unicode):
1491
1492 def __new__(cls, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=None,
1493 _use=None, eapi=None, is_valid_flag=None, allow_build_id=None):
1494 - return _unicode.__new__(cls, s)
1495 + return str.__new__(cls, s)
1496
1497 def __init__(self, s, unevaluated_atom=None, allow_wildcard=False, allow_repo=None,
1498 _use=None, eapi=None, is_valid_flag=None, allow_build_id=None):
1499 @@ -1265,13 +1257,13 @@ class Atom(_unicode):
1500 # This is an efficiency assertion, to ensure that the Atom
1501 # constructor is not called redundantly.
1502 raise TypeError(_("Expected %s, got %s") % \
1503 - (_unicode, type(s)))
1504 + (str, type(s)))
1505
1506 - if not isinstance(s, _unicode):
1507 - # Avoid TypeError from _unicode.__init__ with PyPy.
1508 + if not isinstance(s, str):
1509 + # Avoid TypeError from str.__init__ with PyPy.
1510 s = _unicode_decode(s)
1511
1512 - _unicode.__init__(s)
1513 + str.__init__(s)
1514
1515 eapi_attrs = _get_eapi_attrs(eapi)
1516 atom_re = _get_atom_re(eapi_attrs)
1517 @@ -1438,7 +1430,7 @@ class Atom(_unicode):
1518 unevaluated_atom.use is not None:
1519 # unevaluated_atom.use is used for IUSE checks when matching
1520 # packages, so it must not propagate to without_use
1521 - without_use = Atom(_unicode(self),
1522 + without_use = Atom(str(self),
1523 allow_wildcard=allow_wildcard,
1524 allow_repo=allow_repo,
1525 eapi=eapi)
1526 @@ -1454,9 +1446,9 @@ class Atom(_unicode):
1527 self.__dict__['unevaluated_atom'] = self
1528
1529 if eapi is not None:
1530 - if not isinstance(eapi, basestring):
1531 + if not isinstance(eapi, str):
1532 raise TypeError('expected eapi argument of ' + \
1533 - '%s, got %s: %s' % (basestring, type(eapi), eapi,))
1534 + '%s, got %s: %s' % (str, type(eapi), eapi,))
1535 if self.slot and not eapi_attrs.slot_deps:
1536 raise InvalidAtom(
1537 _("Slot deps are not allowed in EAPI %s: '%s'") \
1538 @@ -1518,7 +1510,7 @@ class Atom(_unicode):
1539 if self.repo is not None:
1540 atom += _repo_separator + self.repo
1541 if self.use is not None:
1542 - atom += _unicode(self.use)
1543 + atom += str(self.use)
1544 return Atom(atom,
1545 allow_repo=True, allow_wildcard=True)
1546
1547 @@ -1534,7 +1526,7 @@ class Atom(_unicode):
1548 atom += self.slot_operator
1549 atom += _repo_separator + repo
1550 if self.use is not None:
1551 - atom += _unicode(self.use)
1552 + atom += str(self.use)
1553 return Atom(atom, allow_repo=True, allow_wildcard=True)
1554
1555 def with_slot(self, slot):
1556 @@ -1542,7 +1534,7 @@ class Atom(_unicode):
1557 if self.repo is not None:
1558 atom += _repo_separator + self.repo
1559 if self.use is not None:
1560 - atom += _unicode(self.use)
1561 + atom += str(self.use)
1562 return Atom(atom, allow_repo=True, allow_wildcard=True)
1563
1564 def __setattr__(self, name, value):
1565 @@ -1600,7 +1592,7 @@ class Atom(_unicode):
1566 if self.slot_operator is not None:
1567 atom += self.slot_operator
1568 use_dep = self.use.evaluate_conditionals(use)
1569 - atom += _unicode(use_dep)
1570 + atom += str(use_dep)
1571 return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
1572
1573 def violated_conditionals(self, other_use, is_valid_flag, parent_use=None):
1574 @@ -1628,7 +1620,7 @@ class Atom(_unicode):
1575 if self.slot_operator is not None:
1576 atom += self.slot_operator
1577 use_dep = self.use.violated_conditionals(other_use, is_valid_flag, parent_use)
1578 - atom += _unicode(use_dep)
1579 + atom += str(use_dep)
1580 return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
1581
1582 def _eval_qa_conditionals(self, use_mask, use_force):
1583 @@ -1644,7 +1636,7 @@ class Atom(_unicode):
1584 if self.slot_operator is not None:
1585 atom += self.slot_operator
1586 use_dep = self.use._eval_qa_conditionals(use_mask, use_force)
1587 - atom += _unicode(use_dep)
1588 + atom += str(use_dep)
1589 return Atom(atom, unevaluated_atom=self, allow_repo=(self.repo is not None), _use=use_dep)
1590
1591 def __copy__(self):
1592 @@ -1740,7 +1732,7 @@ class ExtendedAtomDict(portage.cache.mappings.MutableMapping):
1593
1594 def __getitem__(self, cp):
1595
1596 - if not isinstance(cp, basestring):
1597 + if not isinstance(cp, str):
1598 raise KeyError(cp)
1599
1600 if '*' in cp:
1601 @@ -1982,7 +1974,7 @@ def isvalidatom(atom, allow_blockers=False, allow_wildcard=False,
1602
1603 if eapi is not None and isinstance(atom, Atom) and atom.eapi != eapi:
1604 # We'll construct a new atom with the given eapi.
1605 - atom = _unicode(atom)
1606 + atom = str(atom)
1607
1608 try:
1609 if not isinstance(atom, Atom):
1610 diff --git a/lib/portage/eclass_cache.py b/lib/portage/eclass_cache.py
1611 index d2d9e2710..9daa6e34a 100644
1612 --- a/lib/portage/eclass_cache.py
1613 +++ b/lib/portage/eclass_cache.py
1614 @@ -1,4 +1,4 @@
1615 -# Copyright 2005-2014 Gentoo Foundation
1616 +# Copyright 2005-2020 Gentoo Authors
1617 # Distributed under the terms of the GNU General Public License v2
1618 # Author(s): Nicholas Carpaski (carpaski@g.o), Brian Harring (ferringb@g.o)
1619
1620 @@ -17,10 +17,6 @@ from portage import os
1621 from portage import checksum
1622 from portage import _shell_quote
1623
1624 -if sys.hexversion >= 0x3000000:
1625 - # pylint: disable=W0622
1626 - long = int
1627 -
1628
1629 class hashed_path(object):
1630
1631 @@ -30,11 +26,11 @@ class hashed_path(object):
1632 def __getattr__(self, attr):
1633 if attr == 'mtime':
1634 # use stat.ST_MTIME; accessing .st_mtime gets you a float
1635 - # depending on the python version, and long(float) introduces
1636 + # depending on the python version, and int(float) introduces
1637 # some rounding issues that aren't present for people using
1638 # the straight c api.
1639 # thus use the defacto python compatibility work around;
1640 - # access via index, which guarantees you get the raw long.
1641 + # access via index, which guarantees you get the raw int.
1642 try:
1643 self.mtime = obj = os.stat(self.location)[stat.ST_MTIME]
1644 except OSError as e:
1645 diff --git a/lib/portage/elog/__init__.py b/lib/portage/elog/__init__.py
1646 index cc086123f..e196a771d 100644
1647 --- a/lib/portage/elog/__init__.py
1648 +++ b/lib/portage/elog/__init__.py
1649 @@ -3,9 +3,6 @@
1650 # Distributed under the terms of the GNU General Public License v2
1651
1652 import sys
1653 -if sys.hexversion >= 0x3000000:
1654 - # pylint: disable=W0622
1655 - basestring = str
1656
1657 import portage
1658 portage.proxy.lazyimport.lazyimport(globals(),
1659 @@ -58,7 +55,7 @@ def _combine_logentries(logentries):
1660 if previous_type != msgtype:
1661 previous_type = msgtype
1662 rValue.append("%s: %s" % (msgtype, phase))
1663 - if isinstance(msgcontent, basestring):
1664 + if isinstance(msgcontent, str):
1665 rValue.append(msgcontent.rstrip("\n"))
1666 else:
1667 for line in msgcontent:
1668 diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py
1669 index 8cdf6ac7d..52e8fad8d 100644
1670 --- a/lib/portage/elog/mod_echo.py
1671 +++ b/lib/portage/elog/mod_echo.py
1672 @@ -9,9 +9,6 @@ from portage.output import EOutput, colorize
1673 from portage.const import EBUILD_PHASES
1674 from portage.localization import _
1675
1676 -if sys.hexversion >= 0x3000000:
1677 - # pylint: disable=W0622
1678 - basestring = str
1679
1680 _items = []
1681 def process(mysettings, key, logentries, fulltext):
1682 @@ -61,7 +58,7 @@ def _finalize():
1683 "ERROR": printer.eerror,
1684 "LOG": printer.einfo,
1685 "QA": printer.ewarn}
1686 - if isinstance(msgcontent, basestring):
1687 + if isinstance(msgcontent, str):
1688 msgcontent = [msgcontent]
1689 for line in msgcontent:
1690 fmap[msgtype](line.strip("\n"))
1691 diff --git a/lib/portage/elog/mod_syslog.py b/lib/portage/elog/mod_syslog.py
1692 index 8b26ffa1e..d2ad89d65 100644
1693 --- a/lib/portage/elog/mod_syslog.py
1694 +++ b/lib/portage/elog/mod_syslog.py
1695 @@ -7,9 +7,6 @@ import syslog
1696 from portage.const import EBUILD_PHASES
1697 from portage import _encodings
1698
1699 -if sys.hexversion >= 0x3000000:
1700 - # pylint: disable=W0622
1701 - basestring = str
1702
1703 _pri = {
1704 "INFO" : syslog.LOG_INFO,
1705 @@ -25,7 +22,7 @@ def process(mysettings, key, logentries, fulltext):
1706 if not phase in logentries:
1707 continue
1708 for msgtype, msgcontent in logentries[phase]:
1709 - if isinstance(msgcontent, basestring):
1710 + if isinstance(msgcontent, str):
1711 msgcontent = [msgcontent]
1712 for line in msgcontent:
1713 line = "%s: %s: %s" % (key, phase, line)
1714 diff --git a/lib/portage/emaint/modules/binhost/binhost.py b/lib/portage/emaint/modules/binhost/binhost.py
1715 index cf9516112..6a17610bb 100644
1716 --- a/lib/portage/emaint/modules/binhost/binhost.py
1717 +++ b/lib/portage/emaint/modules/binhost/binhost.py
1718 @@ -1,4 +1,4 @@
1719 -# Copyright 2005-2014 Gentoo Foundation
1720 +# Copyright 2005-2020 Gentoo Authors
1721 # Distributed under the terms of the GNU General Public License v2
1722
1723 import errno
1724 @@ -11,9 +11,6 @@ from portage.versions import _pkg_str
1725
1726 import sys
1727
1728 -if sys.hexversion >= 0x3000000:
1729 - # pylint: disable=W0622
1730 - long = int
1731
1732 class BinhostHandler(object):
1733
1734 @@ -54,9 +51,9 @@ class BinhostHandler(object):
1735 return False
1736
1737 try:
1738 - if long(mtime) != s[stat.ST_MTIME]:
1739 + if int(mtime) != s[stat.ST_MTIME]:
1740 return True
1741 - if long(size) != long(s.st_size):
1742 + if int(size) != int(s.st_size):
1743 return True
1744 except ValueError:
1745 return True
1746 diff --git a/lib/portage/emaint/modules/sync/sync.py b/lib/portage/emaint/modules/sync/sync.py
1747 index ac37fdcfa..d41a8158e 100644
1748 --- a/lib/portage/emaint/modules/sync/sync.py
1749 +++ b/lib/portage/emaint/modules/sync/sync.py
1750 @@ -1,4 +1,4 @@
1751 -# Copyright 2014-2019 Gentoo Authors
1752 +# Copyright 2014-2020 Gentoo Authors
1753 # Distributed under the terms of the GNU General Public License v2
1754
1755 import logging
1756 @@ -32,11 +32,6 @@ portage.proxy.lazyimport.lazyimport(globals(),
1757
1758 warn = create_color_func("WARN")
1759
1760 -if sys.hexversion >= 0x3000000:
1761 - _basestring = str
1762 -else:
1763 - _basestring = basestring
1764 -
1765
1766 class SyncRepos(object):
1767
1768 @@ -125,7 +120,7 @@ class SyncRepos(object):
1769 return_messages = options.get('return-messages', False)
1770 else:
1771 return_messages = False
1772 - if isinstance(repo_names, _basestring):
1773 + if isinstance(repo_names, str):
1774 repo_names = repo_names.split()
1775 success, repos, msgs = self._get_repos(auto_sync_only=False,
1776 match_repos=repo_names)
1777 diff --git a/lib/portage/exception.py b/lib/portage/exception.py
1778 index a1c3c5f17..fa59f1f14 100644
1779 --- a/lib/portage/exception.py
1780 +++ b/lib/portage/exception.py
1781 @@ -1,4 +1,4 @@
1782 -# Copyright 1998-2019 Gentoo Authors
1783 +# Copyright 1998-2020 Gentoo Authors
1784 # Distributed under the terms of the GNU General Public License v2
1785
1786 import signal
1787 @@ -6,9 +6,6 @@ import sys
1788 from portage import _encodings, _unicode_encode, _unicode_decode
1789 from portage.localization import _
1790
1791 -if sys.hexversion >= 0x3000000:
1792 - # pylint: disable=W0622
1793 - basestring = str
1794
1795 class PortageException(Exception):
1796 """General superclass for portage exceptions"""
1797 @@ -24,7 +21,7 @@ class PortageException(Exception):
1798 else:
1799 def __init__(self, value):
1800 self.value = value[:]
1801 - if isinstance(self.value, basestring):
1802 + if isinstance(self.value, str):
1803 self.value = _unicode_decode(self.value,
1804 encoding=_encodings['content'], errors='replace')
1805
1806 @@ -180,7 +177,7 @@ class UnsupportedAPIException(PortagePackageException):
1807 self.cpv, self.eapi = cpv, eapi
1808 def __str__(self):
1809 eapi = self.eapi
1810 - if not isinstance(eapi, basestring):
1811 + if not isinstance(eapi, str):
1812 eapi = str(eapi)
1813 eapi = eapi.lstrip("-")
1814 msg = _("Unable to do any operations on '%(cpv)s', since "
1815 diff --git a/lib/portage/getbinpkg.py b/lib/portage/getbinpkg.py
1816 index 14dc149b1..437481659 100644
1817 --- a/lib/portage/getbinpkg.py
1818 +++ b/lib/portage/getbinpkg.py
1819 @@ -64,9 +64,6 @@ else:
1820
1821 _all_errors = tuple(_all_errors)
1822
1823 -if sys.hexversion >= 0x3000000:
1824 - # pylint: disable=W0622
1825 - long = int
1826
1827 def make_metadata_dict(data):
1828
1829 @@ -910,7 +907,7 @@ class PackageIndex(object):
1830
1831 def write(self, pkgfile):
1832 if self.modified:
1833 - self.header["TIMESTAMP"] = str(long(time.time()))
1834 + self.header["TIMESTAMP"] = str(int(time.time()))
1835 self.header["PACKAGES"] = str(len(self.packages))
1836 keys = list(self.header)
1837 keys.sort()
1838 diff --git a/lib/portage/locks.py b/lib/portage/locks.py
1839 index 535698dfe..5c7a3f266 100644
1840 --- a/lib/portage/locks.py
1841 +++ b/lib/portage/locks.py
1842 @@ -23,9 +23,6 @@ from portage.util import writemsg
1843 from portage.util.install_mask import _raise_exc
1844 from portage.localization import _
1845
1846 -if sys.hexversion >= 0x3000000:
1847 - # pylint: disable=W0622
1848 - basestring = str
1849
1850 HARDLINK_FD = -2
1851 _HARDLINK_POLL_LATENCY = 3 # seconds
1852 @@ -167,7 +164,7 @@ def _lockfile_iteration(mypath, wantnewlockfile=False, unlinkfile=False,
1853 # deprecated due to ambiguity in whether or not it's safe to close
1854 # the file descriptor, making it prone to "Bad file descriptor" errors
1855 # or file descriptor leaks.
1856 - if isinstance(mypath, basestring) and mypath[-1] == '/':
1857 + if isinstance(mypath, str) and mypath[-1] == '/':
1858 mypath = mypath[:-1]
1859
1860 lockfilename_path = mypath
1861 @@ -192,7 +189,7 @@ def _lockfile_iteration(mypath, wantnewlockfile=False, unlinkfile=False,
1862 else:
1863 lockfilename = mypath
1864
1865 - if isinstance(mypath, basestring):
1866 + if isinstance(mypath, str):
1867 if not os.path.exists(os.path.dirname(mypath)):
1868 raise DirectoryNotFound(os.path.dirname(mypath))
1869 preexisting = os.path.exists(lockfilename)
1870 @@ -306,7 +303,7 @@ def _lockfile_iteration(mypath, wantnewlockfile=False, unlinkfile=False,
1871 os.close(myfd)
1872 lockfilename_path = _unicode_decode(lockfilename_path,
1873 encoding=_encodings['fs'], errors='strict')
1874 - if not isinstance(lockfilename_path, basestring):
1875 + if not isinstance(lockfilename_path, str):
1876 raise
1877 link_success = hardlink_lockfile(lockfilename_path,
1878 waiting_msg=waiting_msg, flags=flags)
1879 @@ -319,7 +316,7 @@ def _lockfile_iteration(mypath, wantnewlockfile=False, unlinkfile=False,
1880 raise
1881
1882 fstat_result = None
1883 - if isinstance(lockfilename, basestring) and myfd != HARDLINK_FD and unlinkfile:
1884 + if isinstance(lockfilename, str) and myfd != HARDLINK_FD and unlinkfile:
1885 try:
1886 (removed, fstat_result) = _lockfile_was_removed(myfd, lockfilename)
1887 except Exception:
1888 @@ -461,7 +458,7 @@ def unlockfile(mytuple):
1889 return True
1890
1891 # myfd may be None here due to myfd = mypath in lockfile()
1892 - if isinstance(lockfilename, basestring) and \
1893 + if isinstance(lockfilename, str) and \
1894 not os.path.exists(lockfilename):
1895 writemsg(_("lockfile does not exist '%s'\n") % lockfilename, 1)
1896 if myfd is not None:
1897 @@ -474,7 +471,7 @@ def unlockfile(mytuple):
1898 unlinkfile = 1
1899 locking_method(myfd, fcntl.LOCK_UN)
1900 except OSError:
1901 - if isinstance(lockfilename, basestring):
1902 + if isinstance(lockfilename, str):
1903 _open_fds[myfd].close()
1904 raise IOError(_("Failed to unlock file '%s'\n") % lockfilename)
1905
1906 @@ -507,7 +504,7 @@ def unlockfile(mytuple):
1907 # why test lockfilename? because we may have been handed an
1908 # fd originally, and the caller might not like having their
1909 # open fd closed automatically on them.
1910 - if isinstance(lockfilename, basestring):
1911 + if isinstance(lockfilename, str):
1912 _open_fds[myfd].close()
1913
1914 return True
1915 diff --git a/lib/portage/mail.py b/lib/portage/mail.py
1916 index 11923eea6..6a351aa24 100644
1917 --- a/lib/portage/mail.py
1918 +++ b/lib/portage/mail.py
1919 @@ -1,4 +1,4 @@
1920 -# Copyright 1998-2014 Gentoo Foundation
1921 +# Copyright 1998-2020 Gentoo Authors
1922 # Distributed under the terms of the GNU General Public License v2
1923
1924 # Since python ebuilds remove the 'email' module when USE=build
1925 @@ -20,9 +20,6 @@ from portage.localization import _
1926 import portage
1927
1928 if sys.hexversion >= 0x3000000:
1929 - # pylint: disable=W0622
1930 - basestring = str
1931 -
1932 def _force_ascii_if_necessary(s):
1933 # Force ascii encoding in order to avoid UnicodeEncodeError
1934 # from smtplib.sendmail with python3 (bug #291331).
1935 @@ -68,7 +65,7 @@ def create_message(sender, recipient, subject, body, attachments=None):
1936 for x in attachments:
1937 if isinstance(x, BaseMessage):
1938 mymessage.attach(x)
1939 - elif isinstance(x, basestring):
1940 + elif isinstance(x, str):
1941 if sys.hexversion < 0x3000000:
1942 x = _unicode_encode(x,
1943 encoding=_encodings['content'],
1944 diff --git a/lib/portage/manifest.py b/lib/portage/manifest.py
1945 index 4bca61e86..fecc5fccd 100644
1946 --- a/lib/portage/manifest.py
1947 +++ b/lib/portage/manifest.py
1948 @@ -1,4 +1,4 @@
1949 -# Copyright 1999-2016 Gentoo Foundation
1950 +# Copyright 1999-2020 Gentoo Authors
1951 # Distributed under the terms of the GNU General Public License v2
1952
1953 from __future__ import unicode_literals
1954 @@ -33,12 +33,6 @@ _manifest_re = re.compile(
1955 r'^(' + '|'.join(MANIFEST2_IDENTIFIERS) + r') (\S+)( \d+( \S+ \S+)+)$',
1956 re.UNICODE)
1957
1958 -if sys.hexversion >= 0x3000000:
1959 - # pylint: disable=W0622
1960 - _unicode = str
1961 - basestring = str
1962 -else:
1963 - _unicode = unicode
1964
1965 class FileNotInManifestException(PortageException):
1966 pass
1967 @@ -76,7 +70,7 @@ def guessThinManifestFileType(filename):
1968 return "DIST"
1969
1970 def parseManifest2(line):
1971 - if not isinstance(line, basestring):
1972 + if not isinstance(line, str):
1973 line = ' '.join(line)
1974 myentry = None
1975 match = _manifest_re.match(line)
1976 @@ -321,7 +315,7 @@ class Manifest(object):
1977 # thin manifests with no DIST entries, myentries is
1978 # non-empty for all currently known use cases.
1979 write_atomic(self.getFullname(), "".join("%s\n" %
1980 - _unicode(myentry) for myentry in myentries))
1981 + str(myentry) for myentry in myentries))
1982 self._apply_max_mtime(preserved_stats, myentries)
1983 rval = True
1984 else:
1985 diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
1986 index 47c180c12..1b57dbd38 100644
1987 --- a/lib/portage/package/ebuild/config.py
1988 +++ b/lib/portage/package/ebuild/config.py
1989 @@ -1,4 +1,4 @@
1990 -# Copyright 2010-2019 Gentoo Authors
1991 +# Copyright 2010-2020 Gentoo Authors
1992 # Distributed under the terms of the GNU General Public License v2
1993
1994 from __future__ import unicode_literals
1995 @@ -68,9 +68,6 @@ from portage.package.ebuild._config.VirtualsManager import VirtualsManager
1996 from portage.package.ebuild._config.helper import ordered_by_atom_specificity, prune_incremental
1997 from portage.package.ebuild._config.unpack_dependencies import load_unpack_dependencies_configuration
1998
1999 -if sys.hexversion >= 0x3000000:
2000 - # pylint: disable=W0622
2001 - basestring = str
2002
2003 _feature_flags_cache = {}
2004
2005 @@ -1450,7 +1447,7 @@ class config(object):
2006 pkg = None
2007 built_use = None
2008 explicit_iuse = None
2009 - if not isinstance(mycpv, basestring):
2010 + if not isinstance(mycpv, str):
2011 pkg = mycpv
2012 mycpv = pkg.cpv
2013 mydb = pkg._metadata
2014 @@ -2735,7 +2732,7 @@ class config(object):
2015
2016 def __setitem__(self,mykey,myvalue):
2017 "set a value; will be thrown away at reset() time"
2018 - if not isinstance(myvalue, basestring):
2019 + if not isinstance(myvalue, str):
2020 raise ValueError("Invalid type being used as a value: '%s': '%s'" % (str(mykey),str(myvalue)))
2021
2022 # Avoid potential UnicodeDecodeError exceptions later.
2023 @@ -2768,7 +2765,7 @@ class config(object):
2024 for x, myvalue in self.iteritems():
2025 if x in environ_filter:
2026 continue
2027 - if not isinstance(myvalue, basestring):
2028 + if not isinstance(myvalue, str):
2029 writemsg(_("!!! Non-string value in config: %s=%s\n") % \
2030 (x, myvalue), noiselevel=-1)
2031 continue
2032 diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
2033 index 2bff94cb1..e4bae989a 100644
2034 --- a/lib/portage/package/ebuild/doebuild.py
2035 +++ b/lib/portage/package/ebuild/doebuild.py
2036 @@ -94,10 +94,6 @@ from _emerge.EbuildSpawnProcess import EbuildSpawnProcess
2037 from _emerge.Package import Package
2038 from _emerge.RootConfig import RootConfig
2039
2040 -if sys.hexversion >= 0x3000000:
2041 - _unicode = str
2042 -else:
2043 - _unicode = unicode
2044
2045 _unsandboxed_phases = frozenset([
2046 "clean", "cleanrm", "config",
2047 @@ -2399,7 +2395,7 @@ def _post_src_install_soname_symlinks(mysettings, out):
2048
2049 # Compute the multilib category and write it back to the file.
2050 entry.multilib_category = compute_multilib_category(elf_header)
2051 - needed_file.write(_unicode(entry))
2052 + needed_file.write(str(entry))
2053
2054 if entry.multilib_category is None:
2055 if not qa_prebuilt or qa_prebuilt.match(
2056 @@ -2450,7 +2446,7 @@ def _post_src_install_soname_symlinks(mysettings, out):
2057 if unrecognized_elf_files:
2058 qa_msg = ["QA Notice: Unrecognized ELF file(s):"]
2059 qa_msg.append("")
2060 - qa_msg.extend("\t%s" % _unicode(entry).rstrip()
2061 + qa_msg.extend("\t%s" % str(entry).rstrip()
2062 for entry in unrecognized_elf_files)
2063 qa_msg.append("")
2064 for line in qa_msg:
2065 diff --git a/lib/portage/package/ebuild/getmaskingstatus.py b/lib/portage/package/ebuild/getmaskingstatus.py
2066 index 4b9e588f7..92224f90f 100644
2067 --- a/lib/portage/package/ebuild/getmaskingstatus.py
2068 +++ b/lib/portage/package/ebuild/getmaskingstatus.py
2069 @@ -1,4 +1,4 @@
2070 -# Copyright 2010-2014 Gentoo Foundation
2071 +# Copyright 2010-2020 Gentoo Authors
2072 # Distributed under the terms of the GNU General Public License v2
2073
2074 from __future__ import unicode_literals
2075 @@ -14,9 +14,6 @@ from portage.localization import _
2076 from portage.package.ebuild.config import config
2077 from portage.versions import catpkgsplit, _pkg_str
2078
2079 -if sys.hexversion >= 0x3000000:
2080 - # pylint: disable=W0622
2081 - basestring = str
2082
2083 class _UnmaskHint(object):
2084
2085 @@ -48,7 +45,7 @@ def _getmaskingstatus(mycpv, settings, portdb, myrepo=None):
2086
2087 metadata = None
2088 installed = False
2089 - if not isinstance(mycpv, basestring):
2090 + if not isinstance(mycpv, str):
2091 # emerge passed in a Package instance
2092 pkg = mycpv
2093 mycpv = pkg.cpv
2094 diff --git a/lib/portage/process.py b/lib/portage/process.py
2095 index ceb454030..bbe8d02f0 100644
2096 --- a/lib/portage/process.py
2097 +++ b/lib/portage/process.py
2098 @@ -40,9 +40,6 @@ try:
2099 except ImportError:
2100 max_fd_limit = 256
2101
2102 -if sys.hexversion >= 0x3000000:
2103 - # pylint: disable=W0622
2104 - basestring = str
2105
2106 # Support PEP 446 for Python >=3.4
2107 try:
2108 @@ -287,7 +284,7 @@ def spawn(mycommand, env=None, opt_name=None, fd_pipes=None, returnpid=False,
2109 """
2110
2111 # mycommand is either a str or a list
2112 - if isinstance(mycommand, basestring):
2113 + if isinstance(mycommand, str):
2114 mycommand = mycommand.split()
2115
2116 env = os.environ if env is None else env
2117 diff --git a/lib/portage/proxy/lazyimport.py b/lib/portage/proxy/lazyimport.py
2118 index d4258706d..532f3ce0a 100644
2119 --- a/lib/portage/proxy/lazyimport.py
2120 +++ b/lib/portage/proxy/lazyimport.py
2121 @@ -1,4 +1,4 @@
2122 -# Copyright 2009-2014 Gentoo Foundation
2123 +# Copyright 2009-2020 Gentoo Authors
2124 # Distributed under the terms of the GNU General Public License v2
2125
2126 __all__ = ['lazyimport']
2127 @@ -13,9 +13,6 @@ except ImportError:
2128
2129 from portage.proxy.objectproxy import ObjectProxy
2130
2131 -if sys.hexversion >= 0x3000000:
2132 - # pylint: disable=W0622
2133 - basestring = str
2134
2135 _module_proxies = {}
2136 _module_proxies_lock = threading.RLock()
2137 @@ -169,7 +166,7 @@ def lazyimport(scope, *args):
2138 if len(parts) == 1:
2139 name = s
2140
2141 - if not name or not isinstance(name, basestring):
2142 + if not name or not isinstance(name, str):
2143 raise ValueError(name)
2144
2145 components = name.split('.')
2146 diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py
2147 index 3a5425be7..4c9c47304 100644
2148 --- a/lib/portage/repository/config.py
2149 +++ b/lib/portage/repository/config.py
2150 @@ -28,9 +28,6 @@ from portage import _encodings
2151 from portage import manifest
2152 import portage.sync
2153
2154 -if sys.hexversion >= 0x3000000:
2155 - # pylint: disable=W0622
2156 - basestring = str
2157
2158 # Characters prohibited by repoman's file.name check.
2159 _invalid_path_char_re = re.compile(r'[^a-zA-Z0-9._\-+/]')
2160 @@ -671,7 +668,7 @@ class RepoConfigLoader(object):
2161
2162 recursive_paths = []
2163 for p in paths:
2164 - if isinstance(p, basestring):
2165 + if isinstance(p, str):
2166 recursive_paths.extend(_recursive_file_list(p))
2167 else:
2168 recursive_paths.append(p)
2169 diff --git a/lib/portage/sync/getaddrinfo_validate.py b/lib/portage/sync/getaddrinfo_validate.py
2170 index 5e6009c74..8ed87626e 100644
2171 --- a/lib/portage/sync/getaddrinfo_validate.py
2172 +++ b/lib/portage/sync/getaddrinfo_validate.py
2173 @@ -1,10 +1,8 @@
2174 -# Copyright 2010 Gentoo Foundation
2175 +# Copyright 2010-2020 Gentoo Authors
2176 # Distributed under the terms of the GNU General Public License v2
2177
2178 import sys
2179
2180 -if sys.hexversion >= 0x3000000:
2181 - basestring = str
2182
2183 def getaddrinfo_validate(addrinfos):
2184 """
2185 @@ -19,7 +17,7 @@ def getaddrinfo_validate(addrinfos):
2186 continue
2187 if len(addrinfo[4]) < 2:
2188 continue
2189 - if not isinstance(addrinfo[4][0], basestring):
2190 + if not isinstance(addrinfo[4][0], str):
2191 continue
2192 except TypeError:
2193 continue
2194 diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py
2195 index 9be96c24c..02f53c08e 100644
2196 --- a/lib/portage/sync/modules/rsync/rsync.py
2197 +++ b/lib/portage/sync/modules/rsync/rsync.py
2198 @@ -36,11 +36,6 @@ try:
2199 except ImportError:
2200 gemato = None
2201
2202 -if sys.hexversion >= 0x3000000:
2203 - # pylint: disable=W0622
2204 - _unicode = str
2205 -else:
2206 - _unicode = unicode
2207
2208 SERVER_OUT_OF_DATE = -1
2209 EXCEEDED_MAX_RETRIES = -2
2210 @@ -243,7 +238,7 @@ class RsyncSync(NewBase):
2211 except socket.error as e:
2212 writemsg_level(
2213 "!!! getaddrinfo failed for '%s': %s\n"
2214 - % (_unicode_decode(hostname), _unicode(e)),
2215 + % (_unicode_decode(hostname), str(e)),
2216 noiselevel=-1, level=logging.ERROR)
2217
2218 if addrinfos:
2219 diff --git a/lib/portage/tests/dep/test_match_from_list.py b/lib/portage/tests/dep/test_match_from_list.py
2220 index 3080479c2..3ad119fe6 100644
2221 --- a/lib/portage/tests/dep/test_match_from_list.py
2222 +++ b/lib/portage/tests/dep/test_match_from_list.py
2223 @@ -1,4 +1,4 @@
2224 -# Copyright 2006-2014 Gentoo Foundation
2225 +# Copyright 2006-2020 Gentoo Authors
2226 # Distributed under the terms of the GNU General Public License v2
2227
2228 import sys
2229 @@ -6,9 +6,6 @@ from portage.tests import TestCase
2230 from portage.dep import Atom, match_from_list, _repo_separator
2231 from portage.versions import catpkgsplit, _pkg_str
2232
2233 -if sys.hexversion >= 0x3000000:
2234 - # pylint: disable=W0622
2235 - basestring = str
2236
2237 class Package(object):
2238 """
2239 @@ -43,7 +40,7 @@ class Package(object):
2240 self.all = frozenset(iuse)
2241
2242 def is_valid_flag(self, flags):
2243 - if isinstance(flags, basestring):
2244 + if isinstance(flags, str):
2245 flags = [flags]
2246 for flag in flags:
2247 if not flag in self.all:
2248 diff --git a/lib/portage/tests/resolver/ResolverPlayground.py b/lib/portage/tests/resolver/ResolverPlayground.py
2249 index ec2e31ae9..d39073a4c 100644
2250 --- a/lib/portage/tests/resolver/ResolverPlayground.py
2251 +++ b/lib/portage/tests/resolver/ResolverPlayground.py
2252 @@ -34,9 +34,6 @@ try:
2253 except ImportError:
2254 cnf_path_repoman = None
2255
2256 -if sys.hexversion >= 0x3000000:
2257 - # pylint: disable=W0622
2258 - basestring = str
2259
2260 class ResolverPlayground(object):
2261 """
2262 @@ -411,7 +408,7 @@ class ResolverPlayground(object):
2263
2264 for eclass_name, eclass_content in eclasses.items():
2265 with open(os.path.join(eclass_dir, "{}.eclass".format(eclass_name)), 'wt') as f:
2266 - if isinstance(eclass_content, basestring):
2267 + if isinstance(eclass_content, str):
2268 eclass_content = [eclass_content]
2269 for line in eclass_content:
2270 f.write("{}\n".format(line))
2271 @@ -695,7 +692,7 @@ class ResolverPlaygroundTestCase(object):
2272 if expected:
2273 new_expected = []
2274 for obj in expected:
2275 - if isinstance(obj, basestring):
2276 + if isinstance(obj, str):
2277 if obj[:1] == "!":
2278 new_expected.append(obj)
2279 continue
2280 @@ -720,7 +717,7 @@ class ResolverPlaygroundTestCase(object):
2281 while got_stack and expected_stack:
2282 got_token = got_stack.pop()
2283 expected_obj = expected_stack.pop()
2284 - if isinstance(expected_obj, basestring):
2285 + if isinstance(expected_obj, str):
2286 new_expected.append(expected_obj)
2287 if got_token == expected_obj:
2288 continue
2289 diff --git a/lib/portage/tests/unicode/test_string_format.py b/lib/portage/tests/unicode/test_string_format.py
2290 index 9d4366a91..fa092616c 100644
2291 --- a/lib/portage/tests/unicode/test_string_format.py
2292 +++ b/lib/portage/tests/unicode/test_string_format.py
2293 @@ -1,4 +1,4 @@
2294 -# Copyright 2010-2014 Gentoo Foundation
2295 +# Copyright 2010-2020 Gentoo Authors
2296 # Distributed under the terms of the GNU General Public License v2
2297
2298 from __future__ import unicode_literals
2299 @@ -11,9 +11,6 @@ from portage.tests import TestCase
2300 from _emerge.DependencyArg import DependencyArg
2301 from _emerge.UseFlagDisplay import UseFlagDisplay
2302
2303 -if sys.hexversion >= 0x3000000:
2304 - # pylint: disable=W0622
2305 - basestring = str
2306
2307 STR_IS_UNICODE = sys.hexversion >= 0x3000000
2308
2309 @@ -93,7 +90,7 @@ class StringFormatTestCase(TestCase):
2310 # Use unicode_literals for unicode format string so that
2311 # __unicode__() is called in Python 2.
2312 formatted_str = "%s" % (e,)
2313 - self.assertEqual(isinstance(formatted_str, basestring), True)
2314 + self.assertEqual(isinstance(formatted_str, str), True)
2315
2316 if STR_IS_UNICODE:
2317
2318 diff --git a/lib/portage/update.py b/lib/portage/update.py
2319 index 1920d213a..94af2645d 100644
2320 --- a/lib/portage/update.py
2321 +++ b/lib/portage/update.py
2322 @@ -1,4 +1,4 @@
2323 -# Copyright 1999-2014 Gentoo Foundation
2324 +# Copyright 1999-2020 Gentoo Authors
2325 # Distributed under the terms of the GNU General Public License v2
2326
2327 from __future__ import unicode_literals
2328 @@ -27,12 +27,6 @@ from portage.eapi import _get_eapi_attrs
2329 from portage.exception import DirectoryNotFound, InvalidAtom, PortageException
2330 from portage.localization import _
2331
2332 -if sys.hexversion >= 0x3000000:
2333 - # pylint: disable=W0622
2334 - long = int
2335 - _unicode = str
2336 -else:
2337 - _unicode = unicode
2338
2339 ignored_dbentries = ("CONTENTS", "environment.bz2")
2340
2341 @@ -42,8 +36,8 @@ def update_dbentry(update_cmd, mycontent, eapi=None, parent=None):
2342 eapi = parent.eapi
2343
2344 if update_cmd[0] == "move":
2345 - old_value = _unicode(update_cmd[1])
2346 - new_value = _unicode(update_cmd[2])
2347 + old_value = str(update_cmd[1])
2348 + new_value = str(update_cmd[2])
2349
2350 # Use isvalidatom() to check if this move is valid for the
2351 # EAPI (characters allowed in package names may vary).
2352 @@ -70,7 +64,7 @@ def update_dbentry(update_cmd, mycontent, eapi=None, parent=None):
2353 match_from_list(new_atom, [parent]):
2354 continue
2355
2356 - split_content[i] = _unicode(new_atom)
2357 + split_content[i] = str(new_atom)
2358 modified = True
2359
2360 if modified:
2361 @@ -197,7 +191,7 @@ def grab_updates(updpath, prev_mtimes=None):
2362 mystat = os.stat(file_path)
2363 if update_data or \
2364 file_path not in prev_mtimes or \
2365 - long(prev_mtimes[file_path]) != mystat[stat.ST_MTIME]:
2366 + int(prev_mtimes[file_path]) != mystat[stat.ST_MTIME]:
2367 f = io.open(_unicode_encode(file_path,
2368 encoding=_encodings['fs'], errors='strict'),
2369 mode='r', encoding=_encodings['repo.content'], errors='replace')
2370 diff --git a/lib/portage/util/__init__.py b/lib/portage/util/__init__.py
2371 index 154431a53..4d1fb9a51 100644
2372 --- a/lib/portage/util/__init__.py
2373 +++ b/lib/portage/util/__init__.py
2374 @@ -1,4 +1,4 @@
2375 -# Copyright 2004-2017 Gentoo Foundation
2376 +# Copyright 2004-2020 Gentoo Authors
2377 # Distributed under the terms of the GNU General Public License v2
2378
2379 from __future__ import unicode_literals
2380 @@ -49,10 +49,6 @@ from portage.localization import _
2381 from portage.proxy.objectproxy import ObjectProxy
2382 from portage.cache.mappings import UserDict
2383
2384 -if sys.hexversion >= 0x3000000:
2385 - _unicode = str
2386 -else:
2387 - _unicode = unicode
2388
2389 noiselimit = 0
2390
2391 @@ -505,7 +501,7 @@ def grabfile_package(myfilename, compatlevel=0, recursive=0,
2392 writemsg(_("--- Invalid atom in %s: %s\n") % (source_file, e),
2393 noiselevel=-1)
2394 else:
2395 - if pkg_orig == _unicode(pkg):
2396 + if pkg_orig == str(pkg):
2397 # normal atom, so return as Atom instance
2398 if remember_source_file:
2399 atoms.append((pkg, source_file))
2400 diff --git a/lib/portage/util/_dyn_libs/LinkageMapELF.py b/lib/portage/util/_dyn_libs/LinkageMapELF.py
2401 index 473a1243d..a3ec4fcc7 100644
2402 --- a/lib/portage/util/_dyn_libs/LinkageMapELF.py
2403 +++ b/lib/portage/util/_dyn_libs/LinkageMapELF.py
2404 @@ -27,10 +27,6 @@ from portage.util import writemsg_level
2405 from portage.util._dyn_libs.NeededEntry import NeededEntry
2406 from portage.util.elf.header import ELFHeader
2407
2408 -if sys.hexversion >= 0x3000000:
2409 - _unicode = str
2410 -else:
2411 - _unicode = unicode
2412
2413 # Map ELF e_machine values from NEEDED.ELF.2 to approximate multilib
2414 # categories. This approximation will produce incorrect results on x32
2415 @@ -333,7 +329,7 @@ class LinkageMapELF(object):
2416 entry.multilib_category = compute_multilib_category(elf_header)
2417 entry.filename = entry.filename[root_len:]
2418 owner = plibs.pop(entry.filename, None)
2419 - lines.append((owner, "scanelf", _unicode(entry)))
2420 + lines.append((owner, "scanelf", str(entry)))
2421 proc.wait()
2422 proc.stdout.close()
2423
2424 diff --git a/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py b/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py
2425 index f83b82a31..7909f258c 100644
2426 --- a/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py
2427 +++ b/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py
2428 @@ -1,4 +1,4 @@
2429 -# Copyright 1998-2014 Gentoo Foundation
2430 +# Copyright 1998-2020 Gentoo Authors
2431 # Distributed under the terms of the GNU General Public License v2
2432
2433 import errno
2434 @@ -25,9 +25,6 @@ from portage.util import writemsg_level
2435 from portage.versions import cpv_getkey
2436 from portage.locks import lockfile, unlockfile
2437
2438 -if sys.hexversion >= 0x3000000:
2439 - # pylint: disable=W0622
2440 - basestring = str
2441
2442 class PreservedLibsRegistry(object):
2443 """ This class handles the tracking of preserved library objects """
2444 @@ -154,7 +151,7 @@ class PreservedLibsRegistry(object):
2445 int conversion and a possible ValueError resulting
2446 from vardb corruption.
2447 """
2448 - if not isinstance(counter, basestring):
2449 + if not isinstance(counter, str):
2450 counter = str(counter)
2451 return _unicode_decode(counter).strip()
2452
2453 diff --git a/lib/portage/util/_urlopen.py b/lib/portage/util/_urlopen.py
2454 index 1d8ba3fd3..c74fb2691 100644
2455 --- a/lib/portage/util/_urlopen.py
2456 +++ b/lib/portage/util/_urlopen.py
2457 @@ -1,4 +1,4 @@
2458 -# Copyright 2012-2019 Gentoo Authors
2459 +# Copyright 2012-2020 Gentoo Authors
2460 # Distributed under the terms of the GNU General Public License v2
2461
2462 import io
2463 @@ -16,9 +16,6 @@ except ImportError:
2464 import urlparse as urllib_parse
2465 import urllib2 as urllib_request
2466
2467 -if sys.hexversion >= 0x3000000:
2468 - # pylint: disable=W0622
2469 - long = int
2470
2471 # to account for the difference between TIMESTAMP of the index' contents
2472 # and the file-'mtime'
2473 @@ -63,14 +60,14 @@ def urlopen(url, if_modified_since=None):
2474 return hdl
2475
2476 def _timestamp_to_http(timestamp):
2477 - dt = datetime.fromtimestamp(float(long(timestamp)+TIMESTAMP_TOLERANCE))
2478 + dt = datetime.fromtimestamp(float(int(timestamp)+TIMESTAMP_TOLERANCE))
2479 stamp = mktime(dt.timetuple())
2480 return formatdate(timeval=stamp, localtime=False, usegmt=True)
2481
2482 def _http_to_timestamp(http_datetime_string):
2483 tuple = parsedate(http_datetime_string)
2484 timestamp = mktime(tuple)
2485 - return str(long(timestamp))
2486 + return str(int(timestamp))
2487
2488 class CompressedResponseProcessor(urllib_request.HTTPBasicAuthHandler):
2489 # Handler for compressed responses.
2490 diff --git a/lib/portage/util/changelog.py b/lib/portage/util/changelog.py
2491 index 9fc5ab6df..dab756129 100644
2492 --- a/lib/portage/util/changelog.py
2493 +++ b/lib/portage/util/changelog.py
2494 @@ -1,21 +1,21 @@
2495 #!/usr/bin/python -b
2496 -# Copyright 2009-2015 Gentoo Foundation
2497 +# Copyright 2009-2020 Gentoo Authors
2498 # Distributed under the terms of the GNU General Public License v2
2499
2500
2501 from portage.manifest import guessManifestFileType
2502 -from portage.versions import _unicode, pkgsplit, vercmp
2503 +from portage.versions import pkgsplit, vercmp
2504
2505
2506 -class ChangeLogTypeSort(_unicode):
2507 +class ChangeLogTypeSort(str):
2508 """
2509 Helps to sort file names by file type and other criteria.
2510 """
2511 def __new__(cls, status_change, file_name):
2512 - return _unicode.__new__(cls, status_change + file_name)
2513 + return str.__new__(cls, status_change + file_name)
2514
2515 def __init__(self, status_change, file_name):
2516 - _unicode.__init__(status_change + file_name)
2517 + str.__init__(status_change + file_name)
2518 self.status_change = status_change
2519 self.file_name = file_name
2520 self.file_type = guessManifestFileType(file_name)
2521 diff --git a/lib/portage/util/compression_probe.py b/lib/portage/util/compression_probe.py
2522 index 7d595670b..d3f3de7a2 100644
2523 --- a/lib/portage/util/compression_probe.py
2524 +++ b/lib/portage/util/compression_probe.py
2525 @@ -6,8 +6,6 @@ import errno
2526 import re
2527 import sys
2528
2529 -if sys.hexversion >= 0x3000000:
2530 - basestring = str
2531
2532 from portage import _encodings, _unicode_encode
2533 from portage.exception import FileNotFound, PermissionDenied
2534 @@ -87,7 +85,7 @@ def compression_probe(f):
2535 @rtype str or None
2536 """
2537
2538 - open_file = isinstance(f, basestring)
2539 + open_file = isinstance(f, str)
2540 if open_file:
2541 try:
2542 f = open(_unicode_encode(f,
2543 diff --git a/lib/portage/util/configparser.py b/lib/portage/util/configparser.py
2544 index c4c92a603..f3452231f 100644
2545 --- a/lib/portage/util/configparser.py
2546 +++ b/lib/portage/util/configparser.py
2547 @@ -1,4 +1,4 @@
2548 -# Copyright 2016 Gentoo Foundation
2549 +# Copyright 2016-2020 Gentoo Authors
2550 # Distributed under the terms of the GNU General Public License v2
2551
2552 __all__ = ['ConfigParserError', 'NoOptionError', 'ParsingError',
2553 @@ -26,11 +26,6 @@ from portage import _encodings
2554 from portage import _unicode_encode
2555
2556
2557 -if sys.hexversion >= 0x3000000:
2558 - # pylint: disable=W0622
2559 - basestring = str
2560 -
2561 -
2562 def read_configs(parser, paths):
2563 """
2564 Read configuration files from given paths into the specified
2565 @@ -50,7 +45,7 @@ def read_configs(parser, paths):
2566 source_kwarg = 'filename'
2567
2568 for p in paths:
2569 - if isinstance(p, basestring):
2570 + if isinstance(p, str):
2571 f = None
2572 try:
2573 f = io.open(_unicode_encode(p,
2574 diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py
2575 index 032101043..5c036b6ba 100644
2576 --- a/lib/portage/util/env_update.py
2577 +++ b/lib/portage/util/env_update.py
2578 @@ -1,4 +1,4 @@
2579 -# Copyright 2010-2014 Gentoo Foundation
2580 +# Copyright 2010-2020 Gentoo Authors
2581 # Distributed under the terms of the GNU General Public License v2
2582
2583 __all__ = ['env_update']
2584 @@ -23,9 +23,6 @@ from portage.util.listdir import listdir
2585 from portage.dbapi.vartree import vartree
2586 from portage.package.ebuild.config import config
2587
2588 -if sys.hexversion >= 0x3000000:
2589 - # pylint: disable=W0622
2590 - long = int
2591
2592 def env_update(makelinks=1, target_root=None, prev_mtimes=None, contents=None,
2593 env=None, writemsg_level=None, vardbapi=None):
2594 @@ -257,7 +254,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env,
2595 if e.errno != errno.ENOENT:
2596 raise
2597
2598 - current_time = long(time.time())
2599 + current_time = int(time.time())
2600 mtime_changed = False
2601
2602 lib_dirs = set()
2603 diff --git a/lib/portage/util/install_mask.py b/lib/portage/util/install_mask.py
2604 index 0013effa1..fa12e4910 100644
2605 --- a/lib/portage/util/install_mask.py
2606 +++ b/lib/portage/util/install_mask.py
2607 @@ -1,4 +1,4 @@
2608 -# Copyright 2018-2019 Gentoo Authors
2609 +# Copyright 2018-2020 Gentoo Authors
2610 # Distributed under the terms of the GNU General Public License v2
2611
2612 __all__ = ['install_mask_dir', 'InstallMask']
2613 @@ -20,11 +20,6 @@ from portage.exception import (
2614 )
2615 from portage.util import normalize_path
2616
2617 -if sys.hexversion >= 0x3000000:
2618 - _unicode = str
2619 -else:
2620 - _unicode = unicode
2621 -
2622
2623 def _defaultdict_tree():
2624 return collections.defaultdict(_defaultdict_tree)
2625 @@ -152,7 +147,7 @@ def _raise_exc(e):
2626 wrapper_cls = _exc_map.get(e.errno)
2627 if wrapper_cls is None:
2628 raise
2629 - wrapper = wrapper_cls(_unicode(e))
2630 + wrapper = wrapper_cls(str(e))
2631 wrapper.__cause__ = e
2632 raise wrapper
2633
2634 diff --git a/lib/portage/versions.py b/lib/portage/versions.py
2635 index 100c8b84d..63edd0c79 100644
2636 --- a/lib/portage/versions.py
2637 +++ b/lib/portage/versions.py
2638 @@ -15,11 +15,6 @@ import sys
2639 import warnings
2640 from functools import lru_cache
2641
2642 -if sys.hexversion < 0x3000000:
2643 - _unicode = unicode
2644 -else:
2645 - _unicode = str
2646 - long = int
2647
2648 import portage
2649 portage.proxy.lazyimport.lazyimport(globals(),
2650 @@ -348,7 +343,7 @@ def catpkgsplit(mydata, silent=1, eapi=None):
2651 retval = (cat, p_split[0], p_split[1], p_split[2])
2652 return retval
2653
2654 -class _pkg_str(_unicode):
2655 +class _pkg_str(str):
2656 """
2657 This class represents a cpv. It inherits from str (unicode in python2) and
2658 has attributes that cache results for use by functions like catpkgsplit and
2659 @@ -367,15 +362,15 @@ class _pkg_str(_unicode):
2660 def __new__(cls, cpv, metadata=None, settings=None, eapi=None,
2661 repo=None, slot=None, build_time=None, build_id=None,
2662 file_size=None, mtime=None, db=None):
2663 - return _unicode.__new__(cls, cpv)
2664 + return str.__new__(cls, cpv)
2665
2666 def __init__(self, cpv, metadata=None, settings=None, eapi=None,
2667 repo=None, slot=None, build_time=None, build_id=None,
2668 file_size=None, mtime=None, db=None):
2669 - if not isinstance(cpv, _unicode):
2670 - # Avoid TypeError from _unicode.__init__ with PyPy.
2671 + if not isinstance(cpv, str):
2672 + # Avoid TypeError from str.__init__ with PyPy.
2673 cpv = _unicode_decode(cpv)
2674 - _unicode.__init__(cpv)
2675 + str.__init__(cpv)
2676 if metadata is not None:
2677 self.__dict__['_metadata'] = metadata
2678 slot = metadata.get('SLOT', slot)
2679 @@ -440,7 +435,7 @@ class _pkg_str(_unicode):
2680 def _long(var, default):
2681 if var is not None:
2682 try:
2683 - var = long(var)
2684 + var = int(var)
2685 except ValueError:
2686 if var:
2687 var = -1
2688 diff --git a/lib/portage/xml/metadata.py b/lib/portage/xml/metadata.py
2689 index 64246c828..204e0b099 100644
2690 --- a/lib/portage/xml/metadata.py
2691 +++ b/lib/portage/xml/metadata.py
2692 @@ -1,4 +1,4 @@
2693 -# Copyright 2010-2019 Gentoo Authors
2694 +# Copyright 2010-2020 Gentoo Authors
2695 # Distributed under the terms of the GNU General Public License v2
2696
2697 """Provides an easy-to-use python interface to Gentoo's metadata.xml file.
2698 @@ -55,10 +55,6 @@ import xml.etree.ElementTree
2699 from portage import _encodings, _unicode_encode
2700 from portage.util import cmp_sort_key, unique_everseen
2701
2702 -if sys.hexversion >= 0x3000000:
2703 - # pylint: disable=W0622
2704 - basestring = str
2705 -
2706
2707 class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
2708 """
2709 @@ -479,12 +475,12 @@ def parse_metadata_use(xml_tree):
2710 stack.append(flag)
2711 while stack:
2712 obj = stack.pop()
2713 - if isinstance(obj, basestring):
2714 + if isinstance(obj, str):
2715 inner_text.append(obj)
2716 continue
2717 - if isinstance(obj.text, basestring):
2718 + if isinstance(obj.text, str):
2719 inner_text.append(obj.text)
2720 - if isinstance(obj.tail, basestring):
2721 + if isinstance(obj.tail, str):
2722 stack.append(obj.tail)
2723 stack.extend(reversed(obj))
2724
2725 diff --git a/repoman/lib/repoman/__init__.py b/repoman/lib/repoman/__init__.py
2726 index 4f3e59e50..fda942c92 100644
2727 --- a/repoman/lib/repoman/__init__.py
2728 +++ b/repoman/lib/repoman/__init__.py
2729 @@ -20,9 +20,6 @@ except ImportError as e:
2730 sys.stderr.write(" "+str(e)+"\n\n")
2731 raise
2732
2733 -if sys.hexversion >= 0x3000000:
2734 - # pylint: disable=W0622
2735 - long = int
2736
2737 VERSION = "HEAD"
2738
2739 @@ -62,10 +59,10 @@ if VERSION == 'HEAD':
2740 head_timestamp = None
2741 if len(output_lines) > 3:
2742 try:
2743 - head_timestamp = long(output_lines[3])
2744 + head_timestamp = int(output_lines[3])
2745 except ValueError:
2746 pass
2747 - timestamp = long(time.time())
2748 + timestamp = int(time.time())
2749 if head_timestamp is not None and timestamp > head_timestamp:
2750 timestamp = timestamp - head_timestamp
2751 if not patchlevel:
2752 diff --git a/repoman/lib/repoman/main.py b/repoman/lib/repoman/main.py
2753 index 731e8eae2..86f2198fd 100755
2754 --- a/repoman/lib/repoman/main.py
2755 +++ b/repoman/lib/repoman/main.py
2756 @@ -36,8 +36,6 @@ from repoman import utilities
2757 from repoman.modules.vcs.settings import VCSSettings
2758 from repoman import VERSION
2759
2760 -if sys.hexversion >= 0x3000000:
2761 - basestring = str
2762
2763 bad = create_color_func("BAD")
2764
2765 diff --git a/repoman/lib/repoman/metadata.py b/repoman/lib/repoman/metadata.py
2766 index 4537d2ce2..111d80f0a 100644
2767 --- a/repoman/lib/repoman/metadata.py
2768 +++ b/repoman/lib/repoman/metadata.py
2769 @@ -14,11 +14,6 @@ from portage import os
2770 from portage.output import green
2771 from portage.package.ebuild.fetch import fetch
2772
2773 -if sys.hexversion >= 0x3000000:
2774 - basestring = str
2775 -
2776 -if sys.hexversion >= 0x3000000:
2777 - basestring = str
2778
2779 # Note: This URI is hardcoded in all metadata.xml files. We can't
2780 # change it without updating all the xml files in the tree.
2781 diff --git a/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py b/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
2782 index 2edf8f7f2..6c0822897 100644
2783 --- a/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
2784 +++ b/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
2785 @@ -5,9 +5,6 @@
2786 import re
2787 import sys
2788
2789 -if sys.hexversion >= 0x3000000:
2790 - basestring = str
2791 -
2792 from repoman.modules.scan.scanbase import ScanBase
2793
2794 from portage.dep import use_reduce
2795 @@ -24,7 +21,7 @@ class EbuildMetadata(ScanBase):
2796 def invalidchar(self, **kwargs):
2797 ebuild = kwargs.get('ebuild').get()
2798 for k, v in ebuild.metadata.items():
2799 - if not isinstance(v, basestring):
2800 + if not isinstance(v, str):
2801 continue
2802 m = NON_ASCII_RE.search(v)
2803 if m is not None:
2804 diff --git a/repoman/lib/repoman/utilities.py b/repoman/lib/repoman/utilities.py
2805 index 790d5e516..fa2cab68e 100644
2806 --- a/repoman/lib/repoman/utilities.py
2807 +++ b/repoman/lib/repoman/utilities.py
2808 @@ -50,9 +50,6 @@ from repoman.copyrights import update_copyright, update_copyright_year
2809 normalize_path = util.normalize_path
2810 util.initialize_logger()
2811
2812 -if sys.hexversion >= 0x3000000:
2813 - basestring = str
2814 -
2815
2816 def have_profile_dir(path, maxdepth=3, filename="profiles.desc"):
2817 """
2818 --
2819 2.27.0

Replies