Harden updater and add icon-based installer release pipeline
Build and Release / build (push) Has been cancelled
Build and Release / build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main() -> int:
|
||||
project_root = Path(__file__).resolve().parents[1]
|
||||
png_path = project_root / "assets" / "app_icon.png"
|
||||
ico_path = project_root / "assets" / "app_icon.ico"
|
||||
|
||||
if not png_path.exists():
|
||||
print(f"Icon PNG not found: {png_path}")
|
||||
return 1
|
||||
|
||||
try:
|
||||
from PIL import Image
|
||||
except ImportError:
|
||||
print("Pillow missing. Install with: pip install pillow")
|
||||
return 1
|
||||
|
||||
with Image.open(png_path) as image:
|
||||
image = image.convert("RGBA")
|
||||
sizes = [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
|
||||
image.save(ico_path, format="ICO", sizes=sizes)
|
||||
|
||||
print(f"Wrote icon: {ico_path}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,35 @@
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main() -> int:
|
||||
if len(sys.argv) < 2:
|
||||
print("Usage: python scripts/set_version.py <version>")
|
||||
return 1
|
||||
|
||||
version = sys.argv[1].strip().lstrip("v")
|
||||
if not re.fullmatch(r"\d+(?:\.\d+){1,3}", version):
|
||||
print(f"Invalid version: {version}")
|
||||
return 1
|
||||
|
||||
target = Path(__file__).resolve().parents[1] / "real_debrid_downloader_gui.py"
|
||||
content = target.read_text(encoding="utf-8")
|
||||
updated, count = re.subn(
|
||||
r'^APP_VERSION\s*=\s*"[^"]+"\s*$',
|
||||
f'APP_VERSION = "{version}"',
|
||||
content,
|
||||
count=1,
|
||||
flags=re.MULTILINE,
|
||||
)
|
||||
if count != 1:
|
||||
print("APP_VERSION marker not found")
|
||||
return 1
|
||||
|
||||
target.write_text(updated, encoding="utf-8")
|
||||
print(f"Set APP_VERSION to {version}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user