forked from Mirror/pmbootstrap
pmb: Make RunOutputTypeDefault and RunOutputTypePopen enums
This allows us to get rid of some of the validation in sanity_checks() as mypy handles this validation at "build time", and any typos in the enum instantiation would be a runtime error rather than a silent failure. Additionally, it allows us to encode some of the behaviour of the different output types into the type definition itself by using methods. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2642 (cherry picked from commit7d2f055bcb
) pmb: Fix PmbArgs containing a string for output While the annotations were changed to suggest that the output property of PmbArgs contains a RunOutputType, at runtime it actually contained a string because the argument parsing code hadn't been adapted to create a RunOutputType. Fix this, and also change it to RunOutputTypeDefault as while at it as that's more accurate. Fixes7d2f055bcb
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2644
This commit is contained in:
parent
3ea5a3433b
commit
861de1e507
21 changed files with 193 additions and 88 deletions
|
@ -26,7 +26,7 @@ def rootm(
|
|||
cmds: Sequence[Sequence[PathString]],
|
||||
chroot: Chroot = Chroot.native(),
|
||||
working_dir: PurePath = PurePath("/"),
|
||||
output: RunOutputType = "log",
|
||||
output: RunOutputType = RunOutputTypeDefault.LOG,
|
||||
output_return: bool = False,
|
||||
check: bool | None = None,
|
||||
env: Env = {},
|
||||
|
@ -161,7 +161,7 @@ def root(
|
|||
cmds: Sequence[PathString],
|
||||
chroot: Chroot = Chroot.native(),
|
||||
working_dir: PurePath = PurePath("/"),
|
||||
output: RunOutputType = "log",
|
||||
output: RunOutputType = RunOutputTypeDefault.LOG,
|
||||
output_return: bool = False,
|
||||
check: bool | None = None,
|
||||
env: Env = {},
|
||||
|
@ -185,7 +185,7 @@ def userm(
|
|||
cmds: Sequence[Sequence[PathString]],
|
||||
chroot: Chroot = Chroot.native(),
|
||||
working_dir: Path = Path("/"),
|
||||
output: RunOutputType = "log",
|
||||
output: RunOutputType = RunOutputTypeDefault.LOG,
|
||||
output_return: bool = False,
|
||||
check: bool | None = None,
|
||||
env: Env = {},
|
||||
|
@ -254,7 +254,7 @@ def user(
|
|||
cmd: Sequence[PathString],
|
||||
chroot: Chroot = Chroot.native(),
|
||||
working_dir: Path = Path("/"),
|
||||
output: RunOutputType = "log",
|
||||
output: RunOutputType = RunOutputTypeDefault.LOG,
|
||||
output_return: bool = False,
|
||||
check: bool | None = None,
|
||||
env: Env = {},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue