Create Thüringen branding edition on shared core

This commit is contained in:
pan
2026-07-05 22:38:59 +02:00
commit ff53f88f35
19 changed files with 359 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env python3
"""Regenerate the portable 256-color crest data."""
from __future__ import annotations
import json
import re
import subprocess
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
ASSETS = ROOT / "synadm_tui_thueringen" / "assets"
PIXEL = re.compile(r"#([0-9A-Fa-f]{8})\s")
def main() -> int:
process = subprocess.run(
["convert", str(ASSETS / "thueringen-wappen.png"), "-filter", "Lanczos", "-resize", "18x20!", "txt:-"],
check=True,
text=True,
stdout=subprocess.PIPE,
)
pixels = [match.group(1).lower() for line in process.stdout.splitlines() if (match := PIXEL.search(line))]
if len(pixels) != 18 * 20:
raise RuntimeError(f"360 Pixel erwartet, {len(pixels)} erhalten")
target = ASSETS / "thuringia.block.json"
target.write_text(
json.dumps({"width": 18, "height": 20, "pixels": pixels}, separators=(",", ":")) + "\n",
encoding="utf-8",
)
print(target)
return 0
if __name__ == "__main__":
raise SystemExit(main())
+52
View File
@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""Build the Thüringen binary against the pinned synadm-tui core."""
from __future__ import annotations
import hashlib
import os
from pathlib import Path
import PyInstaller.__main__
ROOT = Path(__file__).resolve().parent.parent
CORE = Path(os.environ.get("SYNADM_TUI_CORE", ROOT / "vendor" / "synadm-tui")).resolve()
def main() -> int:
if not (CORE / "synadm_tui" / "app.py").is_file():
raise SystemExit("synadm-tui-Core fehlt; git submodule update --init ausführen.")
arguments = [
str(ROOT / "scripts" / "standalone_entry.py"),
"--name=synadm-tui-thueringen",
"--onefile",
"--clean",
f"--paths={ROOT}",
f"--paths={CORE}",
f"--distpath={ROOT / 'dist'}",
f"--workpath={ROOT / 'build' / 'pyinstaller'}",
f"--specpath={ROOT / 'build'}",
]
for asset in (
"retro-cyberspace.png",
"hacker-terminal.png",
"cyberspace.block.json",
"hacker.block.json",
):
arguments.append(f"--add-data={CORE / 'synadm_tui' / 'assets' / asset}:synadm_tui/assets")
for asset in ("thueringen-wappen.png", "thuringia.block.json"):
arguments.append(
f"--add-data={ROOT / 'synadm_tui_thueringen' / 'assets' / asset}:synadm_tui_thueringen/assets"
)
PyInstaller.__main__.run(arguments)
artifact = ROOT / "dist" / "synadm-tui-thueringen"
checksum = hashlib.sha256(artifact.read_bytes()).hexdigest()
(ROOT / "dist" / "SHA256SUMS").write_text(
f"{checksum} synadm-tui-thueringen\n", encoding="utf-8"
)
return 0
if __name__ == "__main__":
raise SystemExit(main())
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
"""Build DEB and RPM packages by reusing the pinned core's packaging code."""
from __future__ import annotations
import importlib.util
import os
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
CORE = Path(os.environ.get("SYNADM_TUI_CORE", ROOT / "vendor" / "synadm-tui")).resolve()
SPEC = importlib.util.spec_from_file_location("synadm_core_build_packages", CORE / "scripts" / "build_packages.py")
if not SPEC or not SPEC.loader:
raise SystemExit("Paketierungsmodul des synadm-tui-Core fehlt.")
module = importlib.util.module_from_spec(SPEC)
sys.modules[SPEC.name] = module
SPEC.loader.exec_module(module)
module.ROOT = ROOT
module.DIST = ROOT / "dist"
module.OUTPUT = module.DIST / "packages"
module.HOMEPAGE = "https://git.blackwall.ipv64.de/pan/synadm-tui-thueringen"
module.EDITIONS = (
module.Edition(
"synadm-tui-thueringen",
"synadm-tui-thueringen",
"Thüringen-Edition der synadm Terminal-Oberfläche",
"Regionales Branding auf dem unveränderten Anwendungskern von synadm-tui.",
),
)
raise SystemExit(module.main())
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""Publish Thüringen packages via the pinned core's secure uploader."""
from __future__ import annotations
import importlib.util
import os
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
CORE = Path(os.environ.get("SYNADM_TUI_CORE", ROOT / "vendor" / "synadm-tui")).resolve()
SPEC = importlib.util.spec_from_file_location("synadm_core_publish_packages", CORE / "scripts" / "publish_packages.py")
if not SPEC or not SPEC.loader:
raise SystemExit("Uploadmodul des synadm-tui-Core fehlt.")
module = importlib.util.module_from_spec(SPEC)
sys.modules[SPEC.name] = module
SPEC.loader.exec_module(module)
module.ROOT = ROOT
module.PACKAGE_DIR = ROOT / "dist" / "packages"
module.DEFAULT_DISTRIBUTION = "thueringen"
module.DEFAULT_RPM_GROUP = "thueringen"
raise SystemExit(module.main())
+6
View File
@@ -0,0 +1,6 @@
"""PyInstaller entry point for the Thüringen edition."""
from synadm_tui_thueringen.cli import main
raise SystemExit(main())