1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 23:37:14 +03:00

#2040 Move ISS File Build to Builder

This commit is contained in:
David Sangrey 2023-08-02 14:32:30 -04:00
parent 0d3f3f4a52
commit 376ac667c9
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
2 changed files with 17 additions and 14 deletions

View File

@ -10,6 +10,7 @@ import shutil
import sys import sys
import pathlib import pathlib
from typing import List, Tuple from typing import List, Tuple
from string import Template
from os.path import join, isdir from os.path import join, isdir
import py2exe import py2exe
from config import ( from config import (
@ -18,9 +19,20 @@ from config import (
appversion, appversion,
copyright, copyright,
git_shorthash_from_head, 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: def system_check(dist_dir: str) -> str:
"""Check if the system is able to build.""" """Check if the system is able to build."""
if sys.version_info < (3, 11): if sys.version_info < (3, 11):
@ -166,6 +178,11 @@ def build() -> None:
options=options, 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__": if __name__ == "__main__":
build() build()

View File

@ -7,19 +7,7 @@ See LICENSE file.
""" """
import os import os
import subprocess import subprocess
from string import Template
from build import build 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: 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__": if __name__ == "__main__":
build() build()
# Add the ISS Template File # Add the ISS Template File
iss_template_path: str = "./resources/EDMC_Installer_Config_template.txt"
iss_file_path: str = "./EDMC_Installer_Config.iss" iss_file_path: str = "./EDMC_Installer_Config.iss"
# Build the ISS file # Build the ISS file
iss_build(iss_template_path, iss_file_path)
run_inno_setup_installer(iss_file_path) run_inno_setup_installer(iss_file_path)