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

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:
Newbyte 2025-07-07 17:00:58 +02:00 committed by Oliver Smith
parent 77b2717d66
commit 7d2f055bcb
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
20 changed files with 167 additions and 84 deletions

View file

@ -11,6 +11,7 @@ from pmb.core.pkgrepo import (
from pmb.helpers import logging
from pmb.helpers.exceptions import NonBugError
from pmb.helpers.toml import load_toml_file
from pmb.types import RunOutputTypeDefault
import os
import pmb.chroot
@ -104,7 +105,7 @@ def check(pkgnames: Sequence[str]) -> None:
if pmb.chroot.user(
["apkbuild-lint", *apkbuild_paths],
check=False,
output="stdout",
output=RunOutputTypeDefault.STDOUT,
working_dir=dest_paths[pkgrepo_name(repo)],
env={"CUSTOM_VALID_OPTIONS": " ".join(get_custom_valid_options())},
):