Add VK callback auth support and admin demotion
This commit is contained in:
27
build.py
27
build.py
@@ -1,3 +1,4 @@
|
||||
import hashlib
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
@@ -62,6 +63,24 @@ def ensure_project_root():
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def write_sha256_file(file_path):
|
||||
if not os.path.exists(file_path):
|
||||
print(f"[ERROR] Cannot create SHA256, file not found: {file_path}")
|
||||
sys.exit(1)
|
||||
|
||||
digest = hashlib.sha256()
|
||||
with open(file_path, "rb") as f:
|
||||
for chunk in iter(lambda: f.read(1024 * 1024), b""):
|
||||
digest.update(chunk)
|
||||
|
||||
checksum_path = f"{file_path}.sha256"
|
||||
file_name = os.path.basename(file_path)
|
||||
with open(checksum_path, "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(f"{digest.hexdigest()} {file_name}\n")
|
||||
print(f"[OK] SHA256 created: {checksum_path}")
|
||||
return checksum_path
|
||||
|
||||
|
||||
def run_build():
|
||||
print(f"--- 1. Running PyInstaller for {APP_NAME} v{VERSION} ---")
|
||||
icon_abs_path = os.path.abspath(ICON_PATH)
|
||||
@@ -149,8 +168,9 @@ def create_archive():
|
||||
try:
|
||||
# Создаем zip-архив из папки DIST_DIR
|
||||
# base_name - имя файла без расширения, format - 'zip', root_dir - что упаковываем
|
||||
shutil.make_archive(os.path.join("dist", ARCHIVE_NAME), 'zip', DIST_DIR)
|
||||
print(f"[OK] Archive created: dist/{ARCHIVE_NAME}.zip")
|
||||
archive_path = shutil.make_archive(os.path.join("dist", ARCHIVE_NAME), 'zip', DIST_DIR)
|
||||
print(f"[OK] Archive created: {archive_path}")
|
||||
write_sha256_file(archive_path)
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Failed to create archive: {e}")
|
||||
|
||||
@@ -245,6 +265,7 @@ def build_installer():
|
||||
print(f"[ERROR] Installer was not created: {installer_path}")
|
||||
sys.exit(1)
|
||||
print(f"[OK] Installer created: {installer_path}")
|
||||
write_sha256_file(installer_path)
|
||||
except Exception as e:
|
||||
print(f"[ERROR] Failed to build installer: {e}")
|
||||
sys.exit(1)
|
||||
@@ -268,5 +289,7 @@ if __name__ == "__main__":
|
||||
print("\n" + "=" * 30)
|
||||
print("BUILD COMPLETED")
|
||||
print(f"Release archive: dist/{ARCHIVE_NAME}.zip")
|
||||
print(f"Release archive SHA256: dist/{ARCHIVE_NAME}.zip.sha256")
|
||||
print(f"Installer: dist/{INSTALLER_NAME}")
|
||||
print(f"Installer SHA256: dist/{INSTALLER_NAME}.sha256")
|
||||
print("=" * 30)
|
||||
|
||||
Reference in New Issue
Block a user