Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pym/gentoolkit/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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"),
Expand Down
6 changes: 3 additions & 3 deletions pym/gentoolkit/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 5 additions & 6 deletions pym/gentoolkit/eclean/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand All @@ -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():
Expand Down Expand Up @@ -100,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

Expand Down Expand Up @@ -158,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

Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/eclean/exclude.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import portage
from portage import _encodings, _unicode_encode


# Misc. shortcuts to some portage stuff:
listdir = portage.listdir

Expand Down
6 changes: 5 additions & 1 deletion pym/gentoolkit/eclean/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand Down
18 changes: 11 additions & 7 deletions pym/gentoolkit/eclean/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/ekeyword/ekeyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import portage
from portage.output import colorize, nocolor


__version__ = "@VERSION@"

# Operation object that describes how to perform a change.
Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/ekeyword/test_ekeyword.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

from gentoolkit.ekeyword import ekeyword


TESTDIR = os.path.join(os.path.dirname(__file__), "tests")


Expand Down
2 changes: 0 additions & 2 deletions pym/gentoolkit/enalyze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

"""Gentoo's installed packages analysis and repair tool"""


# Move to Imports section after Python 2.6 is stable


Expand Down Expand Up @@ -42,7 +41,6 @@
print_help,
)


NAME_MAP = {"a": "analyze", "r": "rebuild"}

FORMATTED_OPTIONS = (
Expand Down
2 changes: 1 addition & 1 deletion pym/gentoolkit/enalyze/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
6 changes: 3 additions & 3 deletions pym/gentoolkit/enalyze/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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))
Expand All @@ -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))
Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/enalyze/rebuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion pym/gentoolkit/eprefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

"""Provides support functions for USE flag settings and analysis"""


__all__ = (
"get_iuse",
"get_installed_use",
Expand Down
2 changes: 1 addition & 1 deletion pym/gentoolkit/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = (
Expand Down
4 changes: 2 additions & 2 deletions pym/gentoolkit/imlate/imlate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

from gentoolkit.ekeyword import ekeyword


KeywordChanges = list[tuple[Optional[list[str]], Optional[list[str]]]]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 1 addition & 2 deletions pym/gentoolkit/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
14 changes: 7 additions & 7 deletions pym/gentoolkit/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion pym/gentoolkit/revdep_rebuild/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
7 changes: 3 additions & 4 deletions pym/gentoolkit/revdep_rebuild/rebuild.py
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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 <[email protected]>
Creation date: 2010/10/17
License: BSD
Expand All @@ -31,7 +31,6 @@
from .stuff import filter_masked
from . import __version__


APP_NAME = sys.argv[0]
VERSION = __version__

Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/revdep_rebuild/stuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

"""Utilities submodule"""


import subprocess

import portage
Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/sets.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from gentoolkit import errors
from gentoolkit.atom import Atom


_set_config = None


Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/test/eclean/distsupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import subprocess
import portage


dir_mode = 0o774

CPVS = [
Expand Down
1 change: 0 additions & 1 deletion pym/gentoolkit/test/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from gentoolkit.profile import load_profile_data


TESTDIR = os.path.join(os.path.dirname(__file__), "../ekeyword/tests")


Expand Down