1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 15:57:14 +03:00

#2040 Dynamically Build iss File

This commit is contained in:
David Sangrey 2023-08-01 16:30:59 -04:00
parent 89101fc73c
commit 45804dafc1
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
3 changed files with 20 additions and 3 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ appcast_win_*.xml
appcast_mac_*.xml
EDMarketConnector.VisualElementsManifest.xml
*.zip
EDMC_Installer_Config.iss
.idea
.vscode

View File

@ -1,5 +1,5 @@
#define MyAppName "EDMarketConnector"
#define MyAppVersion "5.9.1-alpha2"
#define MyAppVersion "$appver"
#define MyAppPublisher "EDCD"
#define MyAppURL "https://edcd.github.io/"
#define SuppURL "https://github.com/EDCD/EDMarketConnector/"
@ -29,7 +29,8 @@ WizardStyle=modern
InfoBeforeFile=dist.win32\Changelog.md
OutputDir=.
LicenseFile=LICENSE
LanguageDetectionMethod=uilanguage
AlwaysShowDirOnReadyPage=yes
UninstallDisplayIcon={app}\{#MyAppExeName}
[Languages]

View File

@ -7,7 +7,19 @@ See LICENSE file.
"""
import os
import subprocess
from string import Template
from build import build
from config import _static_appversion as appversion
def iss_build(template_path: str, output_file: str) -> None:
"""Build the .iss file needed for building the installer EXE."""
sub_vals = {"appver": appversion}
with open(template_path, encoding="UTF8") as template_file:
src = Template(template_file.read())
newfile = src.substitute(sub_vals)
with open(output_file, "w", encoding="UTF8") as new_file:
new_file.write(newfile)
def run_inno_setup_installer(iss_path: str) -> None:
@ -39,6 +51,9 @@ def run_inno_setup_installer(iss_path: str) -> None:
if __name__ == "__main__":
build()
# Replace 'your_iss_file.iss' with the path to your actual .iss file
# Add the ISS Template File
iss_template_path: str = "./EDMC_Installer_Config_template.txt"
iss_file_path: str = "./EDMC_Installer_Config.iss"
# Build the ISS file
iss_build(iss_template_path, iss_file_path)
run_inno_setup_installer(iss_file_path)