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

#2040 Integrate Builder and Installer

This commit is contained in:
David Sangrey 2023-07-27 14:14:36 -04:00
parent dd1442f37b
commit 6f91e6ce4e
No known key found for this signature in database
GPG Key ID: 3AEADBB0186884BC
3 changed files with 29 additions and 21 deletions

View File

@ -33,6 +33,7 @@ WizardStyle=modern
InfoBeforeFile=dist.win32\Changelog.md
OutputDir=.
LicenseFile=LICENSE
LanguageDetectionMethod=uilanguage
[Languages]

View File

@ -9,8 +9,9 @@ import os
import shutil
import sys
import pathlib
import py2exe
from typing import List, Tuple
from os.path import join, isdir
import py2exe
from config import (
appcmdname,
appname,
@ -18,7 +19,6 @@ from config import (
copyright,
git_shorthash_from_head,
)
from typing import List, Tuple
def system_check(dist_dir: str) -> str:
@ -45,7 +45,7 @@ def system_check(dist_dir: str) -> str:
def generate_data_files(
app_name: str, gitversion_file: str
app_name: str, gitversion_file: str, plugins: List[str]
) -> List[Tuple[str, List[str]]]:
"""Create the required datafiles to build."""
l10n_dir = "L10n"
@ -81,26 +81,27 @@ def generate_data_files(
join(fdevids_dir, "rare_commodity.csv"),
],
),
("plugins", PLUGINS),
("plugins", plugins),
]
return data_files
if __name__ == "__main__":
DIST_DIR: str = "dist.win32"
GITVERSION_FILENAME: str = system_check(DIST_DIR)
def build() -> None:
"""Build EDMarketConnector using Py2Exe."""
dist_dir: str = "dist.win32"
gitversion_filename: str = system_check(dist_dir)
# Constants
PLUGINS: List[str] = [
plugins: List[str] = [
"plugins/coriolis.py",
"plugins/eddn.py",
"plugins/edsm.py",
"plugins/edsy.py",
"plugins/inara.py",
]
OPTIONS: dict = {
options: dict = {
"py2exe": {
"dist_dir": DIST_DIR,
"dist_dir": dist_dir,
"optimize": 2,
"packages": [
"asyncio",
@ -125,8 +126,8 @@ if __name__ == "__main__":
}
# Function to generate DATA_FILES list
DATA_FILES: List[Tuple[str, List[str]]] = generate_data_files(
appname, GITVERSION_FILENAME
data_files: List[Tuple[str, List[str]]] = generate_data_files(
appname, gitversion_filename, plugins
)
version_info: dict = {
@ -161,6 +162,10 @@ if __name__ == "__main__":
version_info=version_info,
windows=[windows_config],
console=[console_config],
data_files=DATA_FILES,
options=OPTIONS,
data_files=data_files,
options=options,
)
if __name__ == "__main__":
build()

View File

@ -7,9 +7,10 @@ See LICENSE file.
"""
import os
import subprocess
from build import build
def run_inno_setup_installer(iss_file_path: str) -> None:
def run_inno_setup_installer(iss_path: str) -> None:
"""Run the Inno installer, building the installation exe."""
# Get the path to the Inno Setup compiler (iscc.exe) (Currently set to default path)
inno_setup_compiler_path: str = "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe"
@ -21,22 +22,23 @@ def run_inno_setup_installer(iss_file_path: str) -> None:
# Check if the provided .iss file exists
if not os.path.isfile(iss_file_path):
print(f"Error: The provided .iss file '{iss_file_path}' not found.")
print(f"Error: The provided .iss file '{iss_path}' not found.")
return
# Run the Inno Setup compiler with the provided .iss file
try:
subprocess.run([inno_setup_compiler_path, iss_file_path], check=True)
except subprocess.CalledProcessError as e:
except subprocess.CalledProcessError as err:
print(
f"Error: Inno Setup compiler returned an error (exit code {e.returncode}):"
f"Error: Inno Setup compiler returned an error (exit code {err.returncode}):"
)
print(e.output.decode())
except Exception as e:
print(f"Error: An unexpected error occurred: {e}")
print(err.output.decode())
except Exception as err:
print(f"Error: An unexpected error occurred: {err}")
if __name__ == "__main__":
build()
# Replace 'your_iss_file.iss' with the path to your actual .iss file
iss_file_path: str = "./EDMC_Installer_Config.iss"
run_inno_setup_installer(iss_file_path)