diff --git a/build.py b/build.py index 729c0754..e48f299c 100644 --- a/build.py +++ b/build.py @@ -10,6 +10,7 @@ import shutil import sys import pathlib from typing import List, Tuple +from string import Template from os.path import join, isdir import py2exe from config import ( @@ -18,9 +19,20 @@ from config import ( appversion, copyright, git_shorthash_from_head, + _static_appversion, ) +def iss_build(template_path: str, output_file: str) -> None: + """Build the .iss file needed for building the installer EXE.""" + sub_vals = {"appver": _static_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 system_check(dist_dir: str) -> str: """Check if the system is able to build.""" if sys.version_info < (3, 11): @@ -166,6 +178,11 @@ def build() -> None: options=options, ) + iss_template_path: str = "./resources/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) + if __name__ == "__main__": build() diff --git a/installer.py b/installer.py index 3405557f..754b3373 100644 --- a/installer.py +++ b/installer.py @@ -7,19 +7,7 @@ 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: @@ -52,8 +40,6 @@ def run_inno_setup_installer(iss_path: str) -> None: if __name__ == "__main__": build() # Add the ISS Template File - iss_template_path: str = "./resources/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)