Compare commits

...

3 Commits

6 changed files with 163 additions and 173 deletions

2
bootstrap.cmd Normal file
View File

@ -0,0 +1,2 @@
python -m pip install -r requirements.txt
python -m pip install -r build-requirements-nuitka.txt

View File

@ -1,3 +1,3 @@
nuitka==1.2.4
nuitka==1.4.8
ordered-set==4.1.0
zstandard==0.19.0
zstandard==0.20.0

View File

@ -1 +0,0 @@
pyinstaller==5.7.0

1
build.cmd Normal file
View File

@ -0,0 +1 @@
python -m nuitka --standalone --onefile --prefer-source-code --assume-yes-for-downloads --remove-output --lto=yes --windows-uac-admin --company-name=Cyrmax --product-name=Sku_Updater --file-version=32.15 --product-version=32.15 --file-description="A console program to update your installation of Sku for WoW Classic" --copyright="Made by Cyrmax in 2022. MIT license" sku-updater.py

View File

@ -1,3 +1,4 @@
from functools import total_ordering
import os
import pathlib
import re
@ -12,6 +13,37 @@ import requests
SKU_URL = "https://duugu.github.io/Sku"
@total_ordering
class Version:
major: int
minor: int
def __init__(self, number: float):
components = str(number).split(".")
self.major = int(components[0])
self.minor = int(components[1]) if len(components) > 1 else 0
def __eq__(self, other) -> bool:
return self.major == other.major and self.minor == other.minor
def __lt__(self, other) -> bool:
if self.major != other.major:
return self.major < other.major
else:
return self.minor < other.minor
def __gt__(self, other) -> bool:
if self.major != other.major:
return self.major > other.major
else:
return self.minor > other.minor
def __str__(self) -> str:
return f"{self.major}.{self.minor}"
def __repr__(self):
return str(self)
def confirmed_exit(code: int):
print("Press enter to exit program")
input()
@ -31,7 +63,7 @@ def get_sku_version(sku_path: pathlib.Path) -> float:
changelog_path = sku_path / "CHANGELOG.md"
with changelog_path.open("r") as f:
txt = f.read()
version_match = re.search(r"^\# Sku \((\d+\.\d+)\)", txt)
version_match = re.search(r"^\# Sku \(((\d+\.\d+)|(\d+))\)", txt)
if not version_match:
print("Unable to determine Sku version")
confirmed_exit(1)
@ -40,12 +72,12 @@ def get_sku_version(sku_path: pathlib.Path) -> float:
except ValueError:
print("Unable to determine Sku version")
confirmed_exit(1)
return version
return Version(version)
def fetch_sku_version() -> tuple[float, str]:
rre = re.compile(
r"^https://github.com/Duugu/Sku/releases/download/r\d+\.\d+/Sku-r\d+\.\d+-.+\.zip$",
r"^https://github.com/Duugu/Sku/releases/download/r(\d+\.\d+)|(\d+)/Sku-r(\d+\.\d+)|(\d+)-.+\.zip$",
re.I,
)
r = requests.get(SKU_URL)
@ -56,14 +88,14 @@ def fetch_sku_version() -> tuple[float, str]:
confirmed_exit(1)
href = links[0].get("href")
version_match = re.search(
r"^https://github.com/Duugu/Sku/releases/download/r\d+\.\d+/Sku-r(\d+\.\d+)-.+\.zip$",
r"^https://github.com/Duugu/Sku/releases/download/r(\d+\.\d+)|(\d+)/Sku-r((\d+\.\d+)|(\d+))-.+\.zip$",
href,
)
if not version_match:
print("Unable to fetch latest Sku version")
confirmed_exit(1)
version = float(version_match.group(1))
return (version, href)
return (Version(version), href)
def update_sku(sku_info: tuple[float, str], sku_path: pathlib.Path):

View File

@ -1,44 +0,0 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['sku-updater.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='sku-updater',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)