[gentoo-portage-dev] [PATCH] lib/*: Fix useless-return
* Python implies such things. Let's drop 'em and be consistent. Signed-off-by: Aaron Bauman --- lib/_emerge/EbuildPhase.py | 6 +++--- lib/_emerge/resolver/output.py | 5 + lib/portage/elog/mod_custom.py | 1 + lib/portage/elog/mod_echo.py | 4 ++-- lib/portage/elog/mod_mail.py | 2 ++ lib/portage/glsa.py| 3 +++ lib/portage/mail.py| 1 + lib/portage/sync/controller.py | 3 ++- lib/portage/util/whirlpool.py | 2 ++ pylintrc | 1 - 10 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/_emerge/EbuildPhase.py b/lib/_emerge/EbuildPhase.py index ceffeccee..e6256d0aa 100644 --- a/lib/_emerge/EbuildPhase.py +++ b/lib/_emerge/EbuildPhase.py @@ -9,12 +9,11 @@ import tempfile from _emerge.AsynchronousLock import AsynchronousLock from _emerge.BinpkgEnvExtractor import BinpkgEnvExtractor -from _emerge.CompositeTask import CompositeTask -from _emerge.EbuildProcess import EbuildProcess from _emerge.MiscFunctionsProcess import MiscFunctionsProcess +from _emerge.EbuildProcess import EbuildProcess +from _emerge.CompositeTask import CompositeTask from _emerge.PackagePhase import PackagePhase from _emerge.TaskSequence import TaskSequence - from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage.util._dyn_libs.soname_deps_qa import ( _get_all_provides, @@ -397,6 +396,7 @@ class EbuildPhase(CompositeTask): fd_pipes=self.fd_pipes, phase=phase, scheduler=self.scheduler, settings=self.settings) self._start_task(clean_phase, self._fail_clean_exit) + return def _fail_clean_exit(self, clean_phase): self._final_exit(clean_phase) diff --git a/lib/_emerge/resolver/output.py b/lib/_emerge/resolver/output.py index b6c77ecad..1dcb47020 100644 --- a/lib/_emerge/resolver/output.py +++ b/lib/_emerge/resolver/output.py @@ -243,6 +243,7 @@ class Display: cur_use_map[key], old_iuse_map[key], old_use_map[key], is_new, feature_flags, reinst_flags_map.get(key)) + return @staticmethod @@ -538,6 +539,7 @@ class Display: if show_repos and repoadd: myprint += " " + teal("[%s]" % repoadd) writemsg_stdout("%s\n" % (myprint,), noiselevel=-1) + return def print_blockers(self): @@ -546,6 +548,7 @@ class Display: """ for pkg in self.blockers: writemsg_stdout("%s\n" % (pkg,), noiselevel=-1) + return def print_verbose(self, show_repos): @@ -559,6 +562,7 @@ class Display: # that RepoDisplay.__unicode__() is called in python2. writemsg_stdout("%s" % (self.conf.repo_display,), noiselevel=-1) + return def print_changelog(self): @@ -683,6 +687,7 @@ class Display: if ebuild_path_cl is not None: self.changelogs.extend(_calc_changelog( ebuild_path_cl, pkg_info.previous_pkg, pkg.cpv)) + return def check_system_world(self, pkg): diff --git a/lib/portage/elog/mod_custom.py b/lib/portage/elog/mod_custom.py index aaf1d3b1b..7cfafeccc 100644 --- a/lib/portage/elog/mod_custom.py +++ b/lib/portage/elog/mod_custom.py @@ -18,3 +18,4 @@ def process(mysettings, key, logentries, fulltext): retval = portage.process.spawn_bash(mylogcmd) if retval != 0: raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval) + return diff --git a/lib/portage/elog/mod_echo.py b/lib/portage/elog/mod_echo.py index a026847b7..80f2b11ac 100644 --- a/lib/portage/elog/mod_echo.py +++ b/lib/portage/elog/mod_echo.py @@ -3,10 +3,9 @@ # Distributed under the terms of the GNU General Public License v2 import sys - +from portage.output import EOutput, colorize from portage.const import EBUILD_PHASES from portage.localization import _ -from portage.output import EOutput, colorize _items = [] @@ -62,3 +61,4 @@ def _finalize(): for line in msgcontent: fmap[msgtype](line.strip("\n")) _items = [] + return diff --git a/lib/portage/elog/mod_mail.py b/lib/portage/elog/mod_mail.py index f737a80ce..38eaa277f 100644 --- a/lib/portage/elog/mod_mail.py +++ b/lib/portage/elog/mod_mail.py @@ -41,3 +41,5 @@ def process(mysettings, key, logentries, fulltext): portage.mail.send_mail(mysettings, mymessage) except PortageException as e: writemsg("%s\n
Re: [gentoo-portage-dev] [PATCH] lib/*: Fix useless-return
On Fri, Aug 07, 2020 at 12:28:04PM -0400, Aaron Bauman wrote: > * Python implies such things. Let's drop 'em and be consistent. > > Signed-off-by: Aaron Bauman > --- > "\\" | 20 > lib/_emerge/EbuildPhase.py | 6 +++--- > lib/_emerge/resolver/output.py | 5 - > lib/portage/elog/mod_custom.py | 1 - > lib/portage/elog/mod_echo.py | 4 ++-- > lib/portage/elog/mod_mail.py | 2 -- > lib/portage/glsa.py| 3 --- > lib/portage/mail.py| 1 - > lib/portage/sync/controller.py | 3 +-- > lib/portage/util/whirlpool.py | 2 -- > pylintrc | 1 + > 11 files changed, 27 insertions(+), 21 deletions(-) > create mode 100644 "\\" > > diff --git "a/\\" "b/\\" > new file mode 100644 > index 0..aaf1d3b1b > --- /dev/null > +++ "b/\\" > @@ -0,0 +1,20 @@ > +# elog/mod_custom.py - elog dispatch module > +# Copyright 2006-2020 Gentoo Authors > +# Distributed under the terms of the GNU General Public License v2 > + > +import portage.elog.mod_save > +import portage.exception > +import portage.process > + > +def process(mysettings, key, logentries, fulltext): > + elogfilename = portage.elog.mod_save.process(mysettings, key, > logentries, fulltext) > + > if not isinstance(source, bytes): > @@ -777,7 +776,6 @@ def processBuffer(ctx): [snip] Please disregard. Sending new patch. -- Cheers, Aaron signature.asc Description: PGP signature
[gentoo-portage-dev] [PATCH] lib/*: Fix useless-return
* Python implies such things. Let's drop 'em and be consistent. Signed-off-by: Aaron Bauman --- "\\" | 20 lib/_emerge/EbuildPhase.py | 6 +++--- lib/_emerge/resolver/output.py | 5 - lib/portage/elog/mod_custom.py | 1 - lib/portage/elog/mod_echo.py | 4 ++-- lib/portage/elog/mod_mail.py | 2 -- lib/portage/glsa.py| 3 --- lib/portage/mail.py| 1 - lib/portage/sync/controller.py | 3 +-- lib/portage/util/whirlpool.py | 2 -- pylintrc | 1 + 11 files changed, 27 insertions(+), 21 deletions(-) create mode 100644 "\\" diff --git "a/\\" "b/\\" new file mode 100644 index 0..aaf1d3b1b --- /dev/null +++ "b/\\" @@ -0,0 +1,20 @@ +# elog/mod_custom.py - elog dispatch module +# Copyright 2006-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +import portage.elog.mod_save +import portage.exception +import portage.process + +def process(mysettings, key, logentries, fulltext): + elogfilename = portage.elog.mod_save.process(mysettings, key, logentries, fulltext) + + if not mysettings.get("PORTAGE_ELOG_COMMAND"): + raise portage.exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined") + else: + mylogcmd = mysettings["PORTAGE_ELOG_COMMAND"] + mylogcmd = mylogcmd.replace("${LOGFILE}", elogfilename) + mylogcmd = mylogcmd.replace("${PACKAGE}", key) + retval = portage.process.spawn_bash(mylogcmd) + if retval != 0: + raise portage.exception.PortageException("!!! PORTAGE_ELOG_COMMAND failed with exitcode %d" % retval) diff --git a/lib/_emerge/EbuildPhase.py b/lib/_emerge/EbuildPhase.py index e6256d0aa..ceffeccee 100644 --- a/lib/_emerge/EbuildPhase.py +++ b/lib/_emerge/EbuildPhase.py @@ -9,11 +9,12 @@ import tempfile from _emerge.AsynchronousLock import AsynchronousLock from _emerge.BinpkgEnvExtractor import BinpkgEnvExtractor -from _emerge.MiscFunctionsProcess import MiscFunctionsProcess -from _emerge.EbuildProcess import EbuildProcess from _emerge.CompositeTask import CompositeTask +from _emerge.EbuildProcess import EbuildProcess +from _emerge.MiscFunctionsProcess import MiscFunctionsProcess from _emerge.PackagePhase import PackagePhase from _emerge.TaskSequence import TaskSequence + from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage.util._dyn_libs.soname_deps_qa import ( _get_all_provides, @@ -396,7 +397,6 @@ class EbuildPhase(CompositeTask): fd_pipes=self.fd_pipes, phase=phase, scheduler=self.scheduler, settings=self.settings) self._start_task(clean_phase, self._fail_clean_exit) - return def _fail_clean_exit(self, clean_phase): self._final_exit(clean_phase) diff --git a/lib/_emerge/resolver/output.py b/lib/_emerge/resolver/output.py index 1dcb47020..b6c77ecad 100644 --- a/lib/_emerge/resolver/output.py +++ b/lib/_emerge/resolver/output.py @@ -243,7 +243,6 @@ class Display: cur_use_map[key], old_iuse_map[key], old_use_map[key], is_new, feature_flags, reinst_flags_map.get(key)) - return @staticmethod @@ -539,7 +538,6 @@ class Display: if show_repos and repoadd: myprint += " " + teal("[%s]" % repoadd) writemsg_stdout("%s\n" % (myprint,), noiselevel=-1) - return def print_blockers(self): @@ -548,7 +546,6 @@ class Display: """ for pkg in self.blockers: writemsg_stdout("%s\n" % (pkg,), noiselevel=-1) - return def print_verbose(self, show_repos): @@ -562,7 +559,6 @@ class Display: # that RepoDisplay.__unicode__() is called in python2. writemsg_stdout("%s" % (self.conf.repo_display,), noiselevel=-1) - return def print_changelog(self): @@ -687,7 +683,6 @@ class Display: if ebuild_path_cl is not None: self.changelogs.extend(_calc_changelog( ebuild_path_cl, pkg_info.previous_pkg, pkg.cpv)) - return def check_system_world(self, pkg): diff --git a/lib/portage/elog/mod_custom.py b/lib/portage/elog/mod_custom.py index 7cfafeccc..aaf1d3b1b 100644 --- a/lib/portage/elog/mod_custom.py +++ b/lib/portage/elog/mod_custom.py @@ -18,4 +18,3 @@
[gentoo-portage-dev] [PATCH] *: drop all import __future__ statements
* We only support Py3 now. Signed-off-by: Aaron Bauman --- bin/archive-conf | 4 +-- bin/check-implicit-pointer-usage.py | 2 -- bin/clean_locks | 4 +-- bin/dispatch-conf | 4 +-- bin/dohtml.py | 4 +-- bin/doins.py | 2 -- bin/ebuild| 4 +-- bin/egencache | 4 +-- bin/emaint| 4 +-- bin/emerge| 4 +-- bin/env-update| 4 +-- bin/fixpackages | 4 +-- bin/glsa-check| 4 +-- bin/portageq | 4 +-- bin/quickpkg | 4 +-- bin/regenworld| 4 +-- lib/_emerge/Scheduler.py | 2 -- lib/_emerge/UserQuery.py | 2 -- lib/_emerge/actions.py| 2 -- lib/_emerge/chk_updated_cfg_files.py | 2 -- lib/_emerge/countdown.py | 4 +-- lib/_emerge/depgraph.py | 2 -- lib/_emerge/help.py | 4 +-- lib/_emerge/main.py | 2 -- lib/_emerge/post_emerge.py| 4 +-- lib/_emerge/resolver/circular_dependency.py | 8 +++--- lib/_emerge/resolver/package_tracker.py | 4 +-- lib/_emerge/resolver/slot_collision.py| 3 +-- lib/_emerge/unmerge.py| 2 -- lib/portage/_emirrordist/FetchTask.py | 2 -- lib/portage/_global_updates.py| 4 +-- lib/portage/_sets/__init__.py | 2 -- lib/portage/_sets/dbapi.py| 2 -- lib/portage/_sets/libs.py | 4 +-- lib/portage/cache/anydbm.py | 5 ++-- lib/portage/cache/sqlite.py | 3 +-- lib/portage/cvstree.py| 2 -- lib/portage/dbapi/vartree.py | 2 -- lib/portage/dispatch_conf.py | 5 +--- lib/portage/elog/mod_echo.py | 4 +-- lib/portage/emaint/main.py| 4 +-- lib/portage/glsa.py | 27 +-- lib/portage/localization.py | 4 +-- lib/portage/metadata.py | 2 -- lib/portage/module.py | 5 +--- lib/portage/news.py | 2 -- lib/portage/output.py | 2 -- lib/portage/package/ebuild/fetch.py | 2 -- lib/portage/sync/controller.py| 3 --- lib/portage/sync/old_tree_timestamp.py| 4 +-- lib/portage/tests/__init__.py | 4 +-- lib/portage/tests/util/test_xattr.py | 4 +-- .../util/_dyn_libs/display_preserved_libs.py | 6 ++--- lib/portage/util/_eventloop/EventLoop.py | 5 +--- .../util/_eventloop/PollSelectAdapter.py | 5 ++-- lib/portage/util/_xattr.py| 4 +-- lib/portage/util/locale.py| 4 +-- lib/portage/util/movefile.py | 2 -- repoman/bin/repoman | 5 ++-- repoman/lib/repoman/actions.py| 4 +-- repoman/lib/repoman/errors.py | 2 -- repoman/lib/repoman/gpg.py| 2 -- repoman/lib/repoman/main.py | 5 ++-- repoman/lib/repoman/metadata.py | 2 -- .../lib/repoman/modules/commit/repochecks.py | 2 -- .../lib/repoman/modules/scan/ebuild/ebuild.py | 3 +-- repoman/lib/repoman/modules/vcs/settings.py | 3 +-- repoman/lib/repoman/modules/vcs/vcs.py| 3 +-- repoman/lib/repoman/profile.py| 2 -- repoman/lib/repoman/scanner.py| 6 ++--- repoman/lib/repoman/tests/__init__.py | 4 +-- repoman/lib/repoman/utilities.py | 4 +-- repoman/runtests | 4 +-- repoman/setup.py | 4 +-- runtests | 4 +-- setup.py | 2 -- 76 files changed, 74 insertions(+), 212 deletions(-) diff --git a/bin/archive-conf b/bin/archive-conf index 8341ffe73..bfc54a629 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -1,5 +1,5 @@ #!/usr/bin/python -b -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @@ -9,8 +9,6 @@ # Jeremy Wohl's dispatch-conf script and the portage chkcontents script. # -from __future__ import print_function - import sys from os import path as osp diff --git a/bin/check-implicit-pointer-usage.py b/bin/check-implicit-pointer-usage.py index 868e4b3c8..3914e038d 100755
[gentoo-portage-dev] [PATCH] lib/*: exempt two core files from ungrouped-imports check
* These will take some time to refactor/address if at all possible. * Turn on ungrouped-imports check for entire repo Signed-off-by: Aaron Bauman --- lib/portage/__init__.py | 1 + lib/portage/checksum.py | 15 --- pylintrc| 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/portage/__init__.py b/lib/portage/__init__.py index 73bb1ed0d..916c93510 100644 --- a/lib/portage/__init__.py +++ b/lib/portage/__init__.py @@ -1,5 +1,6 @@ # Copyright 1998-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# pylint: disable=ungrouped-imports VERSION = "HEAD" diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py index d4a75c058..b5dae9672 100644 --- a/lib/portage/checksum.py +++ b/lib/portage/checksum.py @@ -1,20 +1,21 @@ # checksum.py -- core Portage functionality # Copyright 1998-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +# pylint: disable=ungrouped-imports -import portage -from portage.const import PRELINK_BINARY, HASHING_BLOCKSIZE -from portage.localization import _ -from portage import os -from portage import _encodings -from portage import _unicode_decode, _unicode_encode import errno import functools import hashlib +import portage import stat import subprocess import tempfile +from portage import _encodings, _unicode_decode, _unicode_encode +from portage import os +from portage.const import HASHING_BLOCKSIZE, PRELINK_BINARY +from portage.localization import _ + # Summary of all available hashes and their implementations, # most preferred first. Please keep this in sync with logic below. @@ -32,7 +33,7 @@ import tempfile # SHA3_512: hashlib (3.6+), pysha3, pycrypto -#dict of all available hash functions +# Dict of all available hash functions hashfunc_map = {} hashorigin_map = {} diff --git a/pylintrc b/pylintrc index 9b0975329..f2aadf14f 100644 --- a/pylintrc +++ b/pylintrc @@ -28,6 +28,7 @@ enable= trailing-newlines, trailing-whitespace, unexpected-line-ending-format, +ungrouped-imports, unnecessary-semicolon, unused-import, useless-import-alias, -- 2.28.0
[gentoo-portage-dev] [PATCH] lib/portage/xml/metadata.py: fix ungrouped-imports w/refactor
* This drops the import for cElementTree as it is deprecated. See: https://docs.python.org/3/library/xml.etree.elementtree.html * Drop the error checking as these modules are a part of stdlib. * Additionally, the pyexpat issue was fixed in 3.2. See: https://bugs.python.org/issue14988 Signed-off-by: Aaron Bauman --- lib/portage/xml/metadata.py | 29 - 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/lib/portage/xml/metadata.py b/lib/portage/xml/metadata.py index 646edb5b9..808ba2246 100644 --- a/lib/portage/xml/metadata.py +++ b/lib/portage/xml/metadata.py @@ -31,29 +31,16 @@ __all__ = ('MetaDataXML', 'parse_metadata_use') -try: - import xml.etree.cElementTree as etree -except (SystemExit, KeyboardInterrupt): - raise -except (ImportError, SystemError, RuntimeError, Exception): - # broken or missing xml support - # https://bugs.python.org/issue14988 - import xml.etree.ElementTree as etree - -try: - from xml.parsers.expat import ExpatError -except (SystemExit, KeyboardInterrupt): - raise -except (ImportError, SystemError, RuntimeError, Exception): - ExpatError = SyntaxError - import re -import xml.etree.ElementTree +import xml.etree.ElementTree as etree + +from xml.parsers.expat import ExpatError + from portage import _encodings, _unicode_encode from portage.util import cmp_sort_key, unique_everseen -class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder): +class _MetadataTreeBuilder(etree.TreeBuilder): """ Implements doctype() as required to avoid deprecation warnings with Python >=2.7. @@ -198,8 +185,8 @@ class MetaDataXML: try: self._xml_tree = etree.parse(_unicode_encode(metadata_xml_path, - encoding=_encodings['fs'], errors='strict'), - parser=etree.XMLParser(target=_MetadataTreeBuilder())) + encoding = _encodings['fs'], errors='strict'), + parser = etree.XMLParser(target=_MetadataTreeBuilder())) except ImportError: pass except ExpatError as e: @@ -238,7 +225,7 @@ class MetaDataXML: try: self._herdstree = etree.parse(_unicode_encode(self._herds_path, encoding=_encodings['fs'], errors='strict'), - parser=etree.XMLParser(target=_MetadataTreeBuilder())) + parser = etree.XMLParser(target=_MetadataTreeBuilder())) except (ImportError, IOError, SyntaxError): return None -- 2.28.0
[gentoo-portage-dev] [PATCH] lib/*: Fix ungrouped-imports
* This fixes ungrouped imports for a portion of the repo. The remaining fixes will come in another batch of atomic commits as the imports are buried behind conditionals, are __futures__ that may be able to go away, etc * Per the above, check will not be enabled yet Signed-off-by: Aaron Bauman --- lib/_emerge/FakeVartree.py | 7 +++--- lib/_emerge/FifoIpcDaemon.py| 2 +- lib/_emerge/MetadataRegen.py| 6 +++-- lib/portage/emaint/modules/move/move.py | 6 +++-- lib/portage/metadata.py | 16 +++-- lib/portage/sync/modules/rsync/rsync.py | 31 + lib/portage/util/_async/BuildLogger.py | 4 ++-- 7 files changed, 40 insertions(+), 32 deletions(-) diff --git a/lib/_emerge/FakeVartree.py b/lib/_emerge/FakeVartree.py index 37349bcdd..fa6c17beb 100644 --- a/lib/_emerge/FakeVartree.py +++ b/lib/_emerge/FakeVartree.py @@ -1,12 +1,14 @@ # Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +import portage import warnings -import portage -from portage import os from _emerge.Package import Package from _emerge.PackageVirtualDbapi import PackageVirtualDbapi +from _emerge.resolver.DbapiProvidesIndex import PackageDbapiProvidesIndex + +from portage import os from portage.const import VDB_PATH from portage.dbapi.vartree import vartree from portage.dep._slot_operator import find_built_slot_operator_atoms @@ -14,7 +16,6 @@ from portage.eapi import _get_eapi_attrs from portage.exception import InvalidData, InvalidDependString from portage.update import grab_updates, parse_updates, update_dbentries from portage.versions import _pkg_str -from _emerge.resolver.DbapiProvidesIndex import PackageDbapiProvidesIndex class FakeVardbGetPath: diff --git a/lib/_emerge/FifoIpcDaemon.py b/lib/_emerge/FifoIpcDaemon.py index a21e94db6..22aa6f9fc 100644 --- a/lib/_emerge/FifoIpcDaemon.py +++ b/lib/_emerge/FifoIpcDaemon.py @@ -1,9 +1,9 @@ # Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 +from _emerge.AbstractPollTask import AbstractPollTask from portage import os -from _emerge.AbstractPollTask import AbstractPollTask from portage.cache.mappings import slot_dict_class class FifoIpcDaemon(AbstractPollTask): diff --git a/lib/_emerge/MetadataRegen.py b/lib/_emerge/MetadataRegen.py index 8eb110a46..dc3ef7e57 100644 --- a/lib/_emerge/MetadataRegen.py +++ b/lib/_emerge/MetadataRegen.py @@ -2,10 +2,12 @@ # Distributed under the terms of the GNU General Public License v2 import portage -from portage import os -from portage.dep import _repo_separator + from _emerge.EbuildMetadataPhase import EbuildMetadataPhase + +from portage import os from portage.cache.cache_errors import CacheError +from portage.dep import _repo_separator from portage.util._async.AsyncScheduler import AsyncScheduler class MetadataRegen(AsyncScheduler): diff --git a/lib/portage/emaint/modules/move/move.py b/lib/portage/emaint/modules/move/move.py index e2df53fd8..4d1bb0df1 100644 --- a/lib/portage/emaint/modules/move/move.py +++ b/lib/portage/emaint/modules/move/move.py @@ -1,10 +1,12 @@ -# Copyright 2005-2018 Gentoo Foundation +# Copyright 2005-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage + +from _emerge.Package import Package + from portage import os from portage.exception import InvalidData -from _emerge.Package import Package from portage.versions import _pkg_str class MoveHandler: diff --git a/lib/portage/metadata.py b/lib/portage/metadata.py index 935bcc307..f932c094a 100644 --- a/lib/portage/metadata.py +++ b/lib/portage/metadata.py @@ -1,19 +1,21 @@ +# Copyright 1998-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 from __future__ import print_function -import sys -import signal import logging import operator - import portage -from portage import os +import sys +import signal + +from _emerge.ProgressHandler import ProgressHandler + from portage import eapi_is_supported -from portage.util import writemsg_level +from portage import os from portage.cache.cache_errors import CacheError -from _emerge.ProgressHandler import ProgressHandler from portage.eclass_cache import hashed_path - +from portage.util import writemsg_level def action_metadata(settings, portdb, myopts, porttrees=None): if porttrees is None: diff --git a/lib/portage/sync/modules/rsync/rsync.py b/lib/portage/sync/modules/rsync/rsync.py index cf574208d..50d086a60 100644 --- a/lib/portage/sync/modules/rsync/rsync.py +++ b/lib/portage/sync/modules/rsync/rsync.py @@ -1,31 +1,32 @@ # Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -import sys -import logging -import time -import signal -import socket import datetime import io -import re +import logging +import portage import random +import re
[gentoo-portage-dev] [PATCH] lib/*: fix superfluous-parens and enable check
Signed-off-by: Aaron Bauman --- lib/_emerge/actions.py | 14 +++--- lib/_emerge/resolver/slot_collision.py | 4 ++-- lib/_emerge/stdout_spinner.py| 2 +- lib/_emerge/unmerge.py | 4 ++-- lib/portage/_sets/dbapi.py | 6 +++--- lib/portage/cache/template.py| 2 +- lib/portage/dep/__init__.py | 10 +- lib/portage/dep/dep_check.py | 2 +- lib/portage/getbinpkg.py | 6 +++--- lib/portage/glsa.py | 2 +- lib/portage/localization.py | 2 +- lib/portage/locks.py | 2 +- lib/portage/manifest.py | 2 +- lib/portage/news.py | 4 ++-- lib/portage/package/ebuild/config.py | 2 +- lib/portage/process.py | 6 +++--- lib/portage/sync/controller.py | 4 ++-- lib/portage/sync/modules/rsync/rsync.py | 8 lib/portage/tests/resolver/ResolverPlayground.py | 2 +- lib/portage/util/__init__.py | 4 ++-- lib/portage/util/env_update.py | 2 +- lib/portage/xpak.py | 10 +- pylintrc | 1 + 23 files changed, 51 insertions(+), 50 deletions(-) diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 43e9de43a..7d2d9b315 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -333,7 +333,7 @@ def action_build(emerge_config, trees=DeprecationWarning, return 1 else: - if ("--resume" in myopts): + if "--resume" in myopts: print(darkgreen("emerge: It seems we have nothing to resume...")) return os.EX_OK @@ -450,7 +450,7 @@ def action_build(emerge_config, trees=DeprecationWarning, myopts.pop("--ask", None) if ("--pretend" in myopts) and not ("--fetchonly" in myopts or "--fetch-all-uri" in myopts): - if ("--resume" in myopts): + if "--resume" in myopts: mymergelist = mydepgraph.altlist() if len(mymergelist) == 0: print(colorize("INFORM", "emerge: It seems we have nothing to resume...")) @@ -522,7 +522,7 @@ def action_build(emerge_config, trees=DeprecationWarning, level=logging.ERROR, noiselevel=-1) return 1 - if ("--resume" in myopts): + if "--resume" in myopts: favorites=mtimedb["resume"]["favorites"] else: @@ -2319,7 +2319,7 @@ def adjust_config(myopts, settings): settings.backup_changes("PORTAGE_VERBOSE") # Set so that configs will be merged regardless of remembered status - if ("--noconfmem" in myopts): + if "--noconfmem" in myopts: settings["NOCONFMEM"]="1" settings.backup_changes("NOCONFMEM") @@ -2424,7 +2424,7 @@ def getportageversion(portdir, _unused, profile, chost, vardb): if profilever is None: try: profilever = "!" + os.readlink(profile) - except (OSError): + except OSError: pass if profilever is None: @@ -3057,7 +3057,7 @@ def run_action(emerge_config): level=logging.ERROR, noiselevel=-1) return 1 - if ("--quiet" in emerge_config.opts): + if "--quiet" in emerge_config.opts: spinner.update = spinner.update_quiet portage.util.noiselimit = -1 @@ -3085,7 +3085,7 @@ def run_action(emerge_config): if "python-trace" in emerge_config.target_config.settings.features: portage.debug.set_trace(True) - if not ("--quiet" in emerge_config.opts): + if not "--quiet" in emerge_config.opts: if '--nospinner' in emerge_config.opts or \ emerge_config.target_config.settings.get('TERM') == 'dumb' or \ not sys.stdout.isatty(): diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py index 7536ce7a2..df3816717 100644 --- a/lib/_emerge/resolver/slot_collision.py +++ b/lib/_emerge/resolver
[gentoo-portage-dev] [PATCH 5/6] tabcheck.py: fix multiple-imports
Signed-off-by: Aaron Bauman --- tabcheck.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tabcheck.py b/tabcheck.py index a28ad93d9..1df26785d 100755 --- a/tabcheck.py +++ b/tabcheck.py @@ -1,6 +1,7 @@ #!/usr/bin/python -b -import tabnanny,sys +import sys +import tabnanny for x in sys.argv: tabnanny.check(x) -- 2.28.0
[gentoo-portage-dev] [PATCH 6/6] pylintrc: enable multiple-imports check
Signed-off-by: Aaron Bauman --- pylintrc | 1 + 1 file changed, 1 insertion(+) diff --git a/pylintrc b/pylintrc index b7091516c..5f4ec3278 100644 --- a/pylintrc +++ b/pylintrc @@ -19,6 +19,7 @@ enable= misplaced-future, missing-final-newline, mixed-line-endings, +multiple-imports, redefined-builtin, reimported, relative-beyond-top-level, -- 2.28.0
[gentoo-portage-dev] [PATCH 2/6] lib/portage/elog/mod_custom.py: fix multiple-imports
Signed-off-by: Aaron Bauman --- lib/portage/elog/mod_custom.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/portage/elog/mod_custom.py b/lib/portage/elog/mod_custom.py index 836bdad62..7cfafeccc 100644 --- a/lib/portage/elog/mod_custom.py +++ b/lib/portage/elog/mod_custom.py @@ -2,7 +2,9 @@ # Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -import portage.elog.mod_save, portage.process, portage.exception +import portage.elog.mod_save +import portage.exception +import portage.process def process(mysettings, key, logentries, fulltext): elogfilename = portage.elog.mod_save.process(mysettings, key, logentries, fulltext) -- 2.28.0
[gentoo-portage-dev] [PATCH 4/6] lib/portage/dep/__init__.py: fix multiple-imports
Signed-off-by: Aaron Bauman --- lib/portage/dep/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 50266a21b..c0ed2dd3c 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -13,8 +13,10 @@ __all__ = [ '_repo_separator', '_slot_separator', ] -import re, sys +import re +import sys import warnings + from functools import lru_cache import portage -- 2.28.0
[gentoo-portage-dev] [PATCH 3/6] lib/portage/tests/runTests.py: fix multiple-imports
Signed-off-by: Aaron Bauman --- lib/portage/tests/runTests.py | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/runTests.py b/lib/portage/tests/runTests.py index d4d1f7c76..9514abebe 100755 --- a/lib/portage/tests/runTests.py +++ b/lib/portage/tests/runTests.py @@ -1,14 +1,15 @@ #!/usr/bin/python -bWd # runTests.py -- Portage Unit Test Functionality -# Copyright 2006-2014 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -import os, sys -import os.path as osp import grp +import os +import os.path as osp import platform import pwd import signal +import sys def debug_signal(signum, frame): import pdb -- 2.28.0
[gentoo-portage-dev] [PATCH 1/6] lib/portage/elog/mod_mail.py: fix multiple-imports
Signed-off-by: Aaron Bauman --- lib/portage/elog/mod_mail.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/portage/elog/mod_mail.py b/lib/portage/elog/mod_mail.py index 4edf507eb..38eaa277f 100644 --- a/lib/portage/elog/mod_mail.py +++ b/lib/portage/elog/mod_mail.py @@ -2,7 +2,9 @@ # Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -import portage.mail, socket +import portage.mail +import socket + from portage.exception import PortageException from portage.localization import _ from portage.util import writemsg -- 2.28.0
[gentoo-portage-dev] [PATCH] lib/portage/repository/config.py: fix trailing-comma-tuple
* This fixes the one instance of trailing-comma-tuple in the repo * A tuple does need created, but lets do so inside of parentheses as expected Suggested-By: Sam James Suggested-By: Zac Medico Signed-off-by: Aaron Bauman --- lib/portage/repository/config.py | 2 +- pylintrc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py index 0f3e582f8..f7c956dd8 100644 --- a/lib/portage/repository/config.py +++ b/lib/portage/repository/config.py @@ -871,7 +871,7 @@ class RepoConfigLoader: continue if repo.masters is None: if self.mainRepo() and repo_name != self.mainRepo().name: - repo.masters = self.mainRepo(), + repo.masters = (self.mainRepo(),) else: repo.masters = () else: diff --git a/pylintrc b/pylintrc index 337311daa..5e13f714c 100644 --- a/pylintrc +++ b/pylintrc @@ -21,7 +21,8 @@ enable= redefined-builtin, reimported, relative-beyond-top-level, -trailing-newlines, +trailing-comma-tuple, + trailing-newlines, trailing-whitespace, unexpected-line-ending-format, unnecessary-semicolon, -- 2.28.0
Re: [gentoo-portage-dev] [PATCH 1/2] lib/portage/repository/config.py: fix trailing comma
On Tue, Aug 04, 2020 at 09:43:03PM -0400, Aaron Bauman wrote: > * This fixes the one instance of a trailing comma in the repo which > actually causes a tuple to be created. > > Signed-off-by: Aaron Bauman > --- > lib/portage/repository/config.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/portage/repository/config.py > b/lib/portage/repository/config.py > index 0f3e582f8..f4dd834b5 100644 > --- a/lib/portage/repository/config.py > +++ b/lib/portage/repository/config.py > @@ -871,7 +871,7 @@ class RepoConfigLoader: > continue > if repo.masters is None: > if self.mainRepo() and repo_name != > self.mainRepo().name: > - repo.masters = self.mainRepo(), > + repo.masters = self.mainRepo() > else: > repo.masters = () > else: > -- > 2.28.0 > > Please disregard this patch series. -- Cheers, Aaron signature.asc Description: PGP signature
[gentoo-portage-dev] [PATCH 2/2] pylintrc: turn on trailing commas check
Signed-off-by: Aaron Bauman --- pylintrc | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pylintrc b/pylintrc index 337311daa..d651cd1ee 100644 --- a/pylintrc +++ b/pylintrc @@ -13,15 +13,16 @@ #disable=no-absolute-import,bad-continuation,C0103,C0114,C0115,E1101,W0201,no-name-in-module disable=all enable= -cyclic-import, + cyclic-import, import-self, misplaced-future, missing-final-newline, mixed-line-endings, -redefined-builtin, + redefined-builtin, reimported, relative-beyond-top-level, -trailing-newlines, + trailing-comma-tuple, + trailing-newlines, trailing-whitespace, unexpected-line-ending-format, unnecessary-semicolon, -- 2.28.0
[gentoo-portage-dev] [PATCH 1/2] lib/portage/repository/config.py: fix trailing comma
* This fixes the one instance of a trailing comma in the repo which actually causes a tuple to be created. Signed-off-by: Aaron Bauman --- lib/portage/repository/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/repository/config.py b/lib/portage/repository/config.py index 0f3e582f8..f4dd834b5 100644 --- a/lib/portage/repository/config.py +++ b/lib/portage/repository/config.py @@ -871,7 +871,7 @@ class RepoConfigLoader: continue if repo.masters is None: if self.mainRepo() and repo_name != self.mainRepo().name: - repo.masters = self.mainRepo(), + repo.masters = self.mainRepo() else: repo.masters = () else: -- 2.28.0
[gentoo-portage-dev] [PATCH] DEVELOPING: Update minimum python version
* Other style/readability fixes Signed-off-by: Aaron Bauman --- DEVELOPING | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/DEVELOPING b/DEVELOPING index 31b559402..7bc559125 100644 --- a/DEVELOPING +++ b/DEVELOPING @@ -1,17 +1,15 @@ Code Guidelines --- + A few code guidelines to try to stick to, please comment if none of these make sense, they are pretty basic and mostly apply to old code. -However for people who are looking at current code, they make take up +However for people who are looking at current code, they may take up bad habits that exist in the current codebase. Python Version -- -Python 2.7 is the minimum supported version as it eases 3.x compatibility. -All exception handling should use Python 3 'except' syntax, and the print -function should be used instead of Python 2's print statement (use "from -__future__ import print_function" everywhere). +Python 3.6 is the minimum supported version. Dependencies @@ -30,7 +28,7 @@ width. Line-Wrapping - -Lines should typically not be longer than 80 characters; if they are an +Lines should typically not be longer than 80 characters; if they are, an attempt should be made to wrap them. Move code to the line below and indent once (\t). @@ -47,7 +45,7 @@ errors.append(MalformedMetadata( attr='DESCRIPTION.toolong') The mixing of tabs and spaces means other developers can't read what you -did. This is why the python peps state spaces over tabs; because with +did. This is why the Python PEPs state spaces over tabs; because with spaces the line wrapping is always clear (but you cannot convert spaces as easily as tabwidth). @@ -189,12 +187,18 @@ at 72. Prefix the message with the component you touched if this makes sense. Postfix the message with the bug it fixes, if it does. Feel free to use the following notes (if applicable): + Signed-off-by: Wrote (a substantial portion of) the patch + Reviewed-by: Reviewed the patch thoroughly + Tested-by: Tested the patch thoroughly + Acked-by: Approved the concept but did not read the patch in detail (typically used by the maintainer of a specific portion, or a lead) + Suggested-by: Designed the implementation + Requested-by: Reported the bug/made the feature request Example: -- 2.28.0
[gentoo-portage-dev] [PATCH] pylintrc: add more module checks
* Repo is already clear... so let's turn these on Signed-off-by: Aaron Bauman --- pylintrc | 25 - 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/pylintrc b/pylintrc index ad32f70d7..cd76d38dd 100644 --- a/pylintrc +++ b/pylintrc @@ -13,16 +13,23 @@ #disable=no-absolute-import,bad-continuation,C0103,C0114,C0115,E1101,W0201,no-name-in-module disable=all enable= - missing-final-newline, - mixed-line-endings, - redefined-builtin, - reimported, +cyclic-import, +import-error, + import-self, +misplaced-future, +missing-final-newline, +mixed-line-endings, +redefined-builtin, +reimported, +relative-beyond-top-level, trailing-newlines, - trailing-whitespace, - unexpected-line-ending-format, - unnecessary-semicolon, - unused-import, - useless-object-inheritance +trailing-whitespace, +unexpected-line-ending-format, +unnecessary-semicolon, +unused-import, +useless-import-alias, +useless-object-inheritance, +wildcard-import # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may -- 2.28.0
[gentoo-portage-dev] [PATCH 2/4] lib/portage/dbapi/vartree.py: fix reimported
Signed-off-by: Aaron Bauman --- lib/portage/dbapi/vartree.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index fcf164e82..fbf455363 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -1619,7 +1619,6 @@ class dblink: At present this is implemented as a text backend in /var/db/pkg. """ - import re _normalize_needed = re.compile(r'//|^[^/]|./$|(^|/)\.\.?(/|$)') _contents_re = re.compile(r'^(' + \ -- 2.28.0
[gentoo-portage-dev] [PATCH 1/4] pylintrc: turn on checks for reimported modules
* also, really fix the enable module structure Signed-off-by: Aaron Bauman --- pylintrc | 20 +++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pylintrc b/pylintrc index 690941715..ad32f70d7 100644 --- a/pylintrc +++ b/pylintrc @@ -12,15 +12,17 @@ # --disable=W". #disable=no-absolute-import,bad-continuation,C0103,C0114,C0115,E1101,W0201,no-name-in-module disable=all -enable=missing-final-newline, - mixed-line-endings, - redefined-builtin, - trailing-newlines, - trailing-whitespace, - unexpected-line-ending-format, - unnecessary-semicolon, - unused-import, - useless-object-inheritance +enable= + missing-final-newline, + mixed-line-endings, + redefined-builtin, + reimported, + trailing-newlines, + trailing-whitespace, + unexpected-line-ending-format, + unnecessary-semicolon, + unused-import, + useless-object-inheritance # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may -- 2.28.0
[gentoo-portage-dev] [PATCH 3/4] lib/_emerge/search.py: fix reimported
* The bold module is imported twice. Once as 'bold' and again as 'white. Remove the duplication and fix the one reference to 'white' Signed-off-by: Aaron Bauman --- lib/_emerge/search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/search.py b/lib/_emerge/search.py index a4ad74311..a59191c1a 100644 --- a/lib/_emerge/search.py +++ b/lib/_emerge/search.py @@ -9,7 +9,7 @@ from portage.dbapi.porttree import _parse_uri_map from portage.dbapi.IndexedPortdb import IndexedPortdb from portage.dbapi.IndexedVardb import IndexedVardb from portage.localization import localized_size -from portage.output import bold, bold as white, darkgreen, green, red +from portage.output import bold, darkgreen, green, red from portage.util import writemsg_stdout from portage.util.iterators.MultiIterGroupBy import MultiIterGroupBy @@ -413,7 +413,7 @@ class search: if masked: msg.append(green("*") + " " + \ - white(match) + " " + red("[ Masked ]") + "\n") + bold(match) + " " + red("[ Masked ]") + "\n") else: msg.append(green("*") + " " + bold(match) + "\n") myversion = self.getVersion(full_package, search.VERSION_RELEASE) -- 2.28.0
[gentoo-portage-dev] [PATCH 4/4] lib/portage/util/socks5.py: fix reimport
* This drops the internal class import of the asyncio module. It is not available in all supported Python versions. Suggested-by: Zac Medico Signed-off-by: Aaron Bauman --- lib/portage/util/socks5.py | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lib/portage/util/socks5.py b/lib/portage/util/socks5.py index c0657ae2a..65d2400e8 100644 --- a/lib/portage/util/socks5.py +++ b/lib/portage/util/socks5.py @@ -1,5 +1,5 @@ # SOCKSv5 proxy manager for network-sandbox -# Copyright 2015-2019 Gentoo Authors +# Copyright 2015-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import errno @@ -14,7 +14,6 @@ from portage.process import atexit_register, spawn from portage.util.futures.compat_coroutine import coroutine from portage.util.futures import asyncio - class ProxyManager: """ A class to start and control a single running SOCKSv5 server process @@ -33,10 +32,6 @@ class ProxyManager: paths) @type settings: portage.config """ - try: - import asyncio # NOQA - except ImportError: - raise NotImplementedError('SOCKSv5 proxy requires asyncio module') tmpdir = os.path.join(settings['PORTAGE_TMPDIR'], 'portage') ensure_dirs_kwargs = {} -- 2.28.0
[gentoo-portage-dev] [PATCH 2/4] lib/portage/emaint/modules/merges/merges.py: fix unnecessary-semicolon
Signed-off-by: Aaron Bauman --- lib/portage/emaint/modules/merges/merges.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/emaint/modules/merges/merges.py b/lib/portage/emaint/modules/merges/merges.py index a2b70edb8..775dc59d2 100644 --- a/lib/portage/emaint/modules/merges/merges.py +++ b/lib/portage/emaint/modules/merges/merges.py @@ -1,4 +1,4 @@ -# Copyright 2005-2014 Gentoo Foundation +# Copyright 2005-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage @@ -93,7 +93,7 @@ class MergesHandler: def __init__(self): """Create MergesHandler object.""" eroot = portage.settings['EROOT'] - tracking_path = os.path.join(eroot, PRIVATE_PATH, 'failed-merges'); + tracking_path = os.path.join(eroot, PRIVATE_PATH, 'failed-merges') self._tracking_file = TrackingFile(tracking_path) self._vardb_path = os.path.join(eroot, VDB_PATH) -- 2.28.0
[gentoo-portage-dev] [PATCH 1/4] lib/portage/output.py: fix unnecessary-semicolon
Signed-off-by: Aaron Bauman --- lib/portage/output.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/output.py b/lib/portage/output.py index ab99caf98..098285a52 100644 --- a/lib/portage/output.py +++ b/lib/portage/output.py @@ -231,7 +231,7 @@ def _parse_color_map(config_root='/', onerror=None): raise def nc_len(mystr): - tmp = re.sub(esc_seq + "^m]+m", "", mystr); + tmp = re.sub(esc_seq + "^m]+m", "", mystr) return len(tmp) _legal_terms_re = re.compile(r'^(xterm|xterm-color|Eterm|aterm|rxvt|screen|kterm|rxvt-unicode|gnome|interix|tmux|st-256color|alacritty|konsole)') -- 2.28.0
[gentoo-portage-dev] [PATCH 3/4] lib/portage/util/env_update.py: fix unnecessary-semicolon
Signed-off-by: Aaron Bauman --- lib/portage/util/env_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py index 9c6fe3cdd..7a2ee2551 100644 --- a/lib/portage/util/env_update.py +++ b/lib/portage/util/env_update.py @@ -213,7 +213,7 @@ def _env_update(makelinks, target_root, prev_mtimes, contents, env, newprelink.write("# contents of /etc/env.d directory\n") for x in sorted(potential_lib_dirs) + ['bin', 'sbin']: - newprelink.write('-l /%s\n' % (x,)); + newprelink.write('-l /%s\n' % (x,)) prelink_paths = set() prelink_paths |= set(specials.get('LDPATH', [])) prelink_paths |= set(specials.get('PATH', [])) -- 2.28.0
[gentoo-portage-dev] [PATCH 4/4] pylintrc: enable more checks
* These checks are already passing... so let's enable them so we do not have regressions * Sort the checks alphabetically and break into more manageable structure * Display all warnings/errors from pylint by enabling all messages as all listed checks are now passing. This will allow folks to run 'pylint' without having to modify the pylintrc. Signed-off-by: Aaron Bauman --- pylintrc | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pylintrc b/pylintrc index 7fd05f322..1f6867d21 100644 --- a/pylintrc +++ b/pylintrc @@ -12,7 +12,15 @@ # --disable=W". #disable=no-absolute-import,bad-continuation,C0103,C0114,C0115,E1101,W0201,no-name-in-module disable=all -enable=redefined-builtin,useless-object-inheritance,trailing-newlines,unused-import,trailing-whitespace +enable=missing-final-newline, + mixed-line-endings, + redefined-builtin, + trailing-newlines, + trailing-whitespace, + unexpected-line-ending-format, + unnecessary-semicolon, + useless-object-inheritance, + unused-import # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may @@ -51,7 +59,7 @@ unsafe-load-any-extension=no # Only show warnings with the listed confidence levels. Leave empty to show # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. -confidence=HIGH +confidence= [REPORTS] -- 2.28.0
[gentoo-portage-dev] [PATCH 68/68] pylintrc: turn on trailing-whitespace
Signed-off-by: Aaron Bauman --- pylintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylintrc b/pylintrc index 6f0eef386..7fd05f322 100644 --- a/pylintrc +++ b/pylintrc @@ -12,7 +12,7 @@ # --disable=W". #disable=no-absolute-import,bad-continuation,C0103,C0114,C0115,E1101,W0201,no-name-in-module disable=all -enable=redefined-builtin,useless-object-inheritance,trailing-newlines,unused-import +enable=redefined-builtin,useless-object-inheritance,trailing-newlines,unused-import,trailing-whitespace # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may -- 2.28.0
[gentoo-portage-dev] [PATCH 67/68] lib/portage/cache/fs_template.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/cache/fs_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/cache/fs_template.py b/lib/portage/cache/fs_template.py index 64050f439..37aac7e42 100644 --- a/lib/portage/cache/fs_template.py +++ b/lib/portage/cache/fs_template.py @@ -15,7 +15,7 @@ del lazyimport class FsBased(template.database): - """template wrapping fs needed options, and providing _ensure_access as a way to + """template wrapping fs needed options, and providing _ensure_access as a way to attempt to ensure files have the specified owners/perms""" def __init__(self, *args, **config): -- 2.28.0
[gentoo-portage-dev] [PATCH 62/68] lib/portage/tests/resolver/test_old_dep_chain_display.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/resolver/test_old_dep_chain_display.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/resolver/test_old_dep_chain_display.py b/lib/portage/tests/resolver/test_old_dep_chain_display.py index 8aedf5999..7ab21e8e9 100644 --- a/lib/portage/tests/resolver/test_old_dep_chain_display.py +++ b/lib/portage/tests/resolver/test_old_dep_chain_display.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -8,8 +8,8 @@ class OldDepChainDisplayTestCase(TestCase): def testOldDepChainDisplay(self): ebuilds = { - "dev-libs/A-1": { "DEPEND": "foo? ( dev-libs/B[-bar] )", "IUSE": "+foo", "EAPI": "2" }, - "dev-libs/A-2": { "DEPEND": "foo? ( dev-libs/C )", "IUSE": "+foo", "EAPI": "1" }, + "dev-libs/A-1": { "DEPEND": "foo? ( dev-libs/B[-bar] )", "IUSE": "+foo", "EAPI": "2" }, + "dev-libs/A-2": { "DEPEND": "foo? ( dev-libs/C )", "IUSE": "+foo", "EAPI": "1" }, "dev-libs/B-1": { "IUSE": "bar", "DEPEND": "!bar? ( dev-libs/D[-baz] )", "EAPI": "2" }, "dev-libs/C-1": { "KEYWORDS": "~x86" }, "dev-libs/D-1": { "IUSE": "+baz", "EAPI": "1" }, -- 2.28.0
[gentoo-portage-dev] [PATCH 64/68] lib/_emerge/search.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/_emerge/search.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/search.py b/lib/_emerge/search.py index 000c427e0..a4ad74311 100644 --- a/lib/_emerge/search.py +++ b/lib/_emerge/search.py @@ -1,4 +1,4 @@ -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import difflib @@ -333,7 +333,7 @@ class search: match_string = setname else: match_string = setname.split("/")[-1] - + if self.searchre.search(match_string): yield ("set", setname) elif self.searchdesc: -- 2.28.0
[gentoo-portage-dev] [PATCH 60/68] lib/_emerge/BinpkgEnvExtractor.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/_emerge/BinpkgEnvExtractor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_emerge/BinpkgEnvExtractor.py b/lib/_emerge/BinpkgEnvExtractor.py index 5ba14955d..b19586e83 100644 --- a/lib/_emerge/BinpkgEnvExtractor.py +++ b/lib/_emerge/BinpkgEnvExtractor.py @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import errno @@ -36,7 +36,7 @@ class BinpkgEnvExtractor(CompositeTask): extractor_proc = SpawnProcess( args=[BASH_BINARY, "-c", shell_cmd], background=self.background, - env=self.settings.environ(), + env=self.settings.environ(), scheduler=self.scheduler, logfile=self.settings.get('PORTAGE_LOG_FILE')) -- 2.28.0
[gentoo-portage-dev] [PATCH 49/68] lib/portage/tests/xpak/test_decodeint.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/xpak/test_decodeint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/xpak/test_decodeint.py b/lib/portage/tests/xpak/test_decodeint.py index 2da573598..5eb82410c 100644 --- a/lib/portage/tests/xpak/test_decodeint.py +++ b/lib/portage/tests/xpak/test_decodeint.py @@ -1,5 +1,5 @@ # xpak/test_decodeint.py -# Copright Gentoo Foundation 2006 +# Copyright 2006-2020 Gentoo Authors # Portage Unit Testing Functionality from portage.tests import TestCase @@ -8,7 +8,7 @@ from portage.xpak import decodeint, encodeint class testDecodeIntTestCase(TestCase): def testDecodeInt(self): - + for n in range(1000): self.assertEqual(decodeint(encodeint(n)), n) -- 2.28.0
[gentoo-portage-dev] [PATCH 54/68] lib/portage/tests/ebuild/test_config.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/ebuild/test_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/ebuild/test_config.py b/lib/portage/tests/ebuild/test_config.py index 60f3ecab4..a48f1329f 100644 --- a/lib/portage/tests/ebuild/test_config.py +++ b/lib/portage/tests/ebuild/test_config.py @@ -1,4 +1,4 @@ -# Copyright 2010-2015 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import io @@ -85,7 +85,7 @@ class ConfigTestCase(TestCase): "package.license": ( "dev-libs/* TEST", - "dev-libs/A -TEST2", + "dev-libs/A -TEST2", "=dev-libs/A-2 TEST3 @TEST", "*/* @EULA TEST2", "=dev-libs/C-1 *", -- 2.28.0
[gentoo-portage-dev] [PATCH 65/68] lib/portage/cache/mappings.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/cache/mappings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/cache/mappings.py b/lib/portage/cache/mappings.py index 5933981b9..93764e5b8 100644 --- a/lib/portage/cache/mappings.py +++ b/lib/portage/cache/mappings.py @@ -1,4 +1,4 @@ -# Copyright: 2005-2019 Gentoo Authors +# Copyright: 2005-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Author(s): Brian Harring (ferri...@gentoo.org) @@ -212,7 +212,7 @@ class ProtectedDict(MutableMapping): self.blacklist[key] = True return raise KeyError(key) - + def __iter__(self): for k in self.new: -- 2.28.0
[gentoo-portage-dev] [PATCH 50/68] lib/portage/_sets/shell.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/shell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/_sets/shell.py b/lib/portage/_sets/shell.py index 2c95845c8..8bea9fd63 100644 --- a/lib/portage/_sets/shell.py +++ b/lib/portage/_sets/shell.py @@ -1,4 +1,4 @@ -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import subprocess @@ -30,7 +30,7 @@ class CommandOutputSet(PackageSet): super(CommandOutputSet, self).__init__() self._command = command self.description = "Package set generated from output of '%s'" % self._command - + def load(self): pipe = subprocess.Popen(self._command, stdout=subprocess.PIPE, shell=True) stdout, stderr = pipe.communicate() -- 2.28.0
[gentoo-portage-dev] [PATCH 48/68] lib/_emerge/resolver/output_helpers.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/_emerge/resolver/output_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/_emerge/resolver/output_helpers.py b/lib/_emerge/resolver/output_helpers.py index 25aa925b4..932e66e1b 100644 --- a/lib/_emerge/resolver/output_helpers.py +++ b/lib/_emerge/resolver/output_helpers.py @@ -588,7 +588,7 @@ class PkgInfo: """Simple class to hold instance attributes for current information about the pkg being printed. """ - + __slots__ = ("attr_display", "built", "cp", "ebuild_path", "fetch_symbol", "merge", "oldbest", "oldbest_list", "operation", "ordered", "previous_pkg", -- 2.28.0
[gentoo-portage-dev] [PATCH 46/68] lib/portage/tests/resolver/test_simple.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/resolver/test_simple.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_simple.py b/lib/portage/tests/resolver/test_simple.py index 324ffa2a6..b457b9d7a 100644 --- a/lib/portage/tests/resolver/test_simple.py +++ b/lib/portage/tests/resolver/test_simple.py @@ -1,4 +1,4 @@ -# Copyright 2010-2012 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -8,7 +8,7 @@ class SimpleResolverTestCase(TestCase): def testSimple(self): ebuilds = { - "dev-libs/A-1": { "KEYWORDS": "x86" }, + "dev-libs/A-1": { "KEYWORDS": "x86" }, "dev-libs/A-2": { "KEYWORDS": "~x86" }, "dev-libs/B-1.2": {}, -- 2.28.0
[gentoo-portage-dev] [PATCH 56/68] lib/portage/cache/template.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/cache/template.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/cache/template.py b/lib/portage/cache/template.py index 509f8a2dc..c8351a924 100644 --- a/lib/portage/cache/template.py +++ b/lib/portage/cache/template.py @@ -29,7 +29,7 @@ class database: self.readonly = readonly self.sync_rate = 0 self.updates = 0 - + def __getitem__(self, cpv): """set a cpv to values This shouldn't be overriden in derived classes since it handles the __eclasses__ conversion. @@ -255,7 +255,7 @@ class database: """generic function for walking the entire cache db, matching restrictions to filter what cpv's are returned. Derived classes should override this if they can implement a faster method then pulling each cpv:values, and checking it. - + For example, RDBMS derived classes should push the matching logic down to the actual RDBM.""" -- 2.28.0
[gentoo-portage-dev] [PATCH 63/68] lib/portage/tests/emerge/test_simple.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/emerge/test_simple.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/tests/emerge/test_simple.py b/lib/portage/tests/emerge/test_simple.py index e8144c55f..94b3076c1 100644 --- a/lib/portage/tests/emerge/test_simple.py +++ b/lib/portage/tests/emerge/test_simple.py @@ -339,7 +339,7 @@ call_has_and_best_version() { emerge_cmd + ("--oneshot", "--usepkg", "dev-libs/B",), # trigger clean prior to pkg_pretend as in bug #390711 - ebuild_cmd + (test_ebuild, "unpack"), + ebuild_cmd + (test_ebuild, "unpack"), emerge_cmd + ("--oneshot", "dev-libs/A",), emerge_cmd + ("--noreplace", "dev-libs/A",), -- 2.28.0
[gentoo-portage-dev] [PATCH 47/68] lib/portage/cache/sqlite.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/cache/sqlite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/cache/sqlite.py b/lib/portage/cache/sqlite.py index 02bf3fcde..3a372bcfc 100644 --- a/lib/portage/cache/sqlite.py +++ b/lib/portage/cache/sqlite.py @@ -33,7 +33,7 @@ class database(fs_template.FsBased): self._allowed_keys_set = frozenset(self._allowed_keys) self._allowed_keys = sorted(self._allowed_keys_set) - self.location = os.path.join(self.location, + self.location = os.path.join(self.location, self.label.lstrip(os.path.sep).rstrip(os.path.sep)) if not self.readonly and not os.path.exists(self.location): @@ -105,7 +105,7 @@ class database(fs_template.FsBased): table_parameters.append("UNIQUE(%s)" % self._db_table["packages"]["package_key"]) create_statement.append(",".join(table_parameters)) create_statement.append(")") - + self._db_table["packages"]["create"] = " ".join(create_statement) cursor = self._db_cursor -- 2.28.0
[gentoo-portage-dev] [PATCH 66/68] lib/portage/dbapi/virtual.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/dbapi/virtual.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/dbapi/virtual.py b/lib/portage/dbapi/virtual.py index f62fc2a30..4ed0dea1b 100644 --- a/lib/portage/dbapi/virtual.py +++ b/lib/portage/dbapi/virtual.py @@ -1,4 +1,4 @@ -# Copyright 1998-2013 Gentoo Foundation +# Copyright 1998-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.dbapi import dbapi @@ -214,7 +214,7 @@ class fakedbapi(dbapi): class testdbapi: """A dbapi instance with completely fake functions to get by hitting disk - TODO(antarus): + TODO(antarus): This class really needs to be rewritten to have better stubs; but these work for now. The dbapi classes themselves need unit tests...and that will be a lot of work. """ -- 2.28.0
[gentoo-portage-dev] [PATCH 42/68] lib/portage/cache/flat_hash.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/cache/flat_hash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/cache/flat_hash.py b/lib/portage/cache/flat_hash.py index 7d5b44511..7d48bae81 100644 --- a/lib/portage/cache/flat_hash.py +++ b/lib/portage/cache/flat_hash.py @@ -22,7 +22,7 @@ class database(fs_template.FsBased): def __init__(self, *args, **config): super(database,self).__init__(*args, **config) - self.location = os.path.join(self.location, + self.location = os.path.join(self.location, self.label.lstrip(os.path.sep).rstrip(os.path.sep)) write_keys = set(self._known_keys) write_keys.add("_eclasses_") -- 2.28.0
[gentoo-portage-dev] [PATCH 51/68] lib/portage/_sets/files.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/_sets/files.py b/lib/portage/_sets/files.py index 57e5aa34f..6a7eb828b 100644 --- a/lib/portage/_sets/files.py +++ b/lib/portage/_sets/files.py @@ -174,7 +174,7 @@ class StaticFileSet(EditablePackageSet): greedy=greedy, dbapi=trees["vartree"].dbapi) return rValue multiBuilder = classmethod(multiBuilder) - + class ConfigFileSet(PackageSet): def __init__(self, filename): super(ConfigFileSet, self).__init__() -- 2.28.0
[gentoo-portage-dev] [PATCH 61/68] lib/portage/util/_dyn_libs/LinkageMapELF.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/util/_dyn_libs/LinkageMapELF.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/util/_dyn_libs/LinkageMapELF.py b/lib/portage/util/_dyn_libs/LinkageMapELF.py index 954a956c6..930d78587 100644 --- a/lib/portage/util/_dyn_libs/LinkageMapELF.py +++ b/lib/portage/util/_dyn_libs/LinkageMapELF.py @@ -144,7 +144,7 @@ class LinkageMapELF: _unicode_encode(obj, encoding=_encodings['merge'], errors='strict') except UnicodeEncodeError: - # The package appears to have been merged with a + # The package appears to have been merged with a # different value of sys.getfilesystemencoding(), # so fall back to utf_8 if appropriate. try: @@ -249,7 +249,7 @@ class LinkageMapELF: if can_lock: self._dbapi.unlock() - # have to call scanelf for preserved libs here as they aren't + # have to call scanelf for preserved libs here as they aren't # registered in NEEDED.ELF.2 files plibs = {} if preserve_paths is not None: -- 2.28.0
[gentoo-portage-dev] [PATCH 59/68] lib/portage/update.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/update.py b/lib/portage/update.py index 07e977452..f11b14217 100644 --- a/lib/portage/update.py +++ b/lib/portage/update.py @@ -179,7 +179,7 @@ def grab_updates(updpath, prev_mtimes=None): mylist = [myfile for myfile in mylist if len(myfile) == 7 and myfile[1:3] == "Q-"] if len(mylist) == 0: return [] - + # sort by (year, quarter) mylist.sort(key=lambda x: (x[3:], x[:2])) -- 2.28.0
[gentoo-portage-dev] [PATCH 52/68] lib/portage/tests/env/config/test_PackageMaskFile.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/env/config/test_PackageMaskFile.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/env/config/test_PackageMaskFile.py b/lib/portage/tests/env/config/test_PackageMaskFile.py index 0c5b30f53..62b5e54ce 100644 --- a/lib/portage/tests/env/config/test_PackageMaskFile.py +++ b/lib/portage/tests/env/config/test_PackageMaskFile.py @@ -1,5 +1,5 @@ # test_PackageMaskFile.py -- Portage Unit Testing Functionality -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage import os @@ -8,7 +8,7 @@ from portage.tests import TestCase, test_cps from tempfile import mkstemp class PackageMaskFileTestCase(TestCase): - + def testPackageMaskFile(self): self.BuildFile() try: @@ -18,12 +18,12 @@ class PackageMaskFileTestCase(TestCase): self.assertTrue(atom in test_cps) finally: self.NukeFile() - + def BuildFile(self): fd, self.fname = mkstemp() f = os.fdopen(fd, 'w') f.write("\n".join(test_cps)) f.close() - + def NukeFile(self): os.unlink(self.fname) -- 2.28.0
[gentoo-portage-dev] [PATCH 58/68] lib/portage/tests/dep/test_dep_getcpv.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/dep/test_dep_getcpv.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/dep/test_dep_getcpv.py b/lib/portage/tests/dep/test_dep_getcpv.py index 79c1514a1..888b93cd4 100644 --- a/lib/portage/tests/dep/test_dep_getcpv.py +++ b/lib/portage/tests/dep/test_dep_getcpv.py @@ -1,5 +1,5 @@ # test_dep_getcpv.py -- Portage Unit Testing Functionality -# Copyright 2006 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -12,7 +12,7 @@ class DepGetCPV(TestCase): def testDepGetCPV(self): prefix_ops = [ - "<", ">", "=", "~", "<=", + "<", ">", "=", "~", "<=", ">=", "!=", "!<", "!>", "!~" ] -- 2.28.0
[gentoo-portage-dev] [PATCH 39/68] test_missing_iuse_and_evaluated_atoms.py: fix whitespace
Signed-off-by: Aaron Bauman --- .../resolver/test_missing_iuse_and_evaluated_atoms.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py b/lib/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py index a860e7bb6..321118a6b 100644 --- a/lib/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py +++ b/lib/portage/tests/resolver/test_missing_iuse_and_evaluated_atoms.py @@ -1,4 +1,4 @@ -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -8,9 +8,9 @@ class MissingIUSEandEvaluatedAtomsTestCase(TestCase): def testMissingIUSEandEvaluatedAtoms(self): ebuilds = { - "dev-libs/A-1": { "DEPEND": "dev-libs/B[foo?]", "IUSE": "foo bar", "EAPI": 2 }, - "dev-libs/A-2": { "DEPEND": "dev-libs/B[foo?,bar]", "IUSE": "foo bar", "EAPI": 2 }, - "dev-libs/B-1": { "IUSE": "bar" }, + "dev-libs/A-1": { "DEPEND": "dev-libs/B[foo?]", "IUSE": "foo bar", "EAPI": 2 }, + "dev-libs/A-2": { "DEPEND": "dev-libs/B[foo?,bar]", "IUSE": "foo bar", "EAPI": 2 }, + "dev-libs/B-1": { "IUSE": "bar" }, } test_cases = ( -- 2.28.0
[gentoo-portage-dev] [PATCH 57/68] lib/portage/tests/sets/shell/testShell.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/sets/shell/testShell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/sets/shell/testShell.py b/lib/portage/tests/sets/shell/testShell.py index 58dc750bf..10e489d0e 100644 --- a/lib/portage/tests/sets/shell/testShell.py +++ b/lib/portage/tests/sets/shell/testShell.py @@ -1,5 +1,5 @@ # testCommandOututSet.py -- Portage Unit Testing Functionality -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.process import find_binary @@ -16,7 +16,7 @@ class CommandOutputSetTestCase(TestCase): pass def testCommand(self): - + params = set(test_cps) command = find_binary("bash") command += " -c '" -- 2.28.0
[gentoo-portage-dev] [PATCH 53/68] lib/portage/checksum.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/checksum.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/checksum.py b/lib/portage/checksum.py index 8f01f6ac4..d4a75c058 100644 --- a/lib/portage/checksum.py +++ b/lib/portage/checksum.py @@ -1,5 +1,5 @@ # checksum.py -- core Portage functionality -# Copyright 1998-2017 Gentoo Foundation +# Copyright 1998-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage @@ -75,7 +75,7 @@ class _generate_hash_function: def checksum_file(self, filename): """ Run a checksum against a file. - + @param filename: File to run the checksum against @type filename: String @return: The hash and size of the data -- 2.28.0
[gentoo-portage-dev] [PATCH 55/68] lib/portage/dbapi/bintree.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/dbapi/bintree.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/dbapi/bintree.py b/lib/portage/dbapi/bintree.py index 97be51121..59c265688 100644 --- a/lib/portage/dbapi/bintree.py +++ b/lib/portage/dbapi/bintree.py @@ -1686,7 +1686,7 @@ class binarytree: resume = True writemsg(_("Resuming download of this tbz2, but it is possible that it is corrupt.\n"), noiselevel=-1) - + mydest = os.path.dirname(self.getname(pkgname)) self._ensure_dir(mydest) # urljoin doesn't work correctly with unrecognized protocols like sftp -- 2.28.0
[gentoo-portage-dev] [PATCH 45/68] lib/portage/tests/resolver/test_slot_collisions.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/resolver/test_slot_collisions.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/portage/tests/resolver/test_slot_collisions.py b/lib/portage/tests/resolver/test_slot_collisions.py index a15ebf4e0..d84ccfcef 100644 --- a/lib/portage/tests/resolver/test_slot_collisions.py +++ b/lib/portage/tests/resolver/test_slot_collisions.py @@ -1,4 +1,4 @@ -# Copyright 2010-2019 Gentoo Authors +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -9,7 +9,7 @@ class SlotCollisionTestCase(TestCase): def testSlotCollision(self): ebuilds = { - "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo" }, + "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo" }, "dev-libs/B-1": { "IUSE": "foo" }, "dev-libs/C-1": { "DEPEND": "dev-libs/A[foo]", "EAPI": 2 }, "dev-libs/D-1": { "DEPEND": "dev-libs/A[foo=] dev-libs/B[foo=]", "IUSE": "foo", "EAPI": 2 }, @@ -50,11 +50,11 @@ class SlotCollisionTestCase(TestCase): "dev-lang/perl-5.16": {"SLOT": "0/5.16", "EAPI": "5"}, } installed = { - "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" }, + "dev-libs/A-1": { "PDEPEND": "foo? ( dev-libs/B )", "IUSE": "foo", "USE": "foo" }, "dev-libs/B-1": { "IUSE": "foo", "USE": "foo" }, "dev-libs/C-1": { "DEPEND": "dev-libs/A[foo]", "EAPI": 2 }, "dev-libs/D-1": { "DEPEND": "dev-libs/A[foo=] dev-libs/B[foo=]", "IUSE": "foo", "USE": "foo", "EAPI": 2 }, - + "sci-libs/K-1": { "IUSE": "foo", "USE": "" }, "sci-libs/L-1": { "DEPEND": "sci-libs/K[-foo]" }, -- 2.28.0
[gentoo-portage-dev] [PATCH 38/68] test_slot_conflict_unsatisfied_deep_deps.py: fix whitespace
Signed-off-by: Aaron Bauman --- .../test_slot_conflict_unsatisfied_deep_deps.py| 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py b/lib/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py index 846ba0e59..83c638518 100644 --- a/lib/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py +++ b/lib/portage/tests/resolver/test_slot_conflict_unsatisfied_deep_deps.py @@ -1,4 +1,4 @@ -# Copyright 2014 Gentoo Foundation +# Copyright 2014-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -91,10 +91,10 @@ class SlotConflictUnsatisfiedDeepDepsTestCase(TestCase): success=False), # With --autounmask-backtrack=y: - #[ebuild N~] dev-libs/A-2 - #[ebuild N ] dev-libs/C-1 - #[ebuild N ] dev-libs/D-1 - #[ebuild N ] dev-libs/B-1 + #[ebuild N~] dev-libs/A-2 + #[ebuild N ] dev-libs/C-1 + #[ebuild N ] dev-libs/D-1 + #[ebuild N ] dev-libs/B-1 # #The following keyword changes are necessary to proceed: # (see "package.accept_keywords" in the portage(5) man page for more details) -- 2.28.0
[gentoo-portage-dev] [PATCH 33/68] lib/portage/env/config.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/env/config.py | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/portage/env/config.py b/lib/portage/env/config.py index 865d8353a..522168640 100644 --- a/lib/portage/env/config.py +++ b/lib/portage/env/config.py @@ -1,5 +1,5 @@ # config.py -- Portage Config -# Copyright 2007-2009 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ["ConfigLoaderKlass", "GenericFile", "PackageKeywordsFile", @@ -13,7 +13,7 @@ class ConfigLoaderKlass(UserDict): A base class stub for things to inherit from. Users may want a non-file backend. """ - + def __init__(self, loader): """ @param loader: A class that has a load() that returns two dicts @@ -38,13 +38,13 @@ class GenericFile(UserDict): helpful when you really have no idea what you are loading (hint hint the file should perhaps declare what type it is? ;) """ - + loaders = [KeyListFileLoader, KeyValuePairFileLoader, ItemFileLoader] - + def __init__(self, filename): UserDict.__init__(self) self.filename = filename - + def load(self): for loader in self.loaders: l = loader(self.filename, None) @@ -64,7 +64,7 @@ class PackageKeywordsFile(ConfigLoaderKlass): def __init__(self, filename): super(PackageKeywordsFile, self).__init__( self.default_loader(filename, validator=None)) - + class PackageUseFile(ConfigLoaderKlass): """ Inherits from PackageUse; implements a file-based backend. Doesn't handle recursion yet. @@ -74,11 +74,11 @@ class PackageUseFile(ConfigLoaderKlass): def __init__(self, filename): super(PackageUseFile, self).__init__( self.default_loader(filename, validator=None)) - + class PackageMaskFile(ConfigLoaderKlass): """ A class that implements a file-based package.mask - + Entires in package.mask are of the form: atom1 atom2 @@ -86,7 +86,7 @@ class PackageMaskFile(ConfigLoaderKlass): -atom3 to revert a previous mask; this only works when masking files are stacked """ - + default_loader = ItemFileLoader def __init__(self, filename): @@ -97,9 +97,9 @@ class PortageModulesFile(ConfigLoaderKlass): """ File Class for /etc/portage/modules """ - + default_loader = KeyValuePairFileLoader - + def __init__(self, filename): super(PortageModulesFile, self).__init__( self.default_loader(filename, validator=None)) -- 2.28.0
[gentoo-portage-dev] [PATCH 34/68] lib/portage/dep/__init__.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/dep/__init__.py | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 36f0dc8c9..50266a21b 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -1,5 +1,5 @@ # deps.py -- Portage dependency resolution functions -# Copyright 2003-2018 Gentoo Foundation +# Copyright 2003-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = [ @@ -9,7 +9,7 @@ __all__ = [ 'get_operator', 'isjustname', 'isspecific', 'isvalidatom', 'match_from_list', 'match_to_list', 'paren_enclose', 'paren_normalize', 'paren_reduce', - 'remove_slot', 'strip_empty', 'use_reduce', + 'remove_slot', 'strip_empty', 'use_reduce', '_repo_separator', '_slot_separator', ] @@ -93,7 +93,7 @@ def _get_atom_re(eapi_attrs): atom_re = re.compile('^(?P(?:' + '(?P' + _op + cpv_re + ')|' + '(?P=' + cpv_re + r'\*)|' + - '(?P' + cp_re + '))' + + '(?P' + cp_re + '))' + '(' + _slot_separator + _slot_loose + ')?' + _repo + ')(' + _use + ')?$', re.VERBOSE | re.UNICODE) @@ -281,7 +281,7 @@ def paren_reduce(mystr, _deprecation_warn=True): stack[level].extend(l[0]) else: stack[level].extend(l) - else: + else: stack[level].append(l) if l: @@ -322,13 +322,13 @@ def paren_reduce(mystr, _deprecation_warn=True): if token[-1] == "?": need_bracket = True - + stack[level].append(token) if level != 0 or need_bracket: raise InvalidDependString( _("malformed syntax: '%s'") % mystr) - + return stack[0] class paren_normalize(list): @@ -420,7 +420,7 @@ def _use_reduce_cached(depstr, uselist, masklist, matchall, excludeall, \ else: flag = conditional[:-1] is_negated = False - + if is_valid_flag: if not is_valid_flag(flag): msg = _("USE flag '%s' referenced in " + \ @@ -669,7 +669,7 @@ def _use_reduce_cached(depstr, uselist, masklist, matchall, excludeall, \ raise InvalidDependString( _("SRC_URI arrow not allowed in EAPI %s: token %s") % (eapi, pos+1)) need_simple_token = True - stack[level].append(token) + stack[level].append(token) else: if need_bracket: raise InvalidDependString( @@ -710,11 +710,11 @@ def _use_reduce_cached(depstr, uselist, masklist, matchall, excludeall, \ if level != 0: raise InvalidDependString( _("Missing '%s' at end of string") % (")",)) - + if need_bracket: raise InvalidDependString( _("Missing '%s' at end of string") % ("(",)) - + if need_simple_token: raise InvalidDependString( _("Missing file name at end of string")) @@ -1054,7 +1054,7 @@ class _use_dep: tokens = [] all_defaults = self.missing_enabled | self.missing_disabled - + def validate_flag(flag): return is_valid_flag(flag) or flag in all_defaults @@ -1823,7 +1823,7 @@ def dep_getslot(mydep): #remove repo_name if present mydep = mydep.split(_repo_separator)[0] - + colon = mydep.find(_slot_separator) if colon != -1: bracket = mydep.find("[", colon) @@ -2249,7 +2249,7 @@ def match_from_list(mydep, candidate_list): elif operator == "=*": # glob match # XXX: Nasty special casing for leading zeros - # Required as =* is a literal prefix match, so can't + # Required as =* is a literal prefix match, so can't # use vercmp myver = mycpv_cps[2].lstrip("0") if not myver or not myver[0].isdigit(): @@ -2495,7 +2495,7 @@ def get_required_use_flags(required_use, eapi=None):
[gentoo-portage-dev] [PATCH 32/68] lib/_emerge/unmerge.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/_emerge/unmerge.py | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/_emerge/unmerge.py b/lib/_emerge/unmerge.py index 8de35a6ef..5204ac6f0 100644 --- a/lib/_emerge/unmerge.py +++ b/lib/_emerge/unmerge.py @@ -1,4 +1,4 @@ -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -129,24 +129,24 @@ def _unmerge_display(root_config, myopts, unmerge_action, if not os.path.exists(x): print("\n!!! The path '"+x+"' doesn't exist.\n") return 1, {} - + absx = os.path.abspath(x) sp_absx = absx.split("/") if sp_absx[-1][-7:] == ".ebuild": del sp_absx[-1] absx = "/".join(sp_absx) - + sp_absx_len = len(sp_absx) - + vdb_path = os.path.join(settings["EROOT"], portage.VDB_PATH) - + sp_vdb = vdb_path.split("/") sp_vdb_len = len(sp_vdb) - + if not os.path.exists(absx+"/CONTENTS"): print("!!! Not a valid db dir: "+str(absx)) return 1, {} - + if sp_absx_len <= sp_vdb_len: # The Path is shorter... so it can't be inside the vdb. print(sp_absx) @@ -154,7 +154,7 @@ def _unmerge_display(root_config, myopts, unmerge_action, print("\n!!!",x,"cannot be inside "+ \ vdb_path+"; aborting.\n") return 1, {} - + for idx in range(0,sp_vdb_len): if idx >= sp_absx_len or sp_vdb[idx] != sp_absx[idx]: print(sp_absx) @@ -162,11 +162,11 @@ def _unmerge_display(root_config, myopts, unmerge_action, print("\n!!!", x, "is not inside "+\ vdb_path+"; aborting.\n") return 1, {} - + print("="+"/".join(sp_absx[sp_vdb_len:])) candidate_catpkgs.append( "="+"/".join(sp_absx[sp_vdb_len:])) - + newline="" if (not "--quiet" in myopts): newline="\n" @@ -200,7 +200,7 @@ def _unmerge_display(root_config, myopts, unmerge_action, print("" + green(i)) print() sys.exit(1) - + if not mymatch and x[0] not in "<>=~": mymatch = localtree.dep_match(x) if not mymatch: @@ -289,7 +289,7 @@ def _unmerge_display(root_config, myopts, unmerge_action, if global_unmerge and not numselected: portage.writemsg_stdout("\n>>> No outdated packages were found on your system.\n") return 1, {} - + if not numselected: portage.writemsg_stdout( "\n>>> No packages selected for removal by " + \ @@ -319,7 +319,7 @@ def _unmerge_display(root_config, myopts, unmerge_action, del stop, pos # we don't want to unmerge packages that are still listed in user-editable package sets - # listed in "world" as they would be remerged on the next update of "world" or the + # listed in "world" as they would be remerged on the next update of "world" or the # relevant package sets. unknown_sets = set() for cp in range(len(pkgmap)): @@ -356,7 +356,7 @@ def _unm
[gentoo-portage-dev] [PATCH 28/68] lib/portage/cache/sql_template.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/cache/sql_template.py | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/portage/cache/sql_template.py b/lib/portage/cache/sql_template.py index b87612f2d..180dd60b2 100644 --- a/lib/portage/cache/sql_template.py +++ b/lib/portage/cache/sql_template.py @@ -1,4 +1,4 @@ -# Copyright: 2005 Gentoo Foundation +# Copyright: 2005-2020 Gentoo Authors # Author(s): Brian Harring (ferri...@gentoo.org) # License: GPL2 @@ -7,19 +7,19 @@ from portage.cache.template import reconstruct_eclasses class SQLDatabase(template.database): """template class for RDBM based caches - + This class is designed such that derivatives don't have to change much code, mostly constant strings. _BaseError must be an exception class that all Exceptions thrown from the derived RDBMS are derived from. SCHEMA_INSERT_CPV_INTO_PACKAGE should be modified dependant on the RDBMS, as should SCHEMA_PACKAGE_CREATE- - basically you need to deal with creation of a unique pkgid. If the dbapi2 rdbms class has a method of + basically you need to deal with creation of a unique pkgid. If the dbapi2 rdbms class has a method of recovering that id, then modify _insert_cpv to remove the extra select. Creation of a derived class involves supplying _initdb_con, and table_exists. Additionally, the default schemas may have to be modified. """ - + SCHEMA_PACKAGE_NAME = "package_cache" SCHEMA_PACKAGE_CREATE = "CREATE TABLE %s (\ pkgid INTEGER PRIMARY KEY, label VARCHAR(255), cpv VARCHAR(255), UNIQUE(label, cpv))" % SCHEMA_PACKAGE_NAME @@ -116,10 +116,10 @@ class SQLDatabase(template.database): def _delitem(self, cpv): """delete a cpv cache entry - derived RDBM classes for this *must* either support cascaded deletes, or + derived RDBM classes for this *must* either support cascaded deletes, or override this method""" try: - try: + try: self.con.execute("DELETE FROM %s WHERE label=%s AND cpv=%s" % \ (self.SCHEMA_PACKAGE_NAME, self.label, self._sfilter(cpv))) if self.autocommits: @@ -151,7 +151,7 @@ class SQLDatabase(template.database): except self._BaseError as e: raise cache_errors.CacheCorruption(cpv, e) - # __getitem__ fills out missing values, + # __getitem__ fills out missing values, # so we store only what's handed to us and is a known key db_values = [] for key in self._known_keys: @@ -183,7 +183,7 @@ class SQLDatabase(template.database): doesn't support auto-increment columns for pkgid. returns the cpvs new pkgid note this doesn't commit the transaction. The caller is expected to.""" - + cpv = self._sfilter(cpv) if self._supports_replace: query_str = self.SCHEMA_INSERT_CPV_INTO_PACKAGE.replace("INSERT","REPLACE",1) @@ -201,7 +201,7 @@ class SQLDatabase(template.database): raise self.con.execute("SELECT pkgid FROM %s WHERE label=%s AND cpv=%s" % \ (self.SCHEMA_PACKAGE_NAME, self.label, cpv)) - + if self.con.rowcount != 1: raise cache_error.CacheCorruption(cpv, "Tried to insert the cpv, but found " " %i matches upon the following select!" % len(rows)) @@ -231,7 +231,7 @@ class SQLDatabase(template.database): raise cache_errors.GeneralCacheCorruption(e) try: - self.con.execute("SELECT cpv FROM %s WHERE label=%s" % + self.con.execute("SELECT cpv FROM %s WHERE label=%s" % (self.SCHEMA_PACKAGE_NAME, self.label)) except self._BaseError as e: raise cache_errors.GeneralCacheCorruption(e) @@ -246,7 +246,7 @@ class SQLDatabase(template.database): self.label)) except self._BaseError as e: raise cache_errors.CacheCorruption(self, cpv, e) - + oldcpv = None l = [] for x, y, v in self.con.fetchall(): @@ -267,7 +267,7 @@ class SQLDatabase(template.database
[gentoo-portage-dev] [PATCH 40/68] lib/portage/package/ebuild/deprecated_profile_check.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/package/ebuild/deprecated_profile_check.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/package/ebuild/deprecated_profile_check.py b/lib/portage/package/ebuild/deprecated_profile_check.py index abf32a079..e93ece2ac 100644 --- a/lib/portage/package/ebuild/deprecated_profile_check.py +++ b/lib/portage/package/ebuild/deprecated_profile_check.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ['deprecated_profile_check'] @@ -36,7 +36,7 @@ def deprecated_profile_check(settings=None): return with io.open(_unicode_encode(deprecated_profile_file, - encoding=_encodings['fs'], errors='strict'), + encoding=_encodings['fs'], errors='strict'), mode='r', encoding=_encodings['content'], errors='replace') as f: dcontent = f.readlines() writemsg(colorize("BAD", _("\n!!! Your current profile is " -- 2.28.0
[gentoo-portage-dev] [PATCH 41/68] lib/portage/env/validators.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/env/validators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/env/validators.py b/lib/portage/env/validators.py index 4d11d69fe..dae2d5041 100644 --- a/lib/portage/env/validators.py +++ b/lib/portage/env/validators.py @@ -1,5 +1,5 @@ # validators.py Portage File Loader Code -# Copyright 2007 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors from portage.dep import isvalidatom @@ -9,7 +9,7 @@ def PackagesFileValidator(atom): """ This function mutates atoms that begin with - or * It then checks to see if that atom is valid, and if so returns True, else it returns False. - + Args: atom: a string representing an atom such as sys-apps/portage-2.1 """ -- 2.28.0
[gentoo-portage-dev] [PATCH 35/68] lib/portage/getbinpkg.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/getbinpkg.py | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/lib/portage/getbinpkg.py b/lib/portage/getbinpkg.py index 54b918a65..d588b324b 100644 --- a/lib/portage/getbinpkg.py +++ b/lib/portage/getbinpkg.py @@ -1,5 +1,5 @@ # getbinpkg.py -- Portage binary-package helper functions -# Copyright 2003-2014 Gentoo Foundation +# Copyright 2003-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.output import colorize @@ -52,7 +52,7 @@ def make_metadata_dict(data): DeprecationWarning, stacklevel=2) myid, _myglob = data - + mydict = {} for k_bytes in portage.xpak.getindex_mem(myid): k = _unicode_decode(k_bytes, @@ -78,7 +78,7 @@ class ParseLinks(html_parser_HTMLParser): def get_anchors(self): return self.PL_anchors - + def get_anchors_by_prefix(self, prefix): newlist = [] for x in self.PL_anchors: @@ -86,7 +86,7 @@ class ParseLinks(html_parser_HTMLParser): if x not in newlist: newlist.append(x[:]) return newlist - + def get_anchors_by_suffix(self, suffix): newlist = [] for x in self.PL_anchors: @@ -94,7 +94,7 @@ class ParseLinks(html_parser_HTMLParser): if x not in newlist: newlist.append(x[:]) return newlist - + def handle_endtag(self, tag): pass @@ -215,10 +215,10 @@ def make_ftp_request(conn, address, rest=None, dest=None): DeprecationWarning, stacklevel=2) try: - + if dest: fstart_pos = dest.tell() - + conn.voidcmd("TYPE I") fsize = conn.size(address) @@ -256,7 +256,7 @@ def make_ftp_request(conn, address, rest=None, dest=None): except ValueError as e: return None, int(str(e)[:4]), str(e) - + def make_http_request(conn, address, _params={}, headers={}, dest=None): """Uses the |conn| object to request @@ -296,7 +296,7 @@ def make_http_request(conn, address, _params={}, headers={}, dest=None): str(parts[1]) + "\n") address = parts[1] break - + if (rc != 200) and (rc != 206): return None, rc, "Server did not respond successfully (%s: %s)" % (str(response.status), str(response.reason)) @@ -313,10 +313,10 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): DeprecationWarning, stacklevel=2) myarray = [] - + if not (prefix and suffix): match_both = 0 - + for x in array: add_p = 0 if prefix and (len(x) >= len(prefix)) and (x[:len(prefix)] == prefix): @@ -337,7 +337,7 @@ def match_in_array(array, prefix="", suffix="", match_both=1, allow_overlap=0): continue # Too short to match. else: pass # Do whatever... We're overlapping. - + if suffix and (len(x) >= len(suffix)) and (x[-len(suffix):] == suffix): myarray.append(x) # It matches else: @@ -368,7 +368,7 @@ def dir_get_list(baseurl, conn=None): # if the address doesn't end with a slash. address += "/" page, rc, msg = make_http_request(conn, address, params, headers) - + if page: parser = ParseLinks() parser.feed(_unicode_decode(page)) @@ -426,7 +426,7 @@ def file_get_metadata(baseurl, conn=None, chunk_size=3000): f.close() else: raise TypeError(_("Unknown protocol. '%s'") % protocol) - + if data: xpaksize = portage.xpak.decodeint(data[-8:-4]) if (xpaksize + 8) > chunk_size: @@ -544,7 +544,7 @@ def file_get_lib(baseurl, dest, conn=None): f.close() else: raise TypeError(_("Unknown protocol. '%s'") % protocol) - + if not keepconnection: conn.close() @@ -621,7 +621,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= tbz2list = match_in_array(filelist, suffix=".tbz2")
[gentoo-portage-dev] [PATCH 27/68] lib/portage/process.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/process.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portage/process.py b/lib/portage/process.py index f0019f2c0..1ff886bf3 100644 --- a/lib/portage/process.py +++ b/lib/portage/process.py @@ -123,7 +123,7 @@ def sanitize_fds(): def spawn_bash(mycommand, debug=False, opt_name=None, **keywords): """ Spawns a bash shell running a specific commands - + @param mycommand: The command for bash to run @type mycommand: String @param debug: Turn bash debugging on (set -x) @@ -228,7 +228,7 @@ def spawn(mycommand, env=None, opt_name=None, fd_pipes=None, returnpid=False, cgroup=None): """ Spawns a given command. - + @param mycommand: the command to execute @type mycommand: String or List (Popen style list) @param env: If env is not None, it must be a mapping that defines the environment @@ -277,7 +277,7 @@ def spawn(mycommand, env=None, opt_name=None, fd_pipes=None, returnpid=False, logfile requires stdout and stderr to be assigned to this process (ie not pointed somewhere else.) - + """ # mycommand is either a str or a list @@ -516,7 +516,7 @@ def _exec(binary, mycommand, opt_name, fd_pipes, """ Execute a given binary with options - + @param binary: Name of program to execute @type binary: String @param mycommand: Options for program @@ -945,7 +945,7 @@ def _setup_pipes(fd_pipes, close_fds=True, inheritable=None): def find_binary(binary): """ Given a binary name, find the binary in PATH - + @param binary: Name of the binary to find @type string @rtype: None or string -- 2.28.0
[gentoo-portage-dev] [PATCH 44/68] lib/portage/util/_async/PipeLogger.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/util/_async/PipeLogger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/util/_async/PipeLogger.py b/lib/portage/util/_async/PipeLogger.py index 060483f0b..2bbdd3ddb 100644 --- a/lib/portage/util/_async/PipeLogger.py +++ b/lib/portage/util/_async/PipeLogger.py @@ -66,7 +66,7 @@ class PipeLogger(AbstractPollTask): def _io_loop(self, input_file): background = self.background stdout_fd = self.stdout_fd - log_file = self._log_file + log_file = self._log_file fd = input_file.fileno() while True: -- 2.28.0
[gentoo-portage-dev] [PATCH 31/68] lib/portage/manifest.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/manifest.py | 30 +++--- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/portage/manifest.py b/lib/portage/manifest.py index 79c756f04..d43f7d836 100644 --- a/lib/portage/manifest.py +++ b/lib/portage/manifest.py @@ -166,14 +166,14 @@ class Manifest: def getFullname(self): """ Returns the absolute path to the Manifest file for this instance """ return os.path.join(self.pkgdir, "Manifest") - + def getDigests(self): """ Compability function for old digest/manifest code, returns dict of filename:{hashfunction:hashvalue} """ rval = {} for t in MANIFEST2_IDENTIFIERS: rval.update(self.fhashdict[t]) return rval - + def getTypeDigests(self, ftype): """ Similar to getDigests(), but restricted to files of the given type. """ return self.fhashdict[ftype] @@ -394,11 +394,11 @@ class Manifest: def sign(self): """ Sign the Manifest """ raise NotImplementedError() - + def validateSignature(self): """ Validate signature on Manifest """ raise NotImplementedError() - + def addFile(self, ftype, fname, hashdict=None, ignoreMissing=False): """ Add entry to Manifest optionally using hashdict to avoid recalculation of hashes """ if ftype == "AUX" and not fname.startswith("files/"): @@ -414,22 +414,22 @@ class Manifest: self.fhashdict[ftype][fname].update(hashdict) if self.required_hashes.difference(set(self.fhashdict[ftype][fname])): self.updateFileHashes(ftype, fname, checkExisting=False, ignoreMissing=ignoreMissing) - + def removeFile(self, ftype, fname): """ Remove given entry from Manifest """ del self.fhashdict[ftype][fname] - + def hasFile(self, ftype, fname): """ Return whether the Manifest contains an entry for the given type,filename pair """ return (fname in self.fhashdict[ftype]) - + def findFile(self, fname): """ Return entrytype of the given file if present in Manifest or None if not present """ for t in MANIFEST2_IDENTIFIERS: if fname in self.fhashdict[t]: return t return None - + def create(self, checkExisting=False, assumeDistHashesSometimes=False, assumeDistHashesAlways=False, requiredDistfiles=[]): """ Recreate this Manifest from scratch. This will not use any @@ -586,17 +586,17 @@ class Manifest: absname = os.path.join(self.pkgdir, "files", fname) else: absname = os.path.join(self.pkgdir, fname) - return absname - + return absname + def checkAllHashes(self, ignoreMissingFiles=False): for t in MANIFEST2_IDENTIFIERS: self.checkTypeHashes(t, ignoreMissingFiles=ignoreMissingFiles) - + def checkTypeHashes(self, idtype, ignoreMissingFiles=False, hash_filter=None): for f in self.fhashdict[idtype]: self.checkFileHashes(idtype, f, ignoreMissing=ignoreMissingFiles, hash_filter=hash_filter) - + def checkFileHashes(self, ftype, fname, ignoreMissing=False, hash_filter=None): digests = _filter_unaccelarated_hashes(self.fhashdict[ftype][fname]) if hash_filter is not None: @@ -623,7 +623,7 @@ class Manifest: if checkDistfiles or onlyDistfiles: for f in self._getCpvDistfiles(cpv): self.checkFileHashes("DIST", f, ignoreMissing=False) - + def _getCpvDistfiles(self, cpv): """ Get a list of all DIST files associated to the given cpv """ return self.fetchlist_dict[cpv] @@ -648,12 +648,12 @@ class Manifest: myhashkeys.remove(k) myhashes = perform_multiple_checksums(self._getAbsname(ftype, fname), myhashkeys) self.fhashdict[ftype][fname].update(myhashes) - + def updateTypeHashes(self, idtype, checkExisting=False, ignoreMissingFiles=True):
[gentoo-portage-dev] [PATCH 43/68] lib/portage/_emirrordist/FetchTask.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_emirrordist/FetchTask.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/_emirrordist/FetchTask.py b/lib/portage/_emirrordist/FetchTask.py index f2342362d..334da7420 100644 --- a/lib/portage/_emirrordist/FetchTask.py +++ b/lib/portage/_emirrordist/FetchTask.py @@ -458,7 +458,7 @@ class FetchTask(CompositeTask): if self._was_cancelled(): self.wait() return - + if os.path.exists(self._fetch_tmp_file): self._start_task( FileDigester(file_path=self._fetch_tmp_file, -- 2.28.0
[gentoo-portage-dev] [PATCH 36/68] lib/portage/env/loaders.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/env/loaders.py | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/portage/env/loaders.py b/lib/portage/env/loaders.py index 5fa5452af..d24e6a47e 100644 --- a/lib/portage/env/loaders.py +++ b/lib/portage/env/loaders.py @@ -1,5 +1,5 @@ # config.py -- Portage Config -# Copyright 2007-2013 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import errno @@ -16,7 +16,7 @@ from portage import _unicode_encode from portage.localization import _ class LoaderError(Exception): - + def __init__(self, resource, error_msg): """ @param resource: Resource that failed to load (file/sql/etc) @@ -27,7 +27,7 @@ class LoaderError(Exception): self.resource = resource self.error_msg = error_msg - + def __str__(self): return "Failed while loading resource: %s, error was: %s" % ( self.resource, self.error_msg) @@ -38,7 +38,7 @@ def RecursiveFileLoader(filename): If filename is of type file, return a generate that yields filename else if filename is of type directory, return a generator that fields files in that directory. - + Ignore files beginning with . or ending in ~. Prune CVS directories. @@ -117,7 +117,7 @@ class TestTextLoader(DataLoader): def setErrors(self, errors): self.errors = errors - + def load(self): return (self.data, self.errors) @@ -139,7 +139,7 @@ class FileLoader(DataLoader): Return the {source: {key: value}} pairs from a file Return the {source: [list of errors] from a load - @param recursive: If set and self.fname is a directory; + @param recursive: If set and self.fname is a directory; load all files in self.fname @type: Boolean @rtype: tuple @@ -186,12 +186,12 @@ class FileLoader(DataLoader): class ItemFileLoader(FileLoader): """ Class to load data from a file full of items one per line - + >>> item1 >>> item2 >>> item3 >>> item1 - + becomes { 'item1':None, 'item2':None, 'item3':None } Note that due to the data store being a dict, duplicates are removed. @@ -199,7 +199,7 @@ class ItemFileLoader(FileLoader): def __init__(self, filename, validator): FileLoader.__init__(self, filename, validator) - + def lineParser(self, line, line_num, data, errors): line = line.strip() if line.startswith('#'): # Skip commented lines @@ -223,7 +223,7 @@ class ItemFileLoader(FileLoader): class KeyListFileLoader(FileLoader): """ Class to load data from a file full of key [list] tuples - + >>>>key foo1 foo2 foo3 becomes {'key':['foo1','foo2','foo3']} @@ -274,7 +274,7 @@ class KeyListFileLoader(FileLoader): class KeyValuePairFileLoader(FileLoader): """ Class to load data from a file full of key=value pairs - + >>>>key=value >>>>foo=bar becomes: -- 2.28.0
[gentoo-portage-dev] [PATCH 37/68] lib/portage/_sets/__init__.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/__init__.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portage/_sets/__init__.py b/lib/portage/_sets/__init__.py index 6c6df4cca..ea0a8b9b4 100644 --- a/lib/portage/_sets/__init__.py +++ b/lib/portage/_sets/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2007-2019 Gentoo Authors +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -150,12 +150,12 @@ class SetConfig: if not setname in self.psets: options["name"] = setname options["world-candidate"] = "False" - + # for the unlikely case that there is already a section with the requested setname import random while setname in parser.sections(): setname = "%08d" % random.randint(0, 10**10) - + parser.add_section(setname) for k, v in options.items(): parser.set(setname, k, v) @@ -200,7 +200,7 @@ class SetConfig: optdict = {} for oname in parser.options(sname): optdict[oname] = parser.get(sname, oname) - + # create single or multiple instances of the given class depending on configuration if parser.has_option(sname, "multiset") and \ parser.getboolean(sname, "multiset"): @@ -245,7 +245,7 @@ class SetConfig: "must be configured as multiset") % {"class": classname, "section": sname}) continue self._parsed = True - + def getSets(self): self._parse() return self.psets.copy() -- 2.28.0
[gentoo-portage-dev] [PATCH 26/68] lib/portage/locks.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/locks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/locks.py b/lib/portage/locks.py index a0981712e..5fa6d5d38 100644 --- a/lib/portage/locks.py +++ b/lib/portage/locks.py @@ -444,7 +444,7 @@ def unlockfile(mytuple): if(myfd == HARDLINK_FD): unhardlink_lockfile(lockfilename, unlinkfile=unlinkfile) return True - + # myfd may be None here due to myfd = mypath in lockfile() if isinstance(lockfilename, str) and \ not os.path.exists(lockfilename): @@ -672,7 +672,7 @@ def hardlock_cleanup(path, remove_all_locks=False): hostpid = parts[1].split("-") host = "-".join(hostpid[:-1]) pid = hostpid[-1] - + if filename not in mylist: mylist[filename] = {} if host not in mylist[filename]: @@ -683,7 +683,7 @@ def hardlock_cleanup(path, remove_all_locks=False): results.append(_("Found %(count)s locks") % {"count": mycount}) - + for x in mylist: if myhost in mylist[x] or remove_all_locks: mylockname = hardlock_name(path + "/" + x) -- 2.28.0
[gentoo-portage-dev] [PATCH 22/68] lib/portage/tests/dep/testExtractAffectingUSE.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/dep/testExtractAffectingUSE.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/dep/testExtractAffectingUSE.py b/lib/portage/tests/dep/testExtractAffectingUSE.py index 026a55274..6293f25e8 100644 --- a/lib/portage/tests/dep/testExtractAffectingUSE.py +++ b/lib/portage/tests/dep/testExtractAffectingUSE.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -13,7 +13,7 @@ class TestExtractAffectingUSE(TestCase): ("a? ( A ) !b? ( B ) !c? ( C ) d? ( D )", "B", ("b",)), ("a? ( A ) !b? ( B ) !c? ( C ) d? ( D )", "C", ("c",)), ("a? ( A ) !b? ( B ) !c? ( C ) d? ( D )", "D", ("d",)), - + ("a? ( b? ( AB ) )", "AB", ("a", "b")), ("a? ( b? ( c? ( ABC ) ) )", "ABC", ("a", "b", "c")), @@ -46,7 +46,7 @@ class TestExtractAffectingUSE(TestCase): ("!? ( A )", "A"), ("( A", "A"), ("A )", "A"), - + ("||( A B )", "A"), ("|| (A B )", "A"), ("|| ( A B)", "A"), -- 2.28.0
[gentoo-portage-dev] [PATCH 30/68] lib/portage/_sets/security.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/security.py | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/portage/_sets/security.py b/lib/portage/_sets/security.py index f8dbef2be..53ddd15c1 100644 --- a/lib/portage/_sets/security.py +++ b/lib/portage/_sets/security.py @@ -1,4 +1,4 @@ -# Copyright 2007-2012 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage.glsa as glsa @@ -11,9 +11,9 @@ __all__ = ["SecuritySet", "NewGlsaSet", "NewAffectedSet", "AffectedSet"] class SecuritySet(PackageSet): _operations = ["merge"] _skip_applied = False - + description = "package set that includes all packages possibly affected by a GLSA" - + def __init__(self, settings, vardbapi, portdbapi, least_change=True): super(SecuritySet, self).__init__() self._settings = settings @@ -29,7 +29,7 @@ class SecuritySet(PackageSet): glsaindexlist = list(glsaindexlist) glsaindexlist.sort() return glsaindexlist - + def load(self): glsaindexlist = self.getGlsaList(self._skip_applied) atomlist = [] @@ -39,7 +39,7 @@ class SecuritySet(PackageSet): if self.useGlsa(myglsa): atomlist += ["="+x for x in myglsa.getMergeList(least_change=self._least_change)] self._setAtoms(self._reduce(atomlist)) - + def _reduce(self, atomlist): mydict = {} for atom in atomlist[:]: @@ -54,7 +54,7 @@ class SecuritySet(PackageSet): atomlist.remove(mydict[cps][0]) mydict[cps] = (atom, cpv) return atomlist - + def useGlsa(self, myglsa): return True @@ -65,12 +65,12 @@ class SecuritySet(PackageSet): myglsa = glsa.Glsa(glsaid, self._settings, self._vardbapi, self._portdbapi) if not myglsa.isVulnerable() and not myglsa.nr in applied_list: myglsa.inject() - + def singleBuilder(cls, options, settings, trees): least_change = not get_boolean(options, "use_emerge_resolver", False) return cls(settings, trees["vartree"].dbapi, trees["porttree"].dbapi, least_change=least_change) singleBuilder = classmethod(singleBuilder) - + class NewGlsaSet(SecuritySet): _skip_applied = True description = "Package set that includes all packages possibly affected by an unapplied GLSA" -- 2.28.0
[gentoo-portage-dev] [PATCH 23/68] lib/portage/package/ebuild/_config/LicenseManager.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/package/ebuild/_config/LicenseManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/package/ebuild/_config/LicenseManager.py b/lib/portage/package/ebuild/_config/LicenseManager.py index fcffdb12e..41cb42baf 100644 --- a/lib/portage/package/ebuild/_config/LicenseManager.py +++ b/lib/portage/package/ebuild/_config/LicenseManager.py @@ -1,4 +1,4 @@ -# Copyright 2010-2015 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ( @@ -62,7 +62,7 @@ class LicenseManager: #No tokens left in atom_license_map, remove it. del self._plicensedict["*/*"] return ret - + def expandLicenseTokens(self, tokens): """ Take a token from ACCEPT_LICENSE or package.license and expand it if it's a group token (indicated by @) or just return it if it's not a -- 2.28.0
[gentoo-portage-dev] [PATCH 29/68] lib/portage/_sets/dbapi.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/dbapi.py | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py index a9e1b6880..15d1c3786 100644 --- a/lib/portage/_sets/dbapi.py +++ b/lib/portage/_sets/dbapi.py @@ -1,4 +1,4 @@ -# Copyright 2007-2019 Gentoo Authors +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import division @@ -48,7 +48,7 @@ class EverythingSet(PackageSet): myatoms.append(atom) self._setAtoms(myatoms) - + def singleBuilder(self, options, settings, trees): return EverythingSet(trees["vartree"].dbapi) singleBuilder = classmethod(singleBuilder) @@ -156,7 +156,7 @@ class VariableSet(EverythingSet): if not (includes or excludes): raise SetConfigError(_("no includes or excludes given")) - + metadatadb = options.get("metadata-source", "vartree") if not metadatadb in trees: raise SetConfigError(_("invalid value '%s' for option metadata-source") % metadatadb) @@ -266,7 +266,7 @@ class UnavailableBinaries(EverythingSet): class CategorySet(PackageSet): _operations = ["merge", "unmerge"] - + def __init__(self, category, dbapi, only_visible=True): super(CategorySet, self).__init__() self._db = dbapi @@ -277,7 +277,7 @@ class CategorySet(PackageSet): else: s="all" self.description = "Package set containing %s packages of category %s" % (s, self._category) - + def load(self): myatoms = [] for cp in self._db.cp_all(): @@ -285,7 +285,7 @@ class CategorySet(PackageSet): if (not self._check) or len(self._db.match(cp)) > 0: myatoms.append(cp) self._setAtoms(myatoms) - + def _builderGetRepository(cls, options, repositories): repository = options.get("repository", "porttree") if not repository in repositories: @@ -296,7 +296,7 @@ class CategorySet(PackageSet): def _builderGetVisible(cls, options): return get_boolean(options, "only_visible", True) _builderGetVisible = classmethod(_builderGetVisible) - + def singleBuilder(cls, options, settings, trees): if not "category" in options: raise SetConfigError(_("no category given")) @@ -307,13 +307,13 @@ class CategorySet(PackageSet): repository = cls._builderGetRepository(options, trees.keys()) visible = cls._builderGetVisible(options) - + return CategorySet(category, dbapi=trees[repository].dbapi, only_visible=visible) singleBuilder = classmethod(singleBuilder) def multiBuilder(cls, options, settings, trees): rValue = {} - + if "categories" in options: categories = options["categories"].split() invalid = set(categories).difference(settings.categories) @@ -321,14 +321,14 @@ class CategorySet(PackageSet): raise SetConfigError(_("invalid categories: %s") % ", ".join(list(invalid))) else: categories = settings.categories - + repository = cls._builderGetRepository(options, trees.keys()) visible = cls._builderGetVisible(options) name_pattern = options.get("name_pattern", "$category/*") - + if not "$category" in name_pattern and not "${category}" in name_pattern: raise SetConfigError(_("name_pattern doesn't include $category placeholder")) - + for cat in categories: myset = CategorySet(cat, trees[repository].dbapi, only_visible=visible) myname = name_pattern.replace("$category", cat) @@ -347,7 +347,7 @@ class AgeSet(EverythingSet): self._age = age def _filter(self, atom): - + cpv = self._db.match(atom)[0] try: date, = self._db.aux_get(cpv, self._aux_keys) @@ -359,7 +359,7 @@ class AgeSet(EverythingSet): or (self._mode == "newer" and age >= self._age)): return False return True - + def singleBuilder(cls, options, settings, trees): mode = options.get("mode", "older") if str(mode).lower() not in ["newer", "older"]: -- 2.28.0
[gentoo-portage-dev] [PATCH 12/68] lib/portage/elog/mod_mail.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/elog/mod_mail.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/elog/mod_mail.py b/lib/portage/elog/mod_mail.py index 086c683a6..4edf507eb 100644 --- a/lib/portage/elog/mod_mail.py +++ b/lib/portage/elog/mod_mail.py @@ -1,5 +1,5 @@ # elog/mod_mail.py - elog dispatch module -# Copyright 2006-2007 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage.mail, socket @@ -12,7 +12,7 @@ def process(mysettings, key, logentries, fulltext): myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0] else: myrecipient = "root@localhost" - + myfrom = mysettings["PORTAGE_ELOG_MAILFROM"] myfrom = myfrom.replace("${HOST}", socket.getfqdn()) mysubject = mysettings["PORTAGE_ELOG_MAILSUBJECT"] -- 2.28.0
[gentoo-portage-dev] [PATCH 19/68] lib/portage/xpak.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/xpak.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/xpak.py b/lib/portage/xpak.py index 3401c5073..746ef6f5a 100644 --- a/lib/portage/xpak.py +++ b/lib/portage/xpak.py @@ -151,11 +151,11 @@ def xsplit(infile): encoding=_encodings['fs'], errors='strict'), 'rb') mydat = myfile.read() myfile.close() - + splits = xsplit_mem(mydat) if not splits: return False - + myfile = open(_unicode_encode(infile + '.index', encoding=_encodings['fs'], errors='strict'), 'wb') myfile.write(splits[0]) @@ -236,7 +236,7 @@ def searchindex(myindex, myitem): datalen = decodeint(myindex[startpos + 8 + mytestlen:startpos + 12 + mytestlen]) return datapos, datalen startpos = startpos + mytestlen + 12 - + def getitem(myid, myitem): myindex = myid[0] mydata = myid[1] -- 2.28.0
[gentoo-portage-dev] [PATCH 14/68] lib/portage/elog/messages.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/elog/messages.py | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/portage/elog/messages.py b/lib/portage/elog/messages.py index 3731e6c4d..dd93e2f88 100644 --- a/lib/portage/elog/messages.py +++ b/lib/portage/elog/messages.py @@ -1,5 +1,5 @@ # elog/messages.py - elog core functions -# Copyright 2006-2011 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage @@ -27,7 +27,7 @@ _log_levels = frozenset([ ]) def collect_ebuild_messages(path): - """ Collect elog messages generated by the bash logging function stored + """ Collect elog messages generated by the bash logging function stored at 'path'. """ mylogfiles = None @@ -70,7 +70,7 @@ def collect_ebuild_messages(path): if lastmsgtype is None: lastmsgtype = msgtype - + if msgtype == lastmsgtype: msgcontent.append(msg) else: @@ -92,7 +92,7 @@ def collect_ebuild_messages(path): _msgbuffer = {} def _elog_base(level, msg, phase="other", key=None, color=None, out=None): - """ Backend for the other messaging functions, should not be called + """ Backend for the other messaging functions, should not be called directly. """ @@ -157,11 +157,11 @@ def collect_messages(key=None, phasefilter=None): return rValue def _reset_buffer(): - """ Reset the internal message buffer when it has been processed, + """ Reset the internal message buffer when it has been processed, should not be called directly. """ global _msgbuffer - + _msgbuffer = {} # creating and exporting the actual messaging functions @@ -180,7 +180,7 @@ class _make_msgfunction: def __call__(self, msg, phase="other", key=None, out=None): """ Display and log a message assigned to the given key/cpv. - """ + """ _elog_base(self._level, msg, phase=phase, key=key, color=self._color, out=out) -- 2.28.0
[gentoo-portage-dev] [PATCH 08/68] lib/portage/tests/resolver/test_required_use.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/resolver/test_required_use.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/resolver/test_required_use.py b/lib/portage/tests/resolver/test_required_use.py index c679ce300..5c45ffe5e 100644 --- a/lib/portage/tests/resolver/test_required_use.py +++ b/lib/portage/tests/resolver/test_required_use.py @@ -1,4 +1,4 @@ -# Copyright 2010-2018 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -110,7 +110,7 @@ class RequiredUSETestCase(TestCase): playground.cleanup() def testRequiredUseOrDeps(self): - + ebuilds = { "dev-libs/A-1": { "IUSE": "+x +y", "REQUIRED_USE": "^^ ( x y )", "EAPI": "4" }, "dev-libs/B-1": { "IUSE": "+x +y", "REQUIRED_USE": "", "EAPI": "4" }, -- 2.28.0
[gentoo-portage-dev] [PATCH 25/68] lib/portage/_sets/files.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/files.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/portage/_sets/files.py b/lib/portage/_sets/files.py index e045701ff..57e5aa34f 100644 --- a/lib/portage/_sets/files.py +++ b/lib/portage/_sets/files.py @@ -1,4 +1,4 @@ -# Copyright 2007-2014 Gentoo Foundation +# Copyright 2007-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import errno @@ -27,7 +27,7 @@ class StaticFileSet(EditablePackageSet): _operations = ["merge", "unmerge"] _repopath_match = re.compile(r'.*\$\{repository:(?P.+)\}.*') _repopath_sub = re.compile(r'\$\{repository:(?P.+)\}') - + def __init__(self, filename, greedy=False, dbapi=None): super(StaticFileSet, self).__init__(allow_repo=True) self._filename = filename @@ -96,7 +96,7 @@ class StaticFileSet(EditablePackageSet): atoms = iter(data) self._setAtoms(atoms) self._mtime = mtime - + def singleBuilder(self, options, settings, trees): if not "filename" in options: raise SetConfigError(_("no filename specified")) @@ -111,7 +111,7 @@ class StaticFileSet(EditablePackageSet): raise SetConfigError(_("Could not find repository '%s'") % match.groupdict()["reponame"]) return StaticFileSet(filename, greedy=greedy, dbapi=trees["vartree"].dbapi) singleBuilder = classmethod(singleBuilder) - + def multiBuilder(self, options, settings, trees): rValue = {} directory = options.get("directory", @@ -185,13 +185,13 @@ class ConfigFileSet(PackageSet): def load(self): data, errors = self.loader.load() self._setAtoms(iter(data)) - + def singleBuilder(self, options, settings, trees): if not "filename" in options: raise SetConfigError(_("no filename specified")) return ConfigFileSet(options["filename"]) singleBuilder = classmethod(singleBuilder) - + def multiBuilder(self, options, settings, trees): rValue = {} directory = options.get("directory", -- 2.28.0
[gentoo-portage-dev] [PATCH 10/68] lib/portage/tests/lafilefixer/test_lafilefixer.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/lafilefixer/test_lafilefixer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/lafilefixer/test_lafilefixer.py b/lib/portage/tests/lafilefixer/test_lafilefixer.py index 0bcffaada..fd5dc4b53 100644 --- a/lib/portage/tests/lafilefixer/test_lafilefixer.py +++ b/lib/portage/tests/lafilefixer/test_lafilefixer.py @@ -1,5 +1,5 @@ # test_lafilefixer.py -- Portage Unit Testing Functionality -# Copyright 2010 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -53,7 +53,7 @@ class test_lafilefixer(TestCase): b"old_library='libpdf.a'\n" + \ b"dependency_libs=' -L/usr/lib64 -la -lb -lc'\n" + \ b"inherited_linker_flags=' -pthread'\n" - #reorder + #reorder yield b"dlname='libfoo.so.1'\n" + \ b"library_names='libfoo.so.1.0.2 libfoo.so.1 libfoo.so'\n" + \ b"old_library='libpdf.a'\n" + \ -- 2.28.0
[gentoo-portage-dev] [PATCH 15/68] lib/portage/elog/__init__.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/elog/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/elog/__init__.py b/lib/portage/elog/__init__.py index ad6048481..ae855b674 100644 --- a/lib/portage/elog/__init__.py +++ b/lib/portage/elog/__init__.py @@ -1,5 +1,5 @@ # elog/__init__.py - elog core functions -# Copyright 2006-2014 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import sys @@ -92,7 +92,7 @@ _elog_atexit_handlers = [] def elog_process(cpv, mysettings, phasefilter=None): global _elog_atexit_handlers - + logsystems = mysettings.get("PORTAGE_ELOG_SYSTEM","").split() for s in logsystems: # allow per module overrides of PORTAGE_ELOG_CLASSES -- 2.28.0
[gentoo-portage-dev] [PATCH 20/68] lib/_emerge/resolver/circular_dependency.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/_emerge/resolver/circular_dependency.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/_emerge/resolver/circular_dependency.py b/lib/_emerge/resolver/circular_dependency.py index d0c026dad..109f22b9c 100644 --- a/lib/_emerge/resolver/circular_dependency.py +++ b/lib/_emerge/resolver/circular_dependency.py @@ -1,4 +1,4 @@ -# Copyright 2010-2013 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -134,10 +134,10 @@ class circular_dependency_handler: raise affecting_use = set() - # Make sure we don't want to change a flag that is + # Make sure we don't want to change a flag that is # a) in use.mask or use.force # b) changed by autounmask - + usemask, useforce = self._get_use_mask_and_force(parent) autounmask_changes = self._get_autounmask_changes(parent) untouchable_flags = frozenset(chain(usemask, useforce, autounmask_changes)) -- 2.28.0
[gentoo-portage-dev] [PATCH 24/68] lib/portage/dbapi/porttree.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/dbapi/porttree.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py index 4b714a919..9ad8addc7 100644 --- a/lib/portage/dbapi/porttree.py +++ b/lib/portage/dbapi/porttree.py @@ -220,7 +220,7 @@ class portdbapi(dbapi): # instance that is passed in. self.doebuild_settings = config(clone=self.settings) self.depcachedir = os.path.realpath(self.settings.depcachedir) - + if os.environ.get("SANDBOX_ON") == "1": # Make api consumers exempt from sandbox violations # when doing metadata cache updates. @@ -453,7 +453,7 @@ class portdbapi(dbapi): return self.settings.repositories.ignored_repos def findname2(self, mycpv, mytree=None, myrepo=None): - """ + """ Returns the location of the CPV, and what overlay it was in. Searches overlays first, then PORTDIR; this allows us to return the first matching file. As opposed to starting in portdir and then doing overlays @@ -822,7 +822,7 @@ class portdbapi(dbapi): pkgdir, self.settings["DISTDIR"]) checksums = mf.getDigests() if not checksums: - if debug: + if debug: writemsg(_("[empty/missing/bad digest]: %s\n") % (mypkg,)) return {} filesdict={} @@ -935,7 +935,7 @@ class portdbapi(dbapi): def cp_all(self, categories=None, trees=None, reverse=False, sort=True): """ This returns a list of all keys in our tree or trees - @param categories: optional list of categories to search or + @param categories: optional list of categories to search or defaults to self.settings.categories @param trees: optional list of trees to search the categories in or defaults to self.porttrees @@ -1314,7 +1314,7 @@ class portagetree: settings=None): """ Constructor for a PortageTree - + @param root: deprecated, defaults to settings['ROOT'] @type root: String/Path @param virtual: UNUSED -- 2.28.0
[gentoo-portage-dev] [PATCH 21/68] lib/portage/tests/resolver/test_circular_dependencies.py: fix whitespace
Signed-off-by: Aaron Bauman --- .../tests/resolver/test_circular_dependencies.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portage/tests/resolver/test_circular_dependencies.py b/lib/portage/tests/resolver/test_circular_dependencies.py index f8331ac4e..7bb6db18b 100644 --- a/lib/portage/tests/resolver/test_circular_dependencies.py +++ b/lib/portage/tests/resolver/test_circular_dependencies.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -13,14 +13,14 @@ class CircularDependencyTestCase(TestCase): # is there anything else than priority buildtime and runtime? # play with use.{mask,force} # play with REQUIRED_USE - + def testCircularDependency(self): ebuilds = { - "dev-libs/Z-1": { "DEPEND": "foo? ( !bar? ( dev-libs/Y ) )", "IUSE": "+foo bar", "EAPI": 1 }, - "dev-libs/Z-2": { "DEPEND": "foo? ( dev-libs/Y ) !bar? ( dev-libs/Y )", "IUSE": "+foo bar", "EAPI": 1 }, - "dev-libs/Z-3": { "DEPEND": "foo? ( !bar? ( dev-libs/Y ) ) foo? ( dev-libs/Y ) !bar? ( dev-libs/Y )", "IUSE": "+foo bar", "EAPI": 1 }, + "dev-libs/Z-1": { "DEPEND": "foo? ( !bar? ( dev-libs/Y ) )", "IUSE": "+foo bar", "EAPI": 1 }, + "dev-libs/Z-2": { "DEPEND": "foo? ( dev-libs/Y ) !bar? ( dev-libs/Y )", "IUSE": "+foo bar", "EAPI": 1 }, + "dev-libs/Z-3": { "DEPEND": "foo? ( !bar? ( dev-libs/Y ) ) foo? ( dev-libs/Y ) !bar? ( dev-libs/Y )", "IUSE": "+foo bar", "EAPI": 1 }, "dev-libs/Y-1": { "DEPEND": "dev-libs/Z" }, "dev-libs/W-1": { "DEPEND": "dev-libs/Z[foo] dev-libs/Y", "EAPI": 2 }, "dev-libs/W-2": { "DEPEND": "dev-libs/Z[foo=] dev-libs/Y", "IUSE": "+foo", "EAPI": 2 }, -- 2.28.0
[gentoo-portage-dev] [PATCH 16/68] lib/portage/dbapi/__init__.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/dbapi/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py index bea5a82cb..d7facc9b6 100644 --- a/lib/portage/dbapi/__init__.py +++ b/lib/portage/dbapi/__init__.py @@ -1,4 +1,4 @@ -# Copyright 1998-2019 Gentoo Authors +# Copyright 1998-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 __all__ = ["dbapi"] @@ -107,12 +107,12 @@ class dbapi: mycpv - "sys-apps/foo-1.0" mylist - ["SLOT","DEPEND","HOMEPAGE"] myrepo - The repository name. - Returns: + Returns: a list of results, in order of keys in mylist, such as: ["0",">=sys-libs/bar-1.0","http://www.foo.com;] or [] if mycpv not found' """ raise NotImplementedError - + def aux_update(self, cpv, metadata_updates): """ Args: -- 2.28.0
[gentoo-portage-dev] [PATCH 17/68] lib/portage/_sets/base.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/_sets/base.py | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/portage/_sets/base.py b/lib/portage/_sets/base.py index 06e0a3cd4..f03df0320 100644 --- a/lib/portage/_sets/base.py +++ b/lib/portage/_sets/base.py @@ -9,13 +9,13 @@ from portage.versions import cpv_getkey OPERATIONS = ["merge", "unmerge"] class PackageSet: - # Set this to operations that are supported by your subclass. While + # Set this to operations that are supported by your subclass. While # technically there is no difference between "merge" and "unmerge" regarding # package sets, the latter doesn't make sense for some sets like "system" # or "security" and therefore isn't supported by them. _operations = ["merge"] description = "generic package set" - + def __init__(self, allow_wildcard=False, allow_repo=False): self._atoms = set() self._atommap = ExtendedAtomDict(set) @@ -30,7 +30,7 @@ class PackageSet: def __contains__(self, atom): self._load() return atom in self._atoms or atom in self._nonatoms - + def __iter__(self): self._load() for x in self._atoms: @@ -96,12 +96,12 @@ class PackageSet: if match_from_list(a, [cpv]): return True return False - + def getMetadata(self, key): if hasattr(self, key.lower()): return getattr(self, key.lower()) return "" - + def _updateAtomMap(self, atoms=None): """Update self._atommap for specific atoms or all atoms.""" if not atoms: @@ -109,7 +109,7 @@ class PackageSet: atoms = self._atoms for a in atoms: self._atommap.setdefault(a.cp, set()).add(a) - + # Not sure if this one should really be in PackageSet def findAtomForPackage(self, pkg, modified_use=None): """Return the best match for a given package from the arguments, or @@ -154,7 +154,7 @@ class EditablePackageSet(PackageSet): def __init__(self, allow_wildcard=False, allow_repo=False): super(EditablePackageSet, self).__init__(allow_wildcard=allow_wildcard, allow_repo=allow_repo) - + def update(self, atoms): self._load() modified = False @@ -179,7 +179,7 @@ class EditablePackageSet(PackageSet): self._updateAtomMap(atoms=normal_atoms) if modified: self.write() - + def add(self, atom): self.update([atom]) @@ -220,7 +220,7 @@ class InternalPackageSet(EditablePackageSet): def clear(self): self._atoms.clear() self._updateAtomMap() - + def load(self): pass @@ -232,10 +232,10 @@ class DummyPackageSet(PackageSet): super(DummyPackageSet, self).__init__() if atoms: self._setAtoms(atoms) - + def load(self): pass - + def singleBuilder(cls, options, settings, trees): atoms = options.get("packages", "").split() return DummyPackageSet(atoms=atoms) -- 2.28.0
[gentoo-portage-dev] [PATCH 11/68] lib/portage/elog/mod_mail_summary.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/elog/mod_mail_summary.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/elog/mod_mail_summary.py b/lib/portage/elog/mod_mail_summary.py index 31c9d25b0..ac260880e 100644 --- a/lib/portage/elog/mod_mail_summary.py +++ b/lib/portage/elog/mod_mail_summary.py @@ -1,5 +1,5 @@ # elog/mod_mail_summary.py - elog dispatch module -# Copyright 2006-2010 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage @@ -58,7 +58,7 @@ def _finalize(mysettings, items): myrecipient = mysettings["PORTAGE_ELOG_MAILURI"].split()[0] else: myrecipient = "root@localhost" - + myfrom = mysettings.get("PORTAGE_ELOG_MAILFROM", "") myfrom = myfrom.replace("${HOST}", socket.getfqdn()) mysubject = mysettings.get("PORTAGE_ELOG_MAILSUBJECT", "") -- 2.28.0
[gentoo-portage-dev] [PATCH 13/68] lib/portage/elog/mod_custom.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/elog/mod_custom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/elog/mod_custom.py b/lib/portage/elog/mod_custom.py index e1a5223d6..836bdad62 100644 --- a/lib/portage/elog/mod_custom.py +++ b/lib/portage/elog/mod_custom.py @@ -1,12 +1,12 @@ # elog/mod_custom.py - elog dispatch module -# Copyright 2006-2007 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import portage.elog.mod_save, portage.process, portage.exception def process(mysettings, key, logentries, fulltext): elogfilename = portage.elog.mod_save.process(mysettings, key, logentries, fulltext) - + if not mysettings.get("PORTAGE_ELOG_COMMAND"): raise portage.exception.MissingParameter("!!! Custom logging requested but PORTAGE_ELOG_COMMAND is not defined") else: -- 2.28.0
[gentoo-portage-dev] [PATCH 09/68] lib/portage/tests/util/test_grabdict.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/util/test_grabdict.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/tests/util/test_grabdict.py b/lib/portage/tests/util/test_grabdict.py index e62a75dcc..4266d9226 100644 --- a/lib/portage/tests/util/test_grabdict.py +++ b/lib/portage/tests/util/test_grabdict.py @@ -1,11 +1,11 @@ # test_grabDict.py -- Portage Unit Testing Functionality -# Copyright 2006-2010 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase #from portage.util import grabdict class GrabDictTestCase(TestCase): - + def testGrabDictPass(self): pass -- 2.28.0
[gentoo-portage-dev] [PATCH 18/68] lib/portage/output.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/output.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/output.py b/lib/portage/output.py index 4c8f8a187..ab99caf98 100644 --- a/lib/portage/output.py +++ b/lib/portage/output.py @@ -159,7 +159,7 @@ def _parse_color_map(config_root='/', onerror=None): """ global codes, _styles myfile = os.path.join(config_root, COLOR_MAP_FILE) - ansi_code_pattern = re.compile("^[0-9;]*m$") + ansi_code_pattern = re.compile("^[0-9;]*m$") quotes = '\'"' def strip_quotes(token): if token[0] in quotes and token[0] == token[-1]: @@ -174,10 +174,10 @@ def _parse_color_map(config_root='/', onerror=None): for lineno, line in enumerate(lines): commenter_pos = line.find("#") line = line[:commenter_pos].strip() - + if len(line) == 0: continue - + split_line = line.split("=") if len(split_line) != 2: e = ParseError(_("'%s', line %s: expected exactly one occurrence of '=' operator") % \ -- 2.28.0
[gentoo-portage-dev] [PATCH 06/68] lib/_emerge/resolver/slot_collision.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/_emerge/resolver/slot_collision.py | 60 +- 1 file changed, 29 insertions(+), 31 deletions(-) diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py index 7accb89f4..7536ce7a2 100644 --- a/lib/_emerge/resolver/slot_collision.py +++ b/lib/_emerge/resolver/slot_collision.py @@ -90,26 +90,26 @@ class slot_conflict_handler: self.all_conflicts = [] for conflict in depgraph._dynamic_config._package_tracker.slot_conflicts(): self.all_conflicts.append((conflict.root, conflict.atom, conflict.pkgs)) - + #A dict mapping packages to pairs of parent package #and parent atom self.all_parents = depgraph._dynamic_config._parent_atoms - + #set containing all nodes that are part of a slot conflict conflict_nodes = set() - + #a list containing list of packages that form a slot conflict conflict_pkgs = [] - + #a list containing sets of (parent, atom) pairs that have pulled packages #into the same slot all_conflict_atoms_by_slotatom = [] - + #fill conflict_pkgs, all_conflict_atoms_by_slotatom for root, atom, pkgs in self.all_conflicts: conflict_pkgs.append(list(pkgs)) all_conflict_atoms_by_slotatom.append(set()) - + for pkg in pkgs: conflict_nodes.add(pkg) for ppkg, atom in self.all_parents.get(pkg): @@ -120,7 +120,7 @@ class slot_conflict_handler: #If any conflict package was pulled in only by unspecific atoms, then #the user forgot to enable --newuse and/or --update. self.conflict_is_unspecific = False - + #Indicate if the conflict is caused by incompatible version requirements #cat/pkg-2 pulled in, but a parent requires
[gentoo-portage-dev] [PATCH 03/68] lib/portage/tests/dep/testAtom.py: fix whitespace
* Fix whitespace * Update copyright Signed-off-by: Aaron Bauman --- lib/portage/tests/dep/testAtom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/dep/testAtom.py b/lib/portage/tests/dep/testAtom.py index b454782d1..d0bb344e2 100644 --- a/lib/portage/tests/dep/testAtom.py +++ b/lib/portage/tests/dep/testAtom.py @@ -1,4 +1,4 @@ -# Copyright 2006-2019 Gentoo Authors +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -252,7 +252,7 @@ class TestAtom(TestCase): ("dev-libs/B[!x=]", [], [], ["x"], "dev-libs/B[!x=]"), ("dev-libs/B[!x?]", [], [], ["x"], "dev-libs/B[!x?]"), ) - + test_cases_xfail = ( ("dev-libs/A[a,b=,!c=,d?,!e?,-f]", [], ["a", "b", "c", "d", "e", "f"], None), ) @@ -327,7 +327,7 @@ class TestAtom(TestCase): ("dev-libs/A[a,b=,!c=,d?,!e?,-f]", [], ["a", "b", "c"], "dev-libs/A[a,b,-c,d,-e,-f]"), ("dev-libs/A[a,b=,!c=,d?,!e?,-f]", ["d", "e", "f"], [], "dev-libs/A[a,b,-b,c,-c,-e,-f]"), ("dev-libs/A[a,b=,!c=,d?,!e?,-f]", [], ["d", "e", "f"], "dev-libs/A[a,b,-b,c,-c,d,-f]"), - + ("dev-libs/A[a(-),b(+)=,!c(-)=,d(+)?,!e(-)?,-f(+)]", ["a", "b", "c", "d", "e", "f"], [], "dev-libs/A[a(-),-b(+),c(-),-e(-),-f(+)]"), ("dev-libs/A[a(+),b(-)=,!c(+)=,d(-)?,!e(+)?,-f(-)]", -- 2.28.0
[gentoo-portage-dev] [PATCH 02/68] lib/portage/tests/util/test_normalizedPath.py: fix whitespace
* Fix whitespace * Update copyright Signed-off-by: Aaron Bauman --- lib/portage/tests/util/test_normalizedPath.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/tests/util/test_normalizedPath.py b/lib/portage/tests/util/test_normalizedPath.py index f993886ac..6e5b53643 100644 --- a/lib/portage/tests/util/test_normalizedPath.py +++ b/lib/portage/tests/util/test_normalizedPath.py @@ -1,13 +1,13 @@ # test_normalizePath.py -- Portage Unit Testing Functionality -# Copyright 2006 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase class NormalizePathTestCase(TestCase): - + def testNormalizePath(self): - + from portage.util import normalize_path path = "///foo/bar/baz" good = "/foo/bar/baz" -- 2.28.0
[gentoo-portage-dev] [PATCH 05/68] lib/portage/cvstree.py: fix whitespace
* Fix whitespace * Update copyright Signed-off-by: Aaron Bauman --- lib/portage/cvstree.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/portage/cvstree.py b/lib/portage/cvstree.py index 796462af2..cfcb9f48c 100644 --- a/lib/portage/cvstree.py +++ b/lib/portage/cvstree.py @@ -1,5 +1,5 @@ # cvstree.py -- cvs tree utilities -# Copyright 1998-2017 Gentoo Foundation +# Copyright 1998-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -123,7 +123,7 @@ def findchanged(entries, recursive=0, basedir=""): mylist += findchanged(entries["dirs"][mydir], recursive, basedir + mydir) return mylist - + def findmissing(entries, recursive=0, basedir=""): """Recurses the entries tree to find all elements that are listed in the cvs tree but do not exist on the filesystem. Returns a list of paths, @@ -205,7 +205,7 @@ def apply_cvsignore_filter(files): else: x += 1 return files - + def getentries(mydir, recursive=0): """Scans the given directory and returns a datadict of all the entries in the directory separated as a dirs dict and a files dict. -- 2.28.0
[gentoo-portage-dev] [PATCH 01/68] lib/portage/util/_dyn_libs/PreservedLibsRegistry.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/util/_dyn_libs/PreservedLibsRegistry.py | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py b/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py index d6f1d5e29..53eb63a5b 100644 --- a/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py +++ b/lib/portage/util/_dyn_libs/PreservedLibsRegistry.py @@ -34,7 +34,7 @@ class PreservedLibsRegistry: } def __init__(self, root, filename): - """ + """ @param root: root used to check existence of paths in pruneNonExisting @type root: String @param filename: absolute path for saving the preserved libs records @@ -149,7 +149,7 @@ class PreservedLibsRegistry: def register(self, cpv, slot, counter, paths): """ Register new objects in the registry. If there is a record with the - same packagename (internally derived from cpv) and slot it is + same packagename (internally derived from cpv) and slot it is overwritten with the new data. @param cpv: package instance that owns the objects @type cpv: CPV (as String) @@ -181,7 +181,7 @@ class PreservedLibsRegistry: @type slot: String """ self.register(cpv, slot, counter, []) - + def pruneNonExisting(self): """ Remove all records for objects that no longer exist on the filesystem. """ @@ -224,13 +224,13 @@ class PreservedLibsRegistry: self._data[cps] = (cpv, counter, paths) else: del self._data[cps] - + def hasEntries(self): """ Check if this registry contains any records. """ if self._data is None: self.load() return len(self._data) > 0 - + def getPreservedLibs(self): """ Return a mapping of packages->preserved objects. @return mapping of package instances to preserved objects -- 2.28.0
[gentoo-portage-dev] [PATCH 07/68] lib/portage/tests/resolver/test_eapi.py: fix whitespace
Signed-off-by: Aaron Bauman --- lib/portage/tests/resolver/test_eapi.py | 80 - 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/lib/portage/tests/resolver/test_eapi.py b/lib/portage/tests/resolver/test_eapi.py index 50b9d90da..f8cf55b94 100644 --- a/lib/portage/tests/resolver/test_eapi.py +++ b/lib/portage/tests/resolver/test_eapi.py @@ -1,4 +1,4 @@ -# Copyright 2010-2018 Gentoo Foundation +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from portage.tests import TestCase @@ -10,58 +10,58 @@ class EAPITestCase(TestCase): ebuilds = { #EAPI-1: IUSE-defaults - "dev-libs/A-1.0": { "EAPI": 0, "IUSE": "+foo" }, - "dev-libs/A-1.1": { "EAPI": 1, "IUSE": "+foo" }, - "dev-libs/A-1.2": { "EAPI": 2, "IUSE": "+foo" }, - "dev-libs/A-1.3": { "EAPI": 3, "IUSE": "+foo" }, - "dev-libs/A-1.4": { "EAPI": "4", "IUSE": "+foo" }, + "dev-libs/A-1.0": { "EAPI": 0, "IUSE": "+foo" }, + "dev-libs/A-1.1": { "EAPI": 1, "IUSE": "+foo" }, + "dev-libs/A-1.2": { "EAPI": 2, "IUSE": "+foo" }, + "dev-libs/A-1.3": { "EAPI": 3, "IUSE": "+foo" }, + "dev-libs/A-1.4": { "EAPI": "4", "IUSE": "+foo" }, #EAPI-1: slot deps - "dev-libs/A-2.0": { "EAPI": 0, "DEPEND": "dev-libs/B:0" }, - "dev-libs/A-2.1": { "EAPI": 1, "DEPEND": "dev-libs/B:0" }, - "dev-libs/A-2.2": { "EAPI": 2, "DEPEND": "dev-libs/B:0" }, - "dev-libs/A-2.3": { "EAPI": 3, "DEPEND": "dev-libs/B:0" }, - "dev-libs/A-2.4": { "EAPI": "4", "DEPEND": "dev-libs/B:0" }, + "dev-libs/A-2.0": { "EAPI": 0, "DEPEND": "dev-libs/B:0" }, + "dev-libs/A-2.1": { "EAPI": 1, "DEPEND": "dev-libs/B:0" }, + "dev-libs/A-2.2": { "EAPI": 2, "DEPEND": "dev-libs/B:0" }, + "dev-libs/A-2.3": { "EAPI": 3, "DEPEND": "dev-libs/B:0" }, + "dev-libs/A-2.4": { "EAPI": "4", "DEPEND": "dev-libs/B:0" }, #EAPI-2: use deps - "dev-libs/A-3.0": { "EAPI": 0, "DEPEND": "dev-libs/B[foo]" }, - "dev-libs/A-3.1": { "EAPI": 1, "DEPEND": "dev-libs/B[foo]" }, - "dev-libs/A-3.2": { "EAPI": 2, "DEPEND": "dev-libs/B[foo]" }, - "dev-libs/A-3.3": { "EAPI": 3, "DEPEND": "dev-libs/B[foo]" }, - "dev-libs/A-3.4": { "EAPI": "4", "DEPEND": "dev-libs/B[foo]" }, + "dev-libs/A-3.0": { "EAPI": 0, "DEPEND": "dev-libs/B[foo]" }, + "dev-libs/A-3.1": { "EAPI": 1, "DEPEND": "dev-libs/B[foo]" }, + "dev-libs/A-3.2": { "EAPI": 2, "DEPEND": "dev-libs/B[foo]" }, + "dev-libs/A-3.3": { "EAPI": 3, "DEPEND": "dev-libs/B[foo]" }, + "dev-libs/A-3.4": { "EAPI": "4", "DEPEND": "dev-libs/B[foo]" }, #EAPI-2: strong blocks - "dev-libs/A-4.0": { "EAPI": 0, "DEPEND": "!!dev-libs/B" }, - "dev-libs/A-4.1": { "EAPI": 1, "DEPEND": "!!dev-libs/B" }, - "dev-libs/A-4.2": { "EAPI": 2, "DEPEND": "!!dev-libs/B" }, - "dev-libs/A-4.3":
[gentoo-portage-dev] [PATCH 04/68] lib/portage/glsa.py: fix whitespace
* Fix whitespace * Update copyright Signed-off-by: Aaron Bauman --- lib/portage/glsa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/portage/glsa.py b/lib/portage/glsa.py index 4066d6747..12b33f45d 100644 --- a/lib/portage/glsa.py +++ b/lib/portage/glsa.py @@ -1,4 +1,4 @@ -# Copyright 2003-2017 Gentoo Foundation +# Copyright 2003-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 from __future__ import absolute_import @@ -34,7 +34,7 @@ SPACE_ESCAPE = "!;_" # some random string to mark spaces that should be preserv def get_applied_glsas(settings): """ Return a list of applied or injected GLSA IDs - + @type settings: portage.config @param settings: portage config instance @rtype: list -- 2.28.0
[gentoo-portage-dev] [PATCH] lib/portage/util/_desktop_entry.py: Add previous start year to copyright
* This fixes the drop of 2012 from the starting copyright year. Suggested-by: Ulrich Mueller Signed-off-by: Aaron Bauman --- lib/portage/util/_desktop_entry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/portage/util/_desktop_entry.py b/lib/portage/util/_desktop_entry.py index 68cec7a61..4a49cd4ce 100644 --- a/lib/portage/util/_desktop_entry.py +++ b/lib/portage/util/_desktop_entry.py @@ -1,4 +1,4 @@ -# Copyright 2020 Gentoo Authors +# Copyright 2012-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import re -- 2.28.0
[gentoo-portage-dev] [PATCH 11/18] lib/portage/elog/mod_syslog.py: drop unused-import
* Drop unused-import * Update copyright Signed-off-by: Aaron Bauman --- lib/portage/elog/mod_syslog.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/portage/elog/mod_syslog.py b/lib/portage/elog/mod_syslog.py index 4dabacc52..caf6c1f08 100644 --- a/lib/portage/elog/mod_syslog.py +++ b/lib/portage/elog/mod_syslog.py @@ -1,11 +1,9 @@ # elog/mod_syslog.py - elog dispatch module -# Copyright 2006-2014 Gentoo Foundation +# Copyright 2006-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import syslog from portage.const import EBUILD_PHASES -from portage import _encodings - _pri = { "INFO" : syslog.LOG_INFO, -- 2.28.0
[gentoo-portage-dev] [PATCH 15/18] lib/portage/tests/util/test_getconfig.py: drop unused-import
* Drop unused-import * Update copyright Signed-off-by: Aaron Bauman --- lib/portage/tests/util/test_getconfig.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/portage/tests/util/test_getconfig.py b/lib/portage/tests/util/test_getconfig.py index a0d00d0e1..90e039cba 100644 --- a/lib/portage/tests/util/test_getconfig.py +++ b/lib/portage/tests/util/test_getconfig.py @@ -1,4 +1,4 @@ -# Copyright 2010-2019 Gentoo Authors +# Copyright 2010-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 import tempfile @@ -6,7 +6,6 @@ import tempfile from portage import os from portage import shutil from portage import _unicode_encode -from portage.const import PORTAGE_BASE_PATH from portage.tests import TestCase from portage.util import getconfig from portage.exception import ParseError -- 2.28.0
[gentoo-portage-dev] [PATCH 12/18] lib/portage/package/ebuild/prepare_build_dirs.py: drop unused-import
Signed-off-by: Aaron Bauman --- lib/portage/package/ebuild/prepare_build_dirs.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/portage/package/ebuild/prepare_build_dirs.py b/lib/portage/package/ebuild/prepare_build_dirs.py index b63cd89fa..080d5309f 100644 --- a/lib/portage/package/ebuild/prepare_build_dirs.py +++ b/lib/portage/package/ebuild/prepare_build_dirs.py @@ -18,7 +18,6 @@ from portage.output import colorize from portage.util import apply_recursive_permissions, \ apply_secpass_permissions, ensure_dirs, normalize_path, writemsg from portage.util.install_mask import _raise_exc -from portage.const import EPREFIX def prepare_build_dirs(myroot=None, settings=None, cleanup=False): """ -- 2.28.0