1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 03:19:47 +03:00

pmb.chroot.run: Add another overload for root() (MR 2515)

Having a more generic overload like this fixes the issue where mypy
complains about no matching overloads at the call site in userm().
This commit is contained in:
Newbyte 2024-12-20 20:08:13 +01:00 committed by Oliver Smith
parent 6411aa4791
commit 978e6cf7d3
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -143,6 +143,20 @@ def root(
) -> str: ...
@overload
def root(
cmds: Sequence[PathString],
chroot: Chroot = ...,
working_dir: PurePath = ...,
output: RunOutputType = ...,
output_return: bool = ...,
check: bool | None = ...,
env: Env = ...,
disable_timeout: bool = ...,
add_proxy_env_vars: bool = ...,
) -> subprocess.Popen | int | str: ...
def root(
cmds: Sequence[PathString],
chroot: Chroot = Chroot.native(),
@ -195,8 +209,7 @@ def userm(
flat_cmd = pmb.helpers.run_core.flat_cmd(cmds, env=env)
cmd = ["busybox", "su", "pmos", "-c", flat_cmd]
# Can't figure out why this one fails :(
return pmb.chroot.root( # type: ignore[call-overload]
return pmb.chroot.root(
cmd, chroot, working_dir, output, output_return, check, {}, add_proxy_env_vars=False
)