|
5 | 5 | from pathlib import Path |
6 | 6 |
|
7 | 7 | # -------------------------------------------------- |
8 | | -# Resolve project root (run from repo root) |
| 8 | +# Resolve project root |
9 | 9 | # -------------------------------------------------- |
10 | 10 | ROOT_DIR = Path.cwd() |
11 | 11 | sys.path.insert(0, str(ROOT_DIR)) |
12 | 12 |
|
13 | 13 | # -------------------------------------------------- |
14 | | -# Metadata injected by extract_metadata.py |
| 14 | +# Metadata from extract_metadata.py |
15 | 15 | # -------------------------------------------------- |
16 | 16 | APP_NAME = os.environ.get("APP_NAME", "StaTube") |
17 | 17 | APP_VERSION = os.environ.get("APP_VERSION", "0.0.0") |
18 | 18 | APP_PUBLISHER = os.environ.get("APP_PUBLISHER", "Unknown") |
19 | 19 | APP_DESCRIPTION = os.environ.get("APP_DESCRIPTION", "Unknown") |
20 | 20 |
|
21 | 21 | # -------------------------------------------------- |
22 | | -# READ UpgradeCode (THIS IS THE CRITICAL SECTION) |
| 22 | +# Read UpgradeCode (stored WITHOUT braces) |
23 | 23 | # -------------------------------------------------- |
24 | 24 | upgrade_file = ROOT_DIR / "build" / "installer" / "upgrade_code.txt" |
25 | | - |
26 | 25 | raw = upgrade_file.read_text(encoding="utf-8") |
27 | 26 |
|
28 | | -UPGRADE_CODE = raw.strip().lower() |
29 | | - |
30 | | -# ---------- DEBUG OUTPUT (TEMPORARY) ---------- |
31 | | -print("DEBUG UpgradeCode repr:", repr(UPGRADE_CODE)) |
32 | | -print("DEBUG UpgradeCode length:", len(UPGRADE_CODE)) |
33 | | -# --------------------------------------------- |
| 27 | +UPGRADE_CODE_RAW = raw.strip().lower() |
34 | 28 |
|
35 | | -# ---------- HARD VALIDATION ---------- |
| 29 | +# Validate UUID (no braces) |
36 | 30 | if not re.fullmatch( |
37 | 31 | r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}", |
38 | | - UPGRADE_CODE, |
| 32 | + UPGRADE_CODE_RAW, |
39 | 33 | ): |
40 | | - raise RuntimeError(f"Invalid UpgradeCode: {repr(UPGRADE_CODE)}") |
41 | | -# --------------------------------------------- |
| 34 | + raise RuntimeError(f"Invalid UpgradeCode in file: {repr(UPGRADE_CODE_RAW)}") |
| 35 | + |
| 36 | +# cx_Freeze / msilib REQUIRES braces |
| 37 | +UPGRADE_CODE = f"{{{UPGRADE_CODE_RAW}}}" |
42 | 38 |
|
| 39 | +# -------------------------------------------------- |
| 40 | +# cx_Freeze configuration |
| 41 | +# -------------------------------------------------- |
43 | 42 | base = "Win32GUI" if sys.platform == "win32" else None |
44 | 43 |
|
45 | 44 | build_exe_options = { |
|
0 commit comments