forked from Mirror/pmbootstrap
pmb.build._package: Replace sum() with functools.reduce() (MR 2525)
See https://docs.astral.sh/ruff/rules/quadratic-list-summation
This commit is contained in:
parent
f43af8a115
commit
678ce1db52
1 changed files with 10 additions and 4 deletions
|
@ -1,6 +1,8 @@
|
||||||
# Copyright 2023 Oliver Smith
|
# Copyright 2023 Oliver Smith
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
import datetime
|
import datetime
|
||||||
|
import functools
|
||||||
|
import operator
|
||||||
from typing import Any, TypedDict
|
from typing import Any, TypedDict
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from pmb.build.other import BuildStatus
|
from pmb.build.other import BuildStatus
|
||||||
|
@ -391,8 +393,10 @@ def process_package(
|
||||||
|
|
||||||
# Also traverse subpackage depends, they shouldn't be included in base_depends since they
|
# Also traverse subpackage depends, they shouldn't be included in base_depends since they
|
||||||
# aren't needed for building (and can conflict with depends for other subpackages)
|
# aren't needed for building (and can conflict with depends for other subpackages)
|
||||||
depends += sum(
|
depends += functools.reduce(
|
||||||
map(lambda sp: sp["depends"] if sp else [], base_apkbuild["subpackages"].values()), []
|
operator.iadd,
|
||||||
|
map(lambda sp: sp["depends"] if sp else [], base_apkbuild["subpackages"].values()),
|
||||||
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
parent = pkgname
|
parent = pkgname
|
||||||
|
@ -434,8 +438,10 @@ def process_package(
|
||||||
)
|
)
|
||||||
queue_build(aports, apkbuild, deps, cross)
|
queue_build(aports, apkbuild, deps, cross)
|
||||||
|
|
||||||
subpkg_deps: list[str] = sum(
|
subpkg_deps: list[str] = functools.reduce(
|
||||||
map(lambda sp: sp["depends"] if sp else [], apkbuild["subpackages"].values()), []
|
operator.iadd,
|
||||||
|
map(lambda sp: sp["depends"] if sp else [], apkbuild["subpackages"].values()),
|
||||||
|
[],
|
||||||
)
|
)
|
||||||
logging.verbose(
|
logging.verbose(
|
||||||
f"{arch}/{dep}: Inserting {len(deps)} dependencies and {len(subpkg_deps)} from subpackages"
|
f"{arch}/{dep}: Inserting {len(deps)} dependencies and {len(subpkg_deps)} from subpackages"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue