test
This commit is contained in:
29
build.py
29
build.py
@@ -10,6 +10,7 @@
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import shutil
|
||||
@@ -51,6 +52,32 @@ def clean():
|
||||
print("Очищено")
|
||||
|
||||
|
||||
def _data_args() -> list[str]:
|
||||
"""--add-data for resources bundled into the .exe so the program is
|
||||
self-contained: КриптоПро XPI, and (if present) portable Firefox + geckodriver."""
|
||||
args: list[str] = []
|
||||
|
||||
# Расширение КриптоПро — обязательно, всегда в репозитории.
|
||||
ext = ROOT / "extensions"
|
||||
if ext.is_dir():
|
||||
args += ["--add-data", f"{ext}{os.pathsep}extensions"]
|
||||
else:
|
||||
print("ВНИМАНИЕ: папка extensions/ не найдена — расширение КриптоПро не попадёт в сборку!")
|
||||
|
||||
# Портативный Firefox + geckodriver — наполняются скриптом fetch_vendor.py.
|
||||
vendor = ROOT / "vendor"
|
||||
if vendor.is_dir() and any(vendor.iterdir()):
|
||||
args += ["--add-data", f"{vendor}{os.pathsep}vendor"]
|
||||
print(f"vendor/ включён в сборку: {[p.name for p in vendor.iterdir()]}")
|
||||
else:
|
||||
print(
|
||||
"ВНИМАНИЕ: папка vendor/ пуста или отсутствует — Firefox и geckodriver НЕ будут\n"
|
||||
" встроены. Сначала запустите: python fetch_vendor.py"
|
||||
)
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def build():
|
||||
cmd = [
|
||||
sys.executable, "-m", "PyInstaller",
|
||||
@@ -58,6 +85,8 @@ def build():
|
||||
"--noconsole",
|
||||
"--name", "ФИАС_поиск",
|
||||
|
||||
*_data_args(),
|
||||
|
||||
# Собрать целиком вместе с data-файлами
|
||||
"--collect-all", "selenium",
|
||||
"--collect-all", "webdriver_manager",
|
||||
|
||||
Reference in New Issue
Block a user