Re: [gentoo-portage-dev] [PATCH] lib/*: exempt two core files from ungrouped-imports check
On 8/6/20 5:03 PM, Aaron Bauman wrote: > * 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(-) Thanks, merged: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0dffa633987a49c1a1d7e95edfe6afeb6269d1e5 -- Thanks, Zac signature.asc Description: OpenPGP digital signature
Re: [gentoo-portage-dev] [PATCH] *: drop all import __future__ statements
On 8/6/20 6:12 PM, Aaron Bauman wrote: > * 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(-) Thanks, merged: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d695d866e4e7b2ab79264508f1520f89a5585e04 -- Thanks, Zac signature.asc Description: OpenPGP digital signature
[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
Re: [gentoo-portage-dev] [PATCH] lib/*: fix superfluous-parens and enable check
On 8/5/20 9:05 PM, Aaron Bauman wrote: > 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(-) Thanks, merged: https://gitweb.gentoo.org/proj/portage.git/commit/?id=897be5c2874ed3edda7b3af84e6ddb34c3095b71 -- Thanks, Zac signature.asc Description: OpenPGP digital signature
Re: [gentoo-portage-dev] [PATCH 6/6] pylintrc: enable multiple-imports check
On 8/5/20 4:51 PM, Aaron Bauman wrote: > 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, > Thanks, merged the whole series: https://gitweb.gentoo.org/proj/portage.git/commit/?id=bc0e50294a96623fdfcb51d7cea4c3d2a4c5e261 -- Thanks, Zac signature.asc Description: OpenPGP digital signature