refactor: build platform packs without printing

build_platform_pack and build_split_packs return what the build came to and print nothing. print_platform_pack holds the report lines, and generate_pack and generate_split_packs compose the two. The variant choice, the plan and the data directory pass return their notices instead of printing them. The callers that silenced stdout to get a record now call the builder.
This commit is contained in:
Abdessamad Derraz committed 2026-11-22 02:26:45 +01:00
1 parent 977d3f6874
commit d8570c6480
15 files changed
+295 -205

No files matched your search

+3 -6
View File
@@ -1445,18 +1445,15 @@ class ANativeNameSelectsOneSetEverywhere(unittest.TestCase):
cls.profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
def _packed(self, platform: str, systems: list[str]) -> set[str]:
import contextlib
import io
import zipfile
with tempfile.TemporaryDirectory() as out, \
contextlib.redirect_stdout(io.StringIO()):
zip_path = platformpack.generate_pack(
with tempfile.TemporaryDirectory() as out:
zip_path = platformpack.build_platform_pack(
platform, str(REPO_ROOT / "platforms"), self.db,
str(REPO_ROOT / "bios"), out,
emulators_dir=str(REPO_ROOT / "emulators"),
emu_profiles=self.profiles, system_filter=systems, offline=True,
)
).zip_path
with zipfile.ZipFile(zip_path) as zf:
infos = [i for i in zf.infolist() if not i.is_dir()]
return {i.filename: i.file_size for i in infos}