forked from Mirror/pmbootstrap
ruff: format (MR 2344)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
71646f0a1d
commit
0e62eaac67
8 changed files with 23 additions and 17 deletions
|
@ -102,6 +102,7 @@ def warn_if_chroots_outdated():
|
||||||
" 'pmbootstrap zap'."
|
" 'pmbootstrap zap'."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@Cache("chroot")
|
@Cache("chroot")
|
||||||
def init(chroot: Chroot, usr_merge=UsrMerge.AUTO):
|
def init(chroot: Chroot, usr_merge=UsrMerge.AUTO):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -204,8 +204,14 @@ def switch_to_channel_branch(channel_new):
|
||||||
channels_cfg = pmb.helpers.git.parse_channels_cfg(aports)
|
channels_cfg = pmb.helpers.git.parse_channels_cfg(aports)
|
||||||
branch_new = channels_cfg["channels"][channel_new]["branch_pmaports"]
|
branch_new = channels_cfg["channels"][channel_new]["branch_pmaports"]
|
||||||
branch_current = pmb.helpers.git.rev_parse(aports, extra_args=["--abbrev-ref"])
|
branch_current = pmb.helpers.git.rev_parse(aports, extra_args=["--abbrev-ref"])
|
||||||
if branch_current == "master_staging_systemd" and channel_new == "edge" and pmb.config.is_systemd_selected():
|
if (
|
||||||
logging.info("NOTE: systemd enabled and currently on the master_staging_systemd branch, not switching to edge")
|
branch_current == "master_staging_systemd"
|
||||||
|
and channel_new == "edge"
|
||||||
|
and pmb.config.is_systemd_selected()
|
||||||
|
):
|
||||||
|
logging.info(
|
||||||
|
"NOTE: systemd enabled and currently on the master_staging_systemd branch, not switching to edge"
|
||||||
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logging.info(
|
logging.info(
|
||||||
|
|
|
@ -41,13 +41,11 @@ def chroot_save_init(suffix: Chroot):
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def chroots_outdated() -> list[Chroot]:
|
def chroots_outdated() -> list[Chroot]: ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def chroots_outdated(chroot: Chroot) -> bool:
|
def chroots_outdated(chroot: Chroot) -> bool: ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
def chroots_outdated(chroot: Optional[Chroot] = None):
|
def chroots_outdated(chroot: Optional[Chroot] = None):
|
||||||
|
|
|
@ -182,6 +182,7 @@ def warning(msg: object, *args, **kwargs):
|
||||||
def warn_once(msg: str):
|
def warn_once(msg: str):
|
||||||
logging.warning(msg)
|
logging.warning(msg)
|
||||||
|
|
||||||
|
|
||||||
def info(msg: object, *args, **kwargs):
|
def info(msg: object, *args, **kwargs):
|
||||||
logging.info(msg, *args, **kwargs)
|
logging.info(msg, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
@ -28,14 +28,15 @@ def remove_operators(package):
|
||||||
break
|
break
|
||||||
return package
|
return package
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def get(pkgname: str, arch: Arch, replace_subpkgnames: bool=False) -> dict[str, Any]:
|
def get(pkgname: str, arch: Arch, replace_subpkgnames: bool = False) -> dict[str, Any]: ...
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def get(pkgname: str, arch: Arch, replace_subpkgnames: bool=False, must_exist: bool=True) -> dict[str, Any] | None:
|
def get(
|
||||||
...
|
pkgname: str, arch: Arch, replace_subpkgnames: bool = False, must_exist: bool = True
|
||||||
|
) -> dict[str, Any] | None: ...
|
||||||
|
|
||||||
|
|
||||||
@Cache("pkgname", "arch", "replace_subpkgnames")
|
@Cache("pkgname", "arch", "replace_subpkgnames")
|
||||||
|
|
|
@ -132,9 +132,9 @@ def partition_cgpt(layout, size_boot, size_reserve):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pmb.chroot.apk.install(["cgpt"], Chroot.native(), build=False)
|
pmb.chroot.apk.install(["cgpt"], Chroot.native(), build=False)
|
||||||
|
|
||||||
deviceinfo = pmb.parse.deviceinfo()
|
deviceinfo = pmb.parse.deviceinfo()
|
||||||
|
|
||||||
if deviceinfo.cgpt_kpart_start is None or deviceinfo.cgpt_kpart_size is None:
|
if deviceinfo.cgpt_kpart_start is None or deviceinfo.cgpt_kpart_size is None:
|
||||||
raise RuntimeError("cgpt_kpart_start or cgpt_kpart_size not found in deviceinfo")
|
raise RuntimeError("cgpt_kpart_start or cgpt_kpart_size not found in deviceinfo")
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import inspect
|
||||||
FuncArgs = TypeVar("FuncArgs")
|
FuncArgs = TypeVar("FuncArgs")
|
||||||
FuncReturn = TypeVar("FuncReturn")
|
FuncReturn = TypeVar("FuncReturn")
|
||||||
|
|
||||||
|
|
||||||
class Wrapper(Generic[FuncArgs, FuncReturn]):
|
class Wrapper(Generic[FuncArgs, FuncReturn]):
|
||||||
def __init__(self, cache: "Cache", func: Callable[[FuncArgs], FuncReturn]):
|
def __init__(self, cache: "Cache", func: Callable[[FuncArgs], FuncReturn]):
|
||||||
self.cache = cache
|
self.cache = cache
|
||||||
|
@ -126,12 +127,10 @@ class Cache:
|
||||||
return key
|
return key
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __call__(self, func: Callable[..., FuncReturn]) -> Wrapper[None, FuncReturn]:
|
def __call__(self, func: Callable[..., FuncReturn]) -> Wrapper[None, FuncReturn]: ...
|
||||||
...
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]:
|
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]: ...
|
||||||
...
|
|
||||||
|
|
||||||
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]:
|
def __call__(self, func: Callable[[FuncArgs], FuncReturn]) -> Wrapper[FuncArgs, FuncReturn]:
|
||||||
argnames = func.__code__.co_varnames
|
argnames = func.__code__.co_varnames
|
||||||
|
|
|
@ -297,7 +297,7 @@ def extract_version(config_path):
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
||||||
|
|
||||||
def check_file(config_path, components_list: list[str]=[], details=False):
|
def check_file(config_path, components_list: list[str] = [], details=False):
|
||||||
"""
|
"""
|
||||||
Check for necessary kernel config options in a kconfig file.
|
Check for necessary kernel config options in a kconfig file.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue