refactor: move generate_pack modes into packs

Option checks go to packs/packoptions.py, the run modes to
packs/packmodes.py and the platform choice to packs/platformrun.py.
generate_pack.py keeps main() and build_parser(). Tests patch the
package modules instead of command attributes.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 15:47:20 +01:00
1 parent ac06822d2e
commit 37ec04aed1
7 files changed
+436 -415

No files matched your search

+3 -3
View File
@@ -68,7 +68,7 @@ class AMistypedTargetIsRefusedFirst(unittest.TestCase):
from unittest import mock
import generate_pack
from packs import platformrun
from packs import packmodes, platformrun
def touched(*_a, **_kw):
raise AssertionError("lock or refresh taken before the target check")
@@ -77,8 +77,8 @@ class AMistypedTargetIsRefusedFirst(unittest.TestCase):
"--output-dir", str(REPO_ROOT / "tmp" / "never-written")]
err = io.StringIO()
with mock.patch.object(sys, "argv", argv), \
mock.patch.object(generate_pack, "pack_output_lock", touched), \
mock.patch.object(generate_pack, "hold_data_dirs", touched), \
mock.patch.object(packmodes, "pack_output_lock", touched), \
mock.patch.object(packmodes, "hold_data_dirs", touched), \
mock.patch.object(platformrun, "pack_output_lock", touched), \
mock.patch.object(platformrun, "hold_data_dirs", touched), \
contextlib.redirect_stdout(io.StringIO()), \