aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2024-01-28 14:01:58 -0800
committerZac Medico <zmedico@gentoo.org>2024-01-28 15:09:26 -0800
commit3d55e159c473075c7b2f87c92293b0df6fa57563 (patch)
treeb990e23d0b708ffa462482604e53dd5bf3a0086a
parentactions: Use psf/black@23.12.1 and sync pre-commit version (diff)
downloadportage-3d55e159.tar.gz
portage-3d55e159.tar.bz2
portage-3d55e159.zip
*/*: rerun black w/ 24.1.0
Signed-off-by: Zac Medico <zmedico@gentoo.org>
-rw-r--r--lib/_emerge/AsynchronousTask.py6
-rw-r--r--lib/_emerge/EbuildMetadataPhase.py11
-rw-r--r--lib/_emerge/MergeListItem.py1
-rw-r--r--lib/_emerge/PipeReader.py1
-rw-r--r--lib/_emerge/SpawnProcess.py1
-rw-r--r--lib/_emerge/depgraph.py59
-rw-r--r--lib/_emerge/resolver/slot_collision.py12
-rw-r--r--lib/portage/_emirrordist/DeletionIterator.py8
-rw-r--r--lib/portage/_emirrordist/FetchIterator.py8
-rw-r--r--lib/portage/_sets/libs.py1
-rw-r--r--lib/portage/dbapi/porttree.py1
-rw-r--r--lib/portage/dbapi/vartree.py28
-rw-r--r--lib/portage/dep/__init__.py1
-rw-r--r--lib/portage/package/ebuild/config.py38
-rw-r--r--lib/portage/package/ebuild/doebuild.py16
-rw-r--r--lib/portage/proxy/objectproxy.py1
-rw-r--r--lib/portage/tests/ebuild/test_fetch.py10
-rw-r--r--lib/portage/tests/process/test_AsyncFunction.py8
-rw-r--r--lib/portage/util/_async/PipeLogger.py1
-rw-r--r--lib/portage/util/_async/TaskScheduler.py1
-rw-r--r--lib/portage/util/_dyn_libs/LinkageMapELF.py3
-rw-r--r--lib/portage/util/file_copy/__init__.py7
-rw-r--r--lib/portage/util/futures/_sync_decorator.py8
23 files changed, 119 insertions, 112 deletions
diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py
index 4290eede3..4049ba5eb 100644
--- a/lib/_emerge/AsynchronousTask.py
+++ b/lib/_emerge/AsynchronousTask.py
@@ -46,9 +46,9 @@ class AsynchronousTask(SlotObject):
)
self.addExitListener(exit_listener)
waiter.add_done_callback(
- lambda waiter: self.removeExitListener(exit_listener)
- if waiter.cancelled()
- else None
+ lambda waiter: (
+ self.removeExitListener(exit_listener) if waiter.cancelled() else None
+ )
)
if self.returncode is not None:
# If the returncode is not None, it means the exit event has already
diff --git a/lib/_emerge/EbuildMetadataPhase.py b/lib/_emerge/EbuildMetadataPhase.py
index fd695e025..8905a058f 100644
--- a/lib/_emerge/EbuildMetadataPhase.py
+++ b/lib/_emerge/EbuildMetadataPhase.py
@@ -19,7 +19,6 @@ import fcntl
class EbuildMetadataPhase(SubProcess):
-
"""
Asynchronous interface for the ebuild "depend" phase which is
used to extract metadata from the ebuild.
@@ -200,12 +199,10 @@ class EbuildMetadataPhase(SubProcess):
# entries for unsupported EAPIs.
if self.eapi_supported:
if metadata.get("INHERITED", False):
- metadata[
- "_eclasses_"
- ] = self.portdb.repositories.get_repo_for_location(
- self.repo_path
- ).eclass_db.get_eclass_data(
- metadata["INHERITED"].split()
+ metadata["_eclasses_"] = (
+ self.portdb.repositories.get_repo_for_location(
+ self.repo_path
+ ).eclass_db.get_eclass_data(metadata["INHERITED"].split())
)
else:
metadata["_eclasses_"] = {}
diff --git a/lib/_emerge/MergeListItem.py b/lib/_emerge/MergeListItem.py
index efe485c2e..ae894704a 100644
--- a/lib/_emerge/MergeListItem.py
+++ b/lib/_emerge/MergeListItem.py
@@ -13,7 +13,6 @@ from _emerge.PackageUninstall import PackageUninstall
class MergeListItem(CompositeTask):
-
"""
TODO: For parallel scheduling, everything here needs asynchronous
execution support (start, poll, and wait methods).
diff --git a/lib/_emerge/PipeReader.py b/lib/_emerge/PipeReader.py
index 026346e0b..76ab7f188 100644
--- a/lib/_emerge/PipeReader.py
+++ b/lib/_emerge/PipeReader.py
@@ -8,7 +8,6 @@ from _emerge.AbstractPollTask import AbstractPollTask
class PipeReader(AbstractPollTask):
-
"""
Reads output from one or more files and saves it in memory,
for retrieval via the getvalue() method. This is driven by
diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py
index 72fa72c61..40740df9a 100644
--- a/lib/_emerge/SpawnProcess.py
+++ b/lib/_emerge/SpawnProcess.py
@@ -16,7 +16,6 @@ from portage.util.futures import asyncio
class SpawnProcess(SubProcess):
-
"""
Constructor keyword args are passed into portage.process.spawn().
The required "args" keyword argument will be passed as the first
diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
index 1cbbbaf81..1674fa289 100644
--- a/lib/_emerge/depgraph.py
+++ b/lib/_emerge/depgraph.py
@@ -408,7 +408,6 @@ class _use_changes(tuple):
class _dynamic_depgraph_config:
-
"""
``dynamic_depgraph_config`` is an object that is used to collect settings and important data structures that are
used in calculating Portage dependencies. Each depgraph created by the depgraph.py code gets its own
@@ -3798,11 +3797,15 @@ class depgraph:
+ (
optional_msg.format("parent and child")
if parent in removed and pkg in removed
- else optional_msg.format("parent")
- if parent in removed
- else optional_msg.format("child")
- if pkg in removed
- else ""
+ else (
+ optional_msg.format("parent")
+ if parent in removed
+ else (
+ optional_msg.format("child")
+ if pkg in removed
+ else ""
+ )
+ )
)
)
priorities = []
@@ -3820,11 +3823,15 @@ class depgraph:
+ (
optional_msg.format("parent and child")
if pkg in removed and child in removed
- else optional_msg.format("parent")
- if pkg in removed
- else optional_msg.format("child")
- if child in removed
- else ""
+ else (
+ optional_msg.format("parent")
+ if pkg in removed
+ else (
+ optional_msg.format("child")
+ if child in removed
+ else ""
+ )
+ )
)
)
priorities = []
@@ -5830,9 +5837,9 @@ class depgraph:
self._select_atoms_parent = parent
mytrees["parent"] = parent
mytrees["atom_graph"] = atom_graph
- mytrees[
- "circular_dependency"
- ] = self._dynamic_config._circular_dependency
+ mytrees["circular_dependency"] = (
+ self._dynamic_config._circular_dependency
+ )
if priority is not None:
mytrees["priority"] = priority
@@ -10546,24 +10553,24 @@ class depgraph:
filename = "package.accept_keywords"
else:
filename = "package.keywords"
- file_to_write_to[
- (abs_user_config, "package.keywords")
- ] = find_config_file(abs_user_config, filename)
+ file_to_write_to[(abs_user_config, "package.keywords")] = (
+ find_config_file(abs_user_config, filename)
+ )
if root in p_mask_change_msg:
- file_to_write_to[
- (abs_user_config, "package.unmask")
- ] = find_config_file(abs_user_config, "package.unmask")
+ file_to_write_to[(abs_user_config, "package.unmask")] = (
+ find_config_file(abs_user_config, "package.unmask")
+ )
if root in use_changes_msg:
- file_to_write_to[
- (abs_user_config, "package.use")
- ] = find_config_file(abs_user_config, "package.use")
+ file_to_write_to[(abs_user_config, "package.use")] = (
+ find_config_file(abs_user_config, "package.use")
+ )
if root in license_msg:
- file_to_write_to[
- (abs_user_config, "package.license")
- ] = find_config_file(abs_user_config, "package.license")
+ file_to_write_to[(abs_user_config, "package.license")] = (
+ find_config_file(abs_user_config, "package.license")
+ )
for (abs_user_config, f), path in file_to_write_to.items():
if path is None:
diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py
index 7e579f394..d4f7018ea 100644
--- a/lib/_emerge/resolver/slot_collision.py
+++ b/lib/_emerge/resolver/slot_collision.py
@@ -446,17 +446,17 @@ class slot_conflict_handler:
modified_use=self.depgraph._pkg_use_enabled(ppkg),
):
selected_for_display.add((ppkg, atom))
- need_rebuild[
- ppkg
- ] = "matched by --useoldpkg-atoms argument"
+ need_rebuild[ppkg] = (
+ "matched by --useoldpkg-atoms argument"
+ )
elif usepkgonly:
# This case is tricky, so keep quiet in order to avoid false-positives.
pass
elif not self.depgraph._equiv_ebuild_visible(ppkg):
selected_for_display.add((ppkg, atom))
- need_rebuild[
- ppkg
- ] = "ebuild is masked or unavailable"
+ need_rebuild[ppkg] = (
+ "ebuild is masked or unavailable"
+ )
for ppkg, atom, other_pkg in parents:
selected_for_display.add((ppkg, atom))
diff --git a/lib/portage/_emirrordist/DeletionIterator.py b/lib/portage/_emirrordist/DeletionIterator.py
index 4494b7b24..bed40e935 100644
--- a/lib/portage/_emirrordist/DeletionIterator.py
+++ b/lib/portage/_emirrordist/DeletionIterator.py
@@ -27,9 +27,11 @@ class DeletionIterator:
distfiles_set = set()
distfiles_set.update(
(
- filename
- if isinstance(filename, DistfileName)
- else DistfileName(filename)
+ (
+ filename
+ if isinstance(filename, DistfileName)
+ else DistfileName(filename)
+ )
for filename in itertools.chain.from_iterable(
layout.get_filenames(distdir) for layout in self._config.layouts
)
diff --git a/lib/portage/_emirrordist/FetchIterator.py b/lib/portage/_emirrordist/FetchIterator.py
index 54a058bb5..eaf3e5359 100644
--- a/lib/portage/_emirrordist/FetchIterator.py
+++ b/lib/portage/_emirrordist/FetchIterator.py
@@ -292,9 +292,11 @@ def _async_fetch_tasks(config, hash_filter, repo_config, digests_future, cpv, lo
)
gather_result.add_done_callback(aux_get_done)
result.add_done_callback(
- lambda result: gather_result.cancel()
- if result.cancelled() and not gather_result.done()
- else None
+ lambda result: (
+ gather_result.cancel()
+ if result.cancelled() and not gather_result.done()
+ else None
+ )
)
return result
diff --git a/lib/portage/_sets/libs.py b/lib/portage/_sets/libs.py
index 9636b9d2c..860844235 100644
--- a/lib/portage/_sets/libs.py
+++ b/lib/portage/_sets/libs.py
@@ -33,7 +33,6 @@ class LibraryConsumerSet(PackageSet):
class LibraryFileConsumerSet(LibraryConsumerSet):
-
"""
Note: This does not detect libtool archive (*.la) files that consume the
specified files (revdep-rebuild is able to detect them).
diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py
index eabf2d0a2..61d431f91 100644
--- a/lib/portage/dbapi/porttree.py
+++ b/lib/portage/dbapi/porttree.py
@@ -106,7 +106,6 @@ class _dummy_list(list):
class _better_cache:
-
"""
The purpose of better_cache is to locate catpkgs in repositories using ``os.listdir()`` as much as possible, which
is less expensive IO-wise than exhaustively doing a stat on each repo for a particular catpkg. better_cache stores a
diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index a00c731c5..c6b45ba42 100644
--- a/lib/portage/dbapi/vartree.py
+++ b/lib/portage/dbapi/vartree.py
@@ -2164,9 +2164,11 @@ class dblink:
# The tarfile module will write pax headers holding the
# xattrs only if PAX_FORMAT is specified here.
with tarfile.open(
- fileobj=output_file
- if hasattr(output_file, "write")
- else open(output_file.fileno(), mode="wb", closefd=False),
+ fileobj=(
+ output_file
+ if hasattr(output_file, "write")
+ else open(output_file.fileno(), mode="wb", closefd=False)
+ ),
mode="w|",
format=tarfile.PAX_FORMAT if xattrs else tarfile.DEFAULT_FORMAT,
) as tar:
@@ -5293,12 +5295,14 @@ class dblink:
# to TextIOWrapper with python2.
contents_tmp_path = os.path.join(self.dbtmpdir, "CONTENTS")
outfile = atomic_ofstream(
- contents_tmp_path
- if portage.utf8_mode
- else _unicode_encode(
- contents_tmp_path,
- encoding=_encodings["fs"],
- errors="strict",
+ (
+ contents_tmp_path
+ if portage.utf8_mode
+ else _unicode_encode(
+ contents_tmp_path,
+ encoding=_encodings["fs"],
+ errors="strict",
+ )
),
mode="w",
encoding=_encodings["repo.content"],
@@ -6546,9 +6550,9 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None, xattrs=Fals
# Compatible with GNU tar, which saves the xattrs
# under the SCHILY.xattr namespace.
for k in xattr.list(path_bytes):
- tarinfo.pax_headers[
- "SCHILY.xattr." + _unicode_decode(k)
- ] = _unicode_decode(xattr.get(path_bytes, _unicode_encode(k)))
+ tarinfo.pax_headers["SCHILY.xattr." + _unicode_decode(k)] = (
+ _unicode_decode(xattr.get(path_bytes, _unicode_encode(k)))
+ )
with open(path_bytes, "rb") as f:
tar.addfile(tarinfo, f)
diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py
index 04f857c99..a4a5bf26b 100644
--- a/lib/portage/dep/__init__.py
+++ b/lib/portage/dep/__init__.py
@@ -1440,7 +1440,6 @@ class _use_dep:
class Atom(str):
-
"""
For compatibility with existing atom string manipulation code, this
class emulates most of the str methods that are useful with atoms.
diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py
index 1c455eeac..d7b0ca567 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -866,10 +866,10 @@ class config:
# Initialize all USE related variables we track ourselves.
self.usemask = self._use_manager.getUseMask()
self.useforce = self._use_manager.getUseForce()
- self.configdict["conf"][
- "USE"
- ] = self._use_manager.extract_global_USE_changes(
- self.configdict["conf"].get("USE", "")
+ self.configdict["conf"]["USE"] = (
+ self._use_manager.extract_global_USE_changes(
+ self.configdict["conf"].get("USE", "")
+ )
)
# Read license_groups and optionally license_groups and package.license from user config
@@ -879,10 +879,10 @@ class config:
user_config=local_config,
)
# Extract '*/*' entries from package.license
- self.configdict["conf"][
- "ACCEPT_LICENSE"
- ] = self._license_manager.extract_global_changes(
- self.configdict["conf"].get("ACCEPT_LICENSE", "")
+ self.configdict["conf"]["ACCEPT_LICENSE"] = (
+ self._license_manager.extract_global_changes(
+ self.configdict["conf"].get("ACCEPT_LICENSE", "")
+ )
)
# profile.bashrc
@@ -1068,9 +1068,9 @@ class config:
# reasonable defaults; this is important as without USE_ORDER,
# USE will always be "" (nothing set)!
if "USE_ORDER" not in self:
- self[
- "USE_ORDER"
- ] = "env:pkg:conf:defaults:pkginternal:features:repo:env.d"
+ self["USE_ORDER"] = (
+ "env:pkg:conf:defaults:pkginternal:features:repo:env.d"
+ )
self.backup_changes("USE_ORDER")
if "CBUILD" not in self and "CHOST" in self:
@@ -1689,14 +1689,14 @@ class config:
if use is None:
use = frozenset(settings["PORTAGE_USE"].split())
- values[
- "ACCEPT_LICENSE"
- ] = settings._license_manager.get_prunned_accept_license(
- settings.mycpv,
- use,
- settings.get("LICENSE", ""),
- settings.get("SLOT"),
- settings.get("PORTAGE_REPO_NAME"),
+ values["ACCEPT_LICENSE"] = (
+ settings._license_manager.get_prunned_accept_license(
+ settings.mycpv,
+ use,
+ settings.get("LICENSE", ""),
+ settings.get("SLOT"),
+ settings.get("PORTAGE_REPO_NAME"),
+ )
)
values["PORTAGE_PROPERTIES"] = self._flatten("PROPERTIES", use, settings)
values["PORTAGE_RESTRICT"] = self._flatten("RESTRICT", use, settings)
diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
index b10bbaf30..ed604415d 100644
--- a/lib/portage/package/ebuild/doebuild.py
+++ b/lib/portage/package/ebuild/doebuild.py
@@ -591,9 +591,9 @@ def doebuild_environment(
if nproc:
mysettings["MAKEOPTS"] = "-j%d" % (nproc)
if "GNUMAKEFLAGS" not in mysettings and "MAKEFLAGS" not in mysettings:
- mysettings[
- "GNUMAKEFLAGS"
- ] = f"--load-average {nproc} --output-sync=line"
+ mysettings["GNUMAKEFLAGS"] = (
+ f"--load-average {nproc} --output-sync=line"
+ )
if not eapi_exports_KV(eapi):
# Discard KV for EAPIs that don't support it. Cached KV is restored
@@ -2773,10 +2773,12 @@ def _post_src_install_uid_fix(mysettings, out):
# a normal write might fail due to file permission
# settings on some operating systems such as HP-UX
write_atomic(
- fpath
- if portage.utf8_mode
- else _unicode_encode(
- fpath, encoding=_encodings["merge"], errors="strict"
+ (
+ fpath
+ if portage.utf8_mode
+ else _unicode_encode(
+ fpath, encoding=_encodings["merge"], errors="strict"
+ )
),
new_contents,
mode="wb",
diff --git a/lib/portage/proxy/objectproxy.py b/lib/portage/proxy/objectproxy.py
index 7cdc6f68d..f36464e19 100644
--- a/lib/portage/proxy/objectproxy.py
+++ b/lib/portage/proxy/objectproxy.py
@@ -6,7 +6,6 @@ __all__ = ["ObjectProxy"]
class ObjectProxy:
-
"""
Object that acts as a proxy to another object, forwarding
attribute accesses and method calls. This can be useful
diff --git a/lib/portage/tests/ebuild/test_fetch.py b/lib/portage/tests/ebuild/test_fetch.py
index bc8c05274..4812eb430 100644
--- a/lib/portage/tests/ebuild/test_fetch.py
+++ b/lib/portage/tests/ebuild/test_fetch.py
@@ -246,11 +246,11 @@ class EbuildFetchTestCase(TestCase):
"""
% orig_fetchcommand.replace("${FILE}", "${FILE}.__download__")
)
- settings[
- "FETCHCOMMAND"
- ] = '"{}" "{}" "${{URI}}" "${{DISTDIR}}" "${{FILE}}"'.format(
- BASH_BINARY,
- temp_fetchcommand,
+ settings["FETCHCOMMAND"] = (
+ '"{}" "{}" "${{URI}}" "${{DISTDIR}}" "${{FILE}}"'.format(
+ BASH_BINARY,
+ temp_fetchcommand,
+ )
)
settings.features.add("skiprocheck")
settings.features.remove("distlocks")
diff --git a/lib/portage/tests/process/test_AsyncFunction.py b/lib/portage/tests/process/test_AsyncFunction.py
index 1faf8f49f..a056f268b 100644
--- a/lib/portage/tests/process/test_AsyncFunction.py
+++ b/lib/portage/tests/process/test_AsyncFunction.py
@@ -36,9 +36,11 @@ class AsyncFunctionTestCase(TestCase):
scheduler=loop,
target=self._read_from_stdin,
args=(
- pw.fileno()
- if multiprocessing.get_start_method() == "fork"
- else None,
+ (
+ pw.fileno()
+ if multiprocessing.get_start_method() == "fork"
+ else None
+ ),
),
)
reader.start()
diff --git a/lib/portage/util/_async/PipeLogger.py b/lib/portage/util/_async/PipeLogger.py
index e5cabaa62..5f3c83227 100644
--- a/lib/portage/util/_async/PipeLogger.py
+++ b/lib/portage/util/_async/PipeLogger.py
@@ -14,7 +14,6 @@ from _emerge.AbstractPollTask import AbstractPollTask
class PipeLogger(AbstractPollTask):
-
"""
This can be used for logging output of a child process,
optionally outputting to log_file_path and/or stdout_fd. It can
diff --git a/lib/portage/util/_async/TaskScheduler.py b/lib/portage/util/_async/TaskScheduler.py
index 09920111e..ec97a84ac 100644
--- a/lib/portage/util/_async/TaskScheduler.py
+++ b/lib/portage/util/_async/TaskScheduler.py
@@ -5,7 +5,6 @@ from .AsyncScheduler import AsyncScheduler
class TaskScheduler(AsyncScheduler):
-
"""
A simple way to handle scheduling of AbstractPollTask instances. Simply
pass a task iterator into the constructor and call start(). Use the
diff --git a/lib/portage/util/_dyn_libs/LinkageMapELF.py b/lib/portage/util/_dyn_libs/LinkageMapELF.py
index 76feadcac..67ed16ccb 100644
--- a/lib/portage/util/_dyn_libs/LinkageMapELF.py
+++ b/lib/portage/util/_dyn_libs/LinkageMapELF.py
@@ -52,7 +52,6 @@ _approx_multilib_categories = {
class LinkageMapELF:
-
"""Models dynamic linker dependencies."""
_needed_aux_key = "NEEDED.ELF.2"
@@ -107,7 +106,6 @@ class LinkageMapELF:
return key
class _ObjectKey:
-
"""Helper class used as _obj_properties keys for objects."""
__slots__ = ("_key",)
@@ -515,7 +513,6 @@ class LinkageMapELF:
os = _os_merge
class _LibraryCache:
-
"""
Caches properties associated with paths.
diff --git a/lib/portage/util/file_copy/__init__.py b/lib/portage/util/file_copy/__init__.py
index 2961853d3..f88d4d9d5 100644
--- a/lib/portage/util/file_copy/__init__.py
+++ b/lib/portage/util/file_copy/__init__.py
@@ -23,9 +23,10 @@ def _optimized_copyfile(src, dst):
@param dst: path of destination file
@type dst: str
"""
- with open(src, "rb", buffering=0) as src_file, open(
- dst, "wb", buffering=0
- ) as dst_file:
+ with (
+ open(src, "rb", buffering=0) as src_file,
+ open(dst, "wb", buffering=0) as dst_file,
+ ):
_file_copy(src_file.fileno(), dst_file.fileno())
diff --git a/lib/portage/util/futures/_sync_decorator.py b/lib/portage/util/futures/_sync_decorator.py
index 772983bc8..436e7c346 100644
--- a/lib/portage/util/futures/_sync_decorator.py
+++ b/lib/portage/util/futures/_sync_decorator.py
@@ -39,9 +39,11 @@ def _sync_methods(obj, loop=None):
loop = asyncio._wrap_loop(loop)
return _ObjectAttrWrapper(
obj,
- lambda attr: _sync_decorator(attr, loop=loop)
- if asyncio.iscoroutinefunction(attr)
- else attr,
+ lambda attr: (
+ _sync_decorator(attr, loop=loop)
+ if asyncio.iscoroutinefunction(attr)
+ else attr
+ ),
)