From 50123e60ff9accf3e77c1ccc64eef85f24958c88 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:03:06 -0800 Subject: [PATCH 1/9] eclean/clean.py: pyflakes cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/eclean/clean.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py index b5323ed8..18f90ef1 100644 --- a/pym/gentoolkit/eclean/clean.py +++ b/pym/gentoolkit/eclean/clean.py @@ -9,7 +9,6 @@ import sys import gentoolkit.pprinter as pp -import portage from portage.emaint.main import TaskHandler from portage.emaint.modules.binhost import binhost @@ -36,7 +35,6 @@ def clean_dist(self, clean_dict, vcs): @rtype: int @return: total size that was cleaned """ - file_type = "file" clean_size = 0 # clean all entries one by one; sorting helps reading for key in sorted(clean_dict): @@ -57,7 +55,6 @@ def clean_pkgs(self, clean_dict, pkgdir): @rtype: int @return: total size that was cleaned """ - file_type = "binary package" clean_size = 0 # clean all entries one by one; sorting helps reading for location, loc_clean_dict in clean_dict.items(): From 6d4dae49fb94c2a0bdb91e5d3fb4d6e007d3193d Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:09:34 -0800 Subject: [PATCH 2/9] eclean: black formatting fixes Signed-off-by: Brian Dolbec --- pym/gentoolkit/eclean/clean.py | 8 +++++--- pym/gentoolkit/eclean/exclude.py | 1 - pym/gentoolkit/eclean/output.py | 6 +++++- pym/gentoolkit/eclean/search.py | 18 +++++++++++------- pym/gentoolkit/test/eclean/distsupport.py | 1 - 5 files changed, 21 insertions(+), 13 deletions(-) diff --git a/pym/gentoolkit/eclean/clean.py b/pym/gentoolkit/eclean/clean.py index 18f90ef1..4dd21098 100644 --- a/pym/gentoolkit/eclean/clean.py +++ b/pym/gentoolkit/eclean/clean.py @@ -97,8 +97,10 @@ def pretend_clean(self, clean_dict, vcs={}, file_type="file"): for location, loc_clean_dict in clean_dict.items(): print(" * Location", pp.path(location)) for key in sorted(loc_clean_dict): - (binpkg, debugpack) = loc_clean_dict[key] - key_size = self._get_size([binpkg, debugpack] if debugpack else [binpkg]) + binpkg, debugpack = loc_clean_dict[key] + key_size = self._get_size( + [binpkg, debugpack] if debugpack else [binpkg] + ) self.controller(key_size, key, loc_clean_dict[key], file_type) clean_size += key_size @@ -155,7 +157,7 @@ def _clean_binary_package(self, files: tuple[str, str | None], key: str): rm_files = [] rm_size = 0 - if (sz := self._get_size_valid_symlink(files[0])): + if sz := self._get_size_valid_symlink(files[0]): rm_files.append(files[0]) rm_size += sz diff --git a/pym/gentoolkit/eclean/exclude.py b/pym/gentoolkit/eclean/exclude.py index c20574c6..e569e560 100644 --- a/pym/gentoolkit/eclean/exclude.py +++ b/pym/gentoolkit/eclean/exclude.py @@ -9,7 +9,6 @@ import portage from portage import _encodings, _unicode_encode - # Misc. shortcuts to some portage stuff: listdir = portage.listdir diff --git a/pym/gentoolkit/eclean/output.py b/pym/gentoolkit/eclean/output.py index b512c8b2..500a0a3d 100644 --- a/pym/gentoolkit/eclean/output.py +++ b/pym/gentoolkit/eclean/output.py @@ -136,7 +136,11 @@ def progress_controller(self, size, key, clean_list, file_type): if not self.options["quiet"]: # pretty print mode if file_type == "binary package" and clean_list[1] is not None: - print(self.prettySize(size, True), self.pkg_color(key), "(+ debug tarball)") + print( + self.prettySize(size, True), + self.pkg_color(key), + "(+ debug tarball)", + ) else: print(self.prettySize(size, True), self.pkg_color(key)) elif self.options["pretend"] or self.options["interactive"]: diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py index 1dc87225..b1778334 100644 --- a/pym/gentoolkit/eclean/search.py +++ b/pym/gentoolkit/eclean/search.py @@ -392,16 +392,14 @@ def _fetch_restricted(self, pkgs_, cpvs): for cpv in cpvs: # get SRC_URI and RESTRICT from aux_get try: # main portdb - (src_uri, restrict) = self.portdb.aux_get(cpv, ["SRC_URI", "RESTRICT"]) + src_uri, restrict = self.portdb.aux_get(cpv, ["SRC_URI", "RESTRICT"]) # keep fetch-restricted check # inside try so it is bypassed on KeyError if "fetch" in restrict: pkgs[cpv] = src_uri except KeyError: try: # installed vardb - (src_uri, restrict) = self.vardb.aux_get( - cpv, ["SRC_URI", "RESTRICT"] - ) + src_uri, restrict = self.vardb.aux_get(cpv, ["SRC_URI", "RESTRICT"]) deprecated[cpv] = src_uri self.output(DEPRECATED % cpv) # keep fetch-restricted check @@ -680,7 +678,7 @@ def mk_binpkg_key(cpv): # Load binrepos.conf if possible, get all cache locations binrepos_conf_path = os.path.join( - settings['PORTAGE_CONFIGROOT'], portage.const.BINREPOS_CONF_FILE + settings["PORTAGE_CONFIGROOT"], portage.const.BINREPOS_CONF_FILE ) binrepos_conf = BinRepoConfigLoader((binrepos_conf_path,), settings) locations = {pkgdir} @@ -728,7 +726,10 @@ def mk_binpkg_key(cpv): binpkg_key = mk_binpkg_key(drop_cpv) binpkg_path = bin_dbapi.bintree.getname(drop_cpv) debuginfo_path = _find_debuginfo_tarball(drop_cpv, cp) - dead_binpkgs.setdefault(location, {})[binpkg_key] = (binpkg_path, debuginfo_path) + dead_binpkgs.setdefault(location, {})[binpkg_key] = ( + binpkg_path, + debuginfo_path, + ) if new_time < old_time: continue @@ -773,7 +774,10 @@ def mk_binpkg_key(cpv): binpkg_path = bin_dbapi.bintree.getname(cpv) debuginfo_path = _find_debuginfo_tarball(cpv, cp) - dead_binpkgs.setdefault(location, {})[binpkg_key] = (binpkg_path, debuginfo_path) + dead_binpkgs.setdefault(location, {})[binpkg_key] = ( + binpkg_path, + debuginfo_path, + ) try: invalid_paths[location] = bin_dbapi.bintree.invalid_paths diff --git a/pym/gentoolkit/test/eclean/distsupport.py b/pym/gentoolkit/test/eclean/distsupport.py index 9ea0c8dc..0d9c3a61 100644 --- a/pym/gentoolkit/test/eclean/distsupport.py +++ b/pym/gentoolkit/test/eclean/distsupport.py @@ -10,7 +10,6 @@ import subprocess import portage - dir_mode = 0o774 CPVS = [ From 72d385044eaf40f98e9770daf1b4be6a76ab25af Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:43:13 -0800 Subject: [PATCH 3/9] gentoolkit common: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/base.py | 4 +--- pym/gentoolkit/dbapi.py | 6 +++--- pym/gentoolkit/flag.py | 1 - pym/gentoolkit/helpers.py | 2 +- pym/gentoolkit/module_base.py | 3 +-- pym/gentoolkit/package.py | 14 +++++++------- pym/gentoolkit/sets.py | 1 - 7 files changed, 13 insertions(+), 18 deletions(-) diff --git a/pym/gentoolkit/base.py b/pym/gentoolkit/base.py index 4dcbfa1e..d1e7f686 100644 --- a/pym/gentoolkit/base.py +++ b/pym/gentoolkit/base.py @@ -3,8 +3,7 @@ # Copyright(c) 2009-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -"""Gentoolkit Base Module class to hold common module operation functions -""" +"""Gentoolkit Base Module class to hold common module operation functions""" __docformat__ = "epytext" @@ -16,7 +15,6 @@ import gentoolkit.pprinter as pp from gentoolkit.formatters import format_options - GLOBAL_OPTIONS = ( (" -h, --help", "display this help message"), (" -q, --quiet", "minimal output"), diff --git a/pym/gentoolkit/dbapi.py b/pym/gentoolkit/dbapi.py index 9e480f8a..04d2d5aa 100644 --- a/pym/gentoolkit/dbapi.py +++ b/pym/gentoolkit/dbapi.py @@ -4,9 +4,9 @@ # Distributed under the terms of the GNU General Public License v2 """Provides access to Portage database api - Note: this file is deprecated, please replace all use - of these variable with the assigned calls. That will - take advantage of them being lazy-loaded. +Note: this file is deprecated, please replace all use +of these variable with the assigned calls. That will +take advantage of them being lazy-loaded. """ print( diff --git a/pym/gentoolkit/flag.py b/pym/gentoolkit/flag.py index f2bed6fa..987c68f2 100644 --- a/pym/gentoolkit/flag.py +++ b/pym/gentoolkit/flag.py @@ -7,7 +7,6 @@ """Provides support functions for USE flag settings and analysis""" - __all__ = ( "get_iuse", "get_installed_use", diff --git a/pym/gentoolkit/helpers.py b/pym/gentoolkit/helpers.py index c883ad37..34d2a0e1 100644 --- a/pym/gentoolkit/helpers.py +++ b/pym/gentoolkit/helpers.py @@ -5,7 +5,7 @@ """Miscellaneous helper functions and classes. @note: find_* functions that previously lived here have moved to - the query module, where they are called as: Query('portage').find_*(). + the query module, where they are called as: Query('portage').find_*(). """ __all__ = ( diff --git a/pym/gentoolkit/module_base.py b/pym/gentoolkit/module_base.py index a8e9c9ed..df681113 100644 --- a/pym/gentoolkit/module_base.py +++ b/pym/gentoolkit/module_base.py @@ -4,8 +4,7 @@ # Copyright(c) 2010, Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -"""General Base Module class to hold common module operation functions -""" +"""General Base Module class to hold common module operation functions""" __docformat__ = "epytext" diff --git a/pym/gentoolkit/package.py b/pym/gentoolkit/package.py index e3dd092e..6a46e71c 100644 --- a/pym/gentoolkit/package.py +++ b/pym/gentoolkit/package.py @@ -11,13 +11,13 @@ important parts of Portage's back-end. Example usage: - >>> portage = Package('sys-apps/portage-9999') - >>> portage.ebuild_path() - '/var/db/repos/gentoo/sys-apps/portage/portage-9999.ebuild' - >>> portage.is_masked() - True - >>> portage.is_installed() - False + >>> portage = Package('sys-apps/portage-9999') + >>> portage.ebuild_path() + '/var/db/repos/gentoo/sys-apps/portage/portage-9999.ebuild' + >>> portage.is_masked() + True + >>> portage.is_installed() + False """ __all__ = ("Package", "PackageFormatter", "FORMAT_TMPL_VARS") diff --git a/pym/gentoolkit/sets.py b/pym/gentoolkit/sets.py index 31c0df5a..71ec5427 100644 --- a/pym/gentoolkit/sets.py +++ b/pym/gentoolkit/sets.py @@ -22,7 +22,6 @@ from gentoolkit import errors from gentoolkit.atom import Atom - _set_config = None From fcfeef55b75bf545deb46cfd84d6c420eeb8dbcf Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:44:34 -0800 Subject: [PATCH 4/9] enalyze: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/enalyze/__init__.py | 2 -- pym/gentoolkit/enalyze/analyze.py | 2 +- pym/gentoolkit/enalyze/output.py | 6 +++--- pym/gentoolkit/enalyze/rebuild.py | 1 - 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pym/gentoolkit/enalyze/__init__.py b/pym/gentoolkit/enalyze/__init__.py index 875de2e6..0861559a 100644 --- a/pym/gentoolkit/enalyze/__init__.py +++ b/pym/gentoolkit/enalyze/__init__.py @@ -7,7 +7,6 @@ """Gentoo's installed packages analysis and repair tool""" - # Move to Imports section after Python 2.6 is stable @@ -42,7 +41,6 @@ print_help, ) - NAME_MAP = {"a": "analyze", "r": "rebuild"} FORMATTED_OPTIONS = ( diff --git a/pym/gentoolkit/enalyze/analyze.py b/pym/gentoolkit/enalyze/analyze.py index c64465dc..e541e15f 100644 --- a/pym/gentoolkit/enalyze/analyze.py +++ b/pym/gentoolkit/enalyze/analyze.py @@ -485,7 +485,7 @@ def analyse_packages(self): print(" cat/pkg-ver USE Flags") # blankline = lambda: None for cpv in cpvs: - (flag_plus, flag_neg, unset) = flags.analyse_cpv(cpv) + flag_plus, flag_neg, unset = flags.analyse_cpv(cpv) if self.options["unset"]: self.printer( cpv, "", (sorted(flag_plus), sorted(flag_neg), sorted(unset)) diff --git a/pym/gentoolkit/enalyze/output.py b/pym/gentoolkit/enalyze/output.py index b9d937ef..3fc4d736 100644 --- a/pym/gentoolkit/enalyze/output.py +++ b/pym/gentoolkit/enalyze/output.py @@ -141,7 +141,7 @@ def _format_pkg(self, key, active, flags): """Determines the stats for key, formats it and calls the pre-determined print function """ - (plus, minus, cleaned) = flags + plus, minus, cleaned = flags _plus = [] _minus = [] _cleaned = [] @@ -162,7 +162,7 @@ def _format_pkg(self, key, active, flags): def print_pkg_verbose(self, cpv, flags): """Verbosely prints the pkg's use flag info.""" - (plus, minus, unset) = flags + plus, minus, unset = flags _flags = [] for flag in plus: _flags.append(pp.useflag((flag), True)) @@ -175,7 +175,7 @@ def print_pkg_verbose(self, cpv, flags): def print_pkg_quiet(self, cpv, flags): """Verbosely prints the pkg's use flag info.""" - (plus, minus, unset) = flags + plus, minus, unset = flags _flags = [] for flag in plus: _flags.append(pp.useflag((flag), True)) diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py index f4a348a4..5863276b 100644 --- a/pym/gentoolkit/enalyze/rebuild.py +++ b/pym/gentoolkit/enalyze/rebuild.py @@ -9,7 +9,6 @@ """Provides a rebuild file of USE flags or keywords used and by what packages according to the Installed package database""" - import os import gentoolkit From c326d2f1322bc935c6c9bd15b4296473aa408bc7 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:45:09 -0800 Subject: [PATCH 5/9] imlate: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/imlate/imlate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pym/gentoolkit/imlate/imlate.py b/pym/gentoolkit/imlate/imlate.py index 0c7ab047..63565017 100755 --- a/pym/gentoolkit/imlate/imlate.py +++ b/pym/gentoolkit/imlate/imlate.py @@ -232,7 +232,7 @@ def get_packages(conf): cpvr = portage.versions.best(slots[slot]) if cpvr: - (cat, pkg, ver, rev) = portage.versions.catpkgsplit(cpvr) + cat, pkg, ver, rev = portage.versions.catpkgsplit(cpvr) if not cat in list(_pkgs.keys()): _pkgs[cat] = {} @@ -488,7 +488,7 @@ def main(): help="just check in the specified category/categories (comma separated) [default: %default]", ) - (options, args) = parser.parse_args() + options, args = parser.parse_args() if len(args) > 0: conf["USER_PKGS"] = args From 5b7de9606a1e02043a83a3f2e015f047a1bcf9fd Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:45:44 -0800 Subject: [PATCH 6/9] merge_driver_ekeyword: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/merge_driver_ekeyword/merge_driver_ekeyword.py | 1 - .../merge_driver_ekeyword/test_merge_driver_ekeyword.py | 1 - 2 files changed, 2 deletions(-) diff --git a/pym/gentoolkit/merge_driver_ekeyword/merge_driver_ekeyword.py b/pym/gentoolkit/merge_driver_ekeyword/merge_driver_ekeyword.py index de5a9bb5..b575aabd 100755 --- a/pym/gentoolkit/merge_driver_ekeyword/merge_driver_ekeyword.py +++ b/pym/gentoolkit/merge_driver_ekeyword/merge_driver_ekeyword.py @@ -20,7 +20,6 @@ from gentoolkit.ekeyword import ekeyword - KeywordChanges = list[tuple[Optional[list[str]], Optional[list[str]]]] diff --git a/pym/gentoolkit/merge_driver_ekeyword/test_merge_driver_ekeyword.py b/pym/gentoolkit/merge_driver_ekeyword/test_merge_driver_ekeyword.py index b820030d..ffc49b4f 100755 --- a/pym/gentoolkit/merge_driver_ekeyword/test_merge_driver_ekeyword.py +++ b/pym/gentoolkit/merge_driver_ekeyword/test_merge_driver_ekeyword.py @@ -13,7 +13,6 @@ from gentoolkit.merge_driver_ekeyword import merge_driver_ekeyword - TESTDIR = pathlib.Path(__file__).parent / "tests" TESTDIRS = [os.path.dirname(x) for x in TESTDIR.rglob("common-ancestor.ebuild")] TESTDATA = itertools.product(TESTDIRS, (False, True)) From 18dc59c3d45e83936198e5ae9994b2234d51ffb4 Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:46:32 -0800 Subject: [PATCH 7/9] revdep_rebuild: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/revdep_rebuild/analyse.py | 2 +- pym/gentoolkit/revdep_rebuild/rebuild.py | 7 +++---- pym/gentoolkit/revdep_rebuild/stuff.py | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/pym/gentoolkit/revdep_rebuild/analyse.py b/pym/gentoolkit/revdep_rebuild/analyse.py index a4571809..3f3bdd6d 100644 --- a/pym/gentoolkit/revdep_rebuild/analyse.py +++ b/pym/gentoolkit/revdep_rebuild/analyse.py @@ -250,7 +250,7 @@ def search(self, scanned_files=None): "\tFile %s ignored as it is masked" % filename ) continue - if l.startswith('/') and os.path.isfile(l): + if l.startswith("/") and os.path.isfile(l): self.logger.debug( "\tLibrary %s is a full path and it exists" % l ) diff --git a/pym/gentoolkit/revdep_rebuild/rebuild.py b/pym/gentoolkit/revdep_rebuild/rebuild.py index d7bf69e6..ddf5d526 100644 --- a/pym/gentoolkit/revdep_rebuild/rebuild.py +++ b/pym/gentoolkit/revdep_rebuild/rebuild.py @@ -1,13 +1,13 @@ #!/usr/bin/python -""" Rebuild module +"""Rebuild module Main program, cli parsing and api program control and operation Author: Sławomir Lis - revdep-rebuild original author: Stanislav Brabec - revdep-rebuild original rewrite Author: Michael A. Smith + revdep-rebuild original author: Stanislav Brabec + revdep-rebuild original rewrite Author: Michael A. Smith Current Maintainer: Paul Varner Creation date: 2010/10/17 License: BSD @@ -31,7 +31,6 @@ from .stuff import filter_masked from . import __version__ - APP_NAME = sys.argv[0] VERSION = __version__ diff --git a/pym/gentoolkit/revdep_rebuild/stuff.py b/pym/gentoolkit/revdep_rebuild/stuff.py index eee90c8f..d6d69f18 100644 --- a/pym/gentoolkit/revdep_rebuild/stuff.py +++ b/pym/gentoolkit/revdep_rebuild/stuff.py @@ -2,7 +2,6 @@ """Utilities submodule""" - import subprocess import portage From 4d855ea122033e020a24ebef1f1013b68886be9a Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 00:59:41 -0800 Subject: [PATCH 8/9] ekeyword: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/ekeyword/ekeyword.py | 1 - pym/gentoolkit/ekeyword/test_ekeyword.py | 1 - pym/gentoolkit/test/test_profile.py | 1 - 3 files changed, 3 deletions(-) diff --git a/pym/gentoolkit/ekeyword/ekeyword.py b/pym/gentoolkit/ekeyword/ekeyword.py index aa4986ee..3c20ba52 100755 --- a/pym/gentoolkit/ekeyword/ekeyword.py +++ b/pym/gentoolkit/ekeyword/ekeyword.py @@ -49,7 +49,6 @@ import portage from portage.output import colorize, nocolor - __version__ = "@VERSION@" # Operation object that describes how to perform a change. diff --git a/pym/gentoolkit/ekeyword/test_ekeyword.py b/pym/gentoolkit/ekeyword/test_ekeyword.py index 3495aff3..8477d286 100755 --- a/pym/gentoolkit/ekeyword/test_ekeyword.py +++ b/pym/gentoolkit/ekeyword/test_ekeyword.py @@ -14,7 +14,6 @@ from gentoolkit.ekeyword import ekeyword - TESTDIR = os.path.join(os.path.dirname(__file__), "tests") diff --git a/pym/gentoolkit/test/test_profile.py b/pym/gentoolkit/test/test_profile.py index 04d4d7b6..dcea6e55 100644 --- a/pym/gentoolkit/test/test_profile.py +++ b/pym/gentoolkit/test/test_profile.py @@ -9,7 +9,6 @@ from gentoolkit.profile import load_profile_data - TESTDIR = os.path.join(os.path.dirname(__file__), "../ekeyword/tests") From 661b766ba308dbee6629a8ac1946db80c66d754e Mon Sep 17 00:00:00 2001 From: Brian Dolbec Date: Thu, 22 Jan 2026 01:00:23 -0800 Subject: [PATCH 9/9] eprefix: black cleanup Signed-off-by: Brian Dolbec --- pym/gentoolkit/eprefix.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pym/gentoolkit/eprefix.py b/pym/gentoolkit/eprefix.py index 868a7800..26780606 100644 --- a/pym/gentoolkit/eprefix.py +++ b/pym/gentoolkit/eprefix.py @@ -9,9 +9,10 @@ Example useage: from gentoolkit.eprefix import EPREFIX then in code add it to the filepath eg.: - exclude_file = "%s/etc/%s/%s.exclude" % (EPREFIX,__productname__ , action) + exclude_file = "%s/etc/%s/%s.exclude" % (EPREFIX,__productname__ , action) """ + # Load EPREFIX from Portage, fall back to the empty string if it fails try: from portage.const import EPREFIX