[+] splash support

This commit is contained in:
Maxim Khomutov 2025-03-24 17:01:43 +03:00
parent ed5ee5dad1
commit 2d0fca9845
3 changed files with 13 additions and 6 deletions

View File

@ -8,17 +8,22 @@ from .patchers import patch_core_build
from .patchers import patch_metadata
from .config import *
product_name = "None" # Автоматически берется из metadata
product_name = "None" # Читается из metadata
icon = "" # Читается из metadata
splash = "" # Читается из metadata
def get_pyinstaller_cmd():
splash_str = ""
if splash:
splash_str = f'--splash {path_fix + splash} '
pyinstaller_cmd = \
(f'pyinstaller --noconfirm --onedir --console --clean '
(f'pyinstaller --noconfirm --onedir --console --clean {splash_str}'
f'--icon {path_fix + icon} --version-file {path_fix + metadata_path_txt} --name {product_name}'
f'{"".join([f' --add-data {path_fix + d}' for d in data])} '
f'--workpath {workpath} --distpath {distpath} --specpath {specpath} '
f'--contents-directory {contents_directory} --optimize {optimize} '
f'{"--disable-windowed-traceback " if disable_windowed_traceback else ""}'
f'{"--uac-admin " if admin else ""}'
f'{"--uac-admin " if admin else ""} '
f'{main}')
logger.info(f"execute: {pyinstaller_cmd}")
return pyinstaller_cmd.split(" ")
@ -101,9 +106,9 @@ def cleanup():
os.makedirs(build_dir, exist_ok=True)
def build():
global product_name, icon
global product_name, icon, splash
new_ver = patch_core_build()
old_ver, product_name, icon = patch_metadata(*new_ver)
old_ver, product_name, icon, splash = patch_metadata(*new_ver)
logger.info("Building...")
# subprocess.run(['auto-py-to-exe', '--config', build_json_path], shell=True)
subprocess.run(get_pyinstaller_cmd())

View File

@ -15,6 +15,7 @@ build_json_path = './win/build.json'
main = 'src/main.py'
product_name = "None" # Читается из metadata
icon = "" # Читается из metadata
splash = "" # Читается из metadata
data = []
path_fix = os.path.abspath(os.path.dirname(__file__)) + "/../../"

View File

@ -14,6 +14,7 @@ def patch_metadata(major, minor, patch, build_i):
logger.info(" - metadata loaded")
product_name = metadata['ProductName']
icon = metadata['Icon']
splash = metadata.get("Splash")
old_data = metadata['Version']
logger.info(f" - current version: {old_data}")
logger.info(f" - patched version: {major}.{minor}.{patch}.{build_i}")
@ -24,4 +25,4 @@ def patch_metadata(major, minor, patch, build_i):
logger.info(" - creating version file")
subprocess.run(['create-version-file', metadata_path, '--outfile', metadata_path_txt])
logger.info("Ready")
return old_data, product_name, icon
return old_data, product_name, icon, splash