Only build installer on Windows

This commit is contained in:
Orsiris de Jong 2023-03-21 16:26:32 +01:00
parent 3b540b5963
commit 0394a3debc

View file

@ -7,8 +7,8 @@ __intname__ = "npbackup.compile-and-package-for-windows"
__author__ = "Orsiris de Jong" __author__ = "Orsiris de Jong"
__copyright__ = "Copyright (C) 2023 NetInvent" __copyright__ = "Copyright (C) 2023 NetInvent"
__license__ = "GPL-3.0-only" __license__ = "GPL-3.0-only"
__build__ = "2023013101" __build__ = "2023032101"
__version__ = "1.5.0" __version__ = "1.5.1"
import sys import sys
@ -201,41 +201,42 @@ def compile(arch, audience):
if exit_code != 0: if exit_code != 0:
errors = True errors = True
# installer compilation # windows installer compilation
_installer_version = installer_version.split("-")[0] if os.name == "nt":
PRODUCT_VERSION = _installer_version + ".0" _installer_version = installer_version.split("-")[0]
FILE_VERSION = _installer_version + ".0" PRODUCT_VERSION = _installer_version + ".0"
EXE_OPTIONS = '--company-name="{}" --product-name="{}" --file-version="{}" --product-version="{}" --copyright="{}" --file-description="{}" --trademarks="{}"'.format( FILE_VERSION = _installer_version + ".0"
COMPANY_NAME, EXE_OPTIONS = '--company-name="{}" --product-name="{}" --file-version="{}" --product-version="{}" --copyright="{}" --file-description="{}" --trademarks="{}"'.format(
PRODUCT_NAME, COMPANY_NAME,
FILE_VERSION, PRODUCT_NAME,
PRODUCT_VERSION, FILE_VERSION,
COPYRIGHT, PRODUCT_VERSION,
file_description, COPYRIGHT,
TRADEMARKS, file_description,
) TRADEMARKS,
CMD = '{} -m nuitka --python-flag=no_docstrings --python-flag=-O {} {} --onefile --plugin-enable=tk-inter --include-data-file="{}"="{}" --include-data-file="{}"="{}" --include-data-dir="{}"="{}" --windows-icon-from-ico="{}" --windows-uac-admin --output-dir="{}" bin/NPBackupInstaller.py'.format( )
PYTHON_EXECUTABLE, CMD = '{} -m nuitka --python-flag=no_docstrings --python-flag=-O {} {} --onefile --plugin-enable=tk-inter --include-data-file="{}"="{}" --include-data-file="{}"="{}" --include-data-dir="{}"="{}" --windows-icon-from-ico="{}" --windows-uac-admin --output-dir="{}" bin/NPBackupInstaller.py'.format(
NUITKA_OPTIONS, PYTHON_EXECUTABLE,
EXE_OPTIONS, NUITKA_OPTIONS,
program_executable_path, EXE_OPTIONS,
program_executable, program_executable_path,
dist_conf_file_source, program_executable,
dist_conf_file_dest, dist_conf_file_source,
excludes_dir_source, dist_conf_file_dest,
excludes_dir_dest, excludes_dir_source,
icon_file, excludes_dir_dest,
OUTPUT_DIR, icon_file,
) OUTPUT_DIR,
)
print(CMD) print(CMD)
exit_code, output = command_runner(CMD, timeout=0, live_output=True) exit_code, output = command_runner(CMD, timeout=0, live_output=True)
if exit_code != 0: if exit_code != 0:
errors = True errors = True
else: else:
## Create version file ## Create version file
with open(os.path.join(BUILDS_DIR, audience, "VERSION"), "w") as fh: with open(os.path.join(BUILDS_DIR, audience, "VERSION"), "w") as fh:
fh.write(npbackup_version) fh.write(npbackup_version)
print("COMPILE ERRORS", errors) print("COMPILE ERRORS", errors)