Compare commits

...

6 Commits

Author SHA1 Message Date
efc6eb3044 [+] py3.8 support 2025-05-19 11:26:03 +03:00
1ea733814b [!] Fix windowed mode 2025-04-01 15:46:46 +03:00
b33b067e75 [+] Window support 2025-04-01 15:18:01 +03:00
6b9094abf5 [!] fix add-data 2025-03-26 12:58:09 +03:00
605919d1c8 [!!] fix build 2025-03-24 17:24:10 +03:00
2d0fca9845 [+] splash support 2025-03-24 17:01:43 +03:00
4 changed files with 37 additions and 14 deletions

View File

@@ -8,20 +8,36 @@ 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 = ""
uac_admin = ""
dwt = ""
windows_mode = "--console"
if windowed[0]:
windows_mode = "-w"
add_data = [f'--add-data {path_fix + d}' for d in data]
if splash:
splash_str = f' --splash {path_fix + splash} '
if add_data:
add_data = f" {' '.join(add_data)}"
if disable_windowed_traceback:
dwt = " --disable-windowed-traceback "
if admin:
uac_admin = " --uac-admin "
pyinstaller_cmd = \
(f'pyinstaller --noconfirm --onedir --console --clean '
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'pyinstaller --noconfirm --onedir {windows_mode} --clean '
f'--icon {path_fix + icon} --version-file {path_fix + metadata_path_txt}'
f'{splash_str}{add_data}{dwt}{uac_admin}'
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'{main}')
f'--name {product_name} {main}').split(" ")
pyinstaller_cmd = [x for x in pyinstaller_cmd if x]
logger.info(f"execute: {pyinstaller_cmd}")
return pyinstaller_cmd.split(" ")
return pyinstaller_cmd
def calculate_sha256(file_path):
sha256_hash = hashlib.sha256()
@@ -101,9 +117,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())
@@ -122,7 +138,7 @@ def build():
new_ver = f"{new_ver[0]}.{new_ver[1]}.{new_ver[2]}.{new_ver[3]}"
if diff:
update_dir = generate_patch(old_ver, new_ver, diff)
logger.info(f" - diffs in: {update_dir.split("/")[-1]}")
logger.info(f" - diffs in: {update_dir.split('/')[-1]}")
logger.info(" - saving..")
save_sha256(new_sha)

View File

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

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

View File

@@ -1,8 +1,6 @@
import sys
from dist_scripts import config
from dist_scripts import build
from dist_scripts import patchers
mode = "build"
build_args = ""
@@ -16,6 +14,11 @@ if "ctk" in build_args:
config.data.append("./.venv/Lib/site-packages/customtkinter;customtkinter/") # Папка с библиотекой customtkinter
if "res" in build_args:
config.data.append("./src/resources;resources/") # Папка с ресурсами для UI и т.д.
if "w" in build_args:
config.windowed[0] = True
from dist_scripts import build
from dist_scripts import patchers
if __name__ == '__main__':
if mode == "build":