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
This commit is contained in:
parent
77b2717d66
commit
7d2f055bcb
20 changed files with 167 additions and 84 deletions
|
@ -19,7 +19,7 @@ from pmb.types import (
|
|||
def user(
|
||||
cmd: Sequence[PathString],
|
||||
working_dir: Path | None = None,
|
||||
output: RunOutputType = "log",
|
||||
output: RunOutputType = RunOutputTypeDefault.LOG,
|
||||
output_return: bool = False,
|
||||
check: bool | None = None,
|
||||
env: Env = {},
|
||||
|
@ -58,7 +58,7 @@ def user(
|
|||
def user_output(
|
||||
cmd: Sequence[PathString],
|
||||
working_dir: Path | None = None,
|
||||
output: RunOutputType = "log",
|
||||
output: RunOutputType = RunOutputTypeDefault.LOG,
|
||||
check: bool | None = None,
|
||||
env: Env = {},
|
||||
sudo: bool = False,
|
||||
|
@ -106,7 +106,7 @@ def root(
|
|||
def root(
|
||||
cmd: Sequence[PathString],
|
||||
working_dir: Path | None = None,
|
||||
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