Skip to content

Commit 84763d9

Browse files
authored
Update setup.py
1 parent 70386d0 commit 84763d9

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

build/cxfreeze/setup.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,41 +5,40 @@
55
from pathlib import Path
66

77
# --------------------------------------------------
8-
# Resolve project root (run from repo root)
8+
# Resolve project root
99
# --------------------------------------------------
1010
ROOT_DIR = Path.cwd()
1111
sys.path.insert(0, str(ROOT_DIR))
1212

1313
# --------------------------------------------------
14-
# Metadata injected by extract_metadata.py
14+
# Metadata from extract_metadata.py
1515
# --------------------------------------------------
1616
APP_NAME = os.environ.get("APP_NAME", "StaTube")
1717
APP_VERSION = os.environ.get("APP_VERSION", "0.0.0")
1818
APP_PUBLISHER = os.environ.get("APP_PUBLISHER", "Unknown")
1919
APP_DESCRIPTION = os.environ.get("APP_DESCRIPTION", "Unknown")
2020

2121
# --------------------------------------------------
22-
# READ UpgradeCode (THIS IS THE CRITICAL SECTION)
22+
# Read UpgradeCode (stored WITHOUT braces)
2323
# --------------------------------------------------
2424
upgrade_file = ROOT_DIR / "build" / "installer" / "upgrade_code.txt"
25-
2625
raw = upgrade_file.read_text(encoding="utf-8")
2726

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()
3428

35-
# ---------- HARD VALIDATION ----------
29+
# Validate UUID (no braces)
3630
if not re.fullmatch(
3731
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,
3933
):
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}}}"
4238

39+
# --------------------------------------------------
40+
# cx_Freeze configuration
41+
# --------------------------------------------------
4342
base = "Win32GUI" if sys.platform == "win32" else None
4443

4544
build_exe_options = {

0 commit comments

Comments
 (0)