feat(auth): pywebview вместо webengine
- добавлен auth_webview.py и режим --auth - build.py обновлён, WebEngine исключён - pywebview добавлен в requirements
This commit is contained in:
43
build.py
43
build.py
@@ -5,11 +5,28 @@ import sys
|
||||
|
||||
# --- Конфигурация ---
|
||||
APP_NAME = "AnabasisManager"
|
||||
VERSION = "1.3" # Ваша версия
|
||||
VERSION = "1.5" # Ваша версия
|
||||
MAIN_SCRIPT = "main.py"
|
||||
ICON_PATH = "icon.ico"
|
||||
DIST_DIR = os.path.join("dist", APP_NAME)
|
||||
ARCHIVE_NAME = f"{APP_NAME}-{VERSION}" # Формат Название-Версия
|
||||
SAFE_CLEAN_ROOT_FILES = {"main.py", "requirements.txt", "build.py"}
|
||||
REMOVE_LIST = [
|
||||
"Qt6Pdf.dll", "Qt6PdfQuick.dll", "Qt6PdfWidgets.dll",
|
||||
"Qt6VirtualKeyboard.dll", "Qt6Positioning.dll",
|
||||
"Qt6PrintSupport.dll", "Qt6Svg.dll", "Qt6Sql.dll",
|
||||
"Qt6Charts.dll", "Qt6Multimedia.dll", "Qt63DCore.dll",
|
||||
"translations",
|
||||
"Qt6QuickTemplates2.dll"
|
||||
]
|
||||
|
||||
|
||||
def ensure_project_root():
|
||||
missing = [name for name in SAFE_CLEAN_ROOT_FILES if not os.path.exists(name)]
|
||||
if missing:
|
||||
print("[ERROR] Скрипт нужно запускать из корня проекта.")
|
||||
print(f"[ERROR] Не найдены: {', '.join(missing)}")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def run_build():
|
||||
@@ -20,12 +37,14 @@ def run_build():
|
||||
"--noconfirm",
|
||||
"--onedir",
|
||||
"--windowed",
|
||||
"--exclude-module", "PySide6.QtWebEngineCore",
|
||||
"--exclude-module", "PySide6.QtWebEngineWidgets",
|
||||
"--exclude-module", "PySide6.QtWebEngineQuick",
|
||||
f"--name={APP_NAME}",
|
||||
f"--icon={ICON_PATH}" if os.path.exists(ICON_PATH) else "",
|
||||
f"--add-data={ICON_PATH}{os.pathsep}." if os.path.exists(ICON_PATH) else "",
|
||||
"--collect-all", "PySide6.QtWebEngineCore",
|
||||
"--collect-all", "PySide6.QtWebEngineWidgets",
|
||||
MAIN_SCRIPT
|
||||
f"--add-data=auth_webview.py{os.pathsep}.",
|
||||
MAIN_SCRIPT
|
||||
]
|
||||
|
||||
command = [arg for arg in command if arg]
|
||||
@@ -46,16 +65,7 @@ def run_cleanup():
|
||||
if not os.path.exists(pyside_path):
|
||||
pyside_path = DIST_DIR
|
||||
|
||||
to_remove = [
|
||||
"Qt6Pdf.dll", "Qt6PdfQuick.dll", "Qt6PdfWidgets.dll",
|
||||
"Qt6VirtualKeyboard.dll", "Qt6Positioning.dll",
|
||||
"Qt6PrintSupport.dll", "Qt6Svg.dll", "Qt6Sql.dll",
|
||||
"Qt6Charts.dll", "Qt6Multimedia.dll", "Qt63DCore.dll",
|
||||
"translations",
|
||||
"Qt6QuickTemplates2.dll"
|
||||
]
|
||||
|
||||
for item in to_remove:
|
||||
for item in REMOVE_LIST:
|
||||
path = os.path.join(pyside_path, item)
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
@@ -81,6 +91,7 @@ def create_archive():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
ensure_project_root()
|
||||
# Предварительная очистка
|
||||
for folder in ["build", "dist"]:
|
||||
if os.path.exists(folder):
|
||||
@@ -91,6 +102,6 @@ if __name__ == "__main__":
|
||||
create_archive()
|
||||
|
||||
print("\n" + "=" * 30)
|
||||
print(f"ПРОЦЕСС ЗАВЕРШЕН")
|
||||
print("ПРОЦЕСС ЗАВЕРШЕН")
|
||||
print(f"Файл для отправки: dist/{ARCHIVE_NAME}.zip")
|
||||
print("=" * 30)
|
||||
print("=" * 30)
|
||||
|
||||
Reference in New Issue
Block a user