This commit is contained in:
9700X_PC 2025-04-11 01:28:53 +09:00
parent 058b60868f
commit 8a7dd7733c
4 changed files with 181 additions and 22 deletions

View File

@ -31,28 +31,17 @@ Name: "korean"; MessagesFile: "compiler:Languages\Korean.isl"
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checked
[Dirs]
; 설치 시 {app}\logs 폴더를 생성하고,
; 설치 시 {app}\logs 폴더를 생성하고,
; Users 그룹에 'modify' 권한(=쓰기 가능)을 부여
Name: "{app}\logs"; Permissions: users-modify
[Files]
; cx_Freeze로 빌드된 결과물 모두를 설치 폴더로 복사
Source: "build\exe.win-amd64-3.11\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "dist\{#__exe_name__}.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "dist\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; VC++ 재배포 패키지 파일을 임시 폴더({tmp})에 복사
Source: "VC_redist.x64.exe"; DestDir: "{tmp}"; Flags: deleteafterinstall
[Icons]
; 시작 메뉴 바로가기
Name: "{group}\{#__program_name__}"; Filename: "{app}\{#__exe_name__}.exe"
; 바탕화면 바로가기
Name: "{autodesktop}\{#__program_name__}"; Filename: "{app}\{#__exe_name__}.exe"; Tasks: desktopicon
[Run]
; VC++ 재배포 패키지 설치 (필요할 경우)
Filename: "{tmp}\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
; 설치 후 프로그램 실행 (원할 경우 주석 해제)
; Filename: "{app}\AutoPercenty3.exe"; Description: "{cm:LaunchProgram,AutoPercenty3}"; Flags: nowait postinstall skipifsilent
[Code]
function NeedsVCredist: Boolean;
begin
// 예: 레지스트리 키 확인으로 VC++ 2015~2022 x64 런타임이 깔려있는지 판단
@ -62,3 +51,13 @@ begin
else
Result := True; // 미설치 -> 설치 필요
end;
[Icons]
Name: "{group}\{#__program_name__}"; Filename: "{app}\{#__exe_name__}.exe"
Name: "{autodesktop}\{#__program_name__}"; Filename: "{app}\{#__exe_name__}.exe"; Tasks: desktopicon
[Run]
; VC++ 재배포 패키지 설치 (필요할 경우)
Filename: "{tmp}\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
; 설치 후 프로그램 실행 (원할 경우 주석 해제)
Filename: "{app}\{#__exe_name__}.exe"; Description: "{cm:LaunchProgram,{#StringChange(__program_name__, '&', '&&')}}"; Flags: nowait postinstall skipifsilent

133
generate_iss.py Normal file
View File

@ -0,0 +1,133 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
updateManager/__version__.py 파일에서 정보를 읽어 Inno Setup 스크립트 파일을 생성합니다.
"""
import os
import sys
import datetime
import importlib.util
from pathlib import Path
def load_version_module(version_file_path):
"""버전 정보 모듈을 동적으로 로드합니다."""
spec = importlib.util.spec_from_file_location("version_module", version_file_path)
version_module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(version_module)
return version_module
def generate_iss_file():
"""버전 정보를 읽어 .iss 파일을 생성합니다."""
# 현재 디렉토리 확인
current_dir = os.path.dirname(os.path.abspath(__file__))
# 버전 파일 경로
version_file = os.path.join(current_dir, 'updateManager', '__version__.py')
if not os.path.exists(version_file):
print(f"오류: 버전 파일을 찾을 수 없습니다: {version_file}")
sys.exit(1)
try:
# 버전 모듈 로드
version_module = load_version_module(version_file)
# 현재 날짜와 시간
now = datetime.datetime.now()
date_str = now.strftime("%Y%m%d_%H%M%S")
# 생성할 .iss 파일 이름
iss_filename = f"AutoPercenty_{date_str}.iss"
# 템플릿 작성
iss_template = f"""; AutoPercenty3 Inno Setup Script
; 스크립트는 cx_Freeze로 빌드된 결과물이 있는 "build\exe.win-amd64-3.11" 폴더를 기반으로 인스톨러를 제작합니다.
; {date_str} 생성됨
#define MyAppName "{version_module.__title__}"
#define MyAppVersion "{version_module.__version__}"
#define MyAppPublisher "{version_module.__company_name__}"
#define MyAppProgramName "{version_module.__program_name__}"
#define MyAppDescription "{version_module.__description__}"
#define MyAppCopyright "{version_module.__copyright__}"
#define MyAppExeName "{version_module.__exe_name__}"
#define MySetupName "{version_module.__setup_name__}"
#define MySetupIcon "{version_module.__icon_file__}"
#define MySetupOutputDir "{version_module.__setup_output_dir__}"
[Setup]
AppName={{#MyAppProgramName}}
AppVersion={{#MyAppVersion}}
AppPublisher={{#MyAppPublisher}}
AppPublisherURL=
; 기본 설치 경로: AppData\Local\AutoPercenty3
DefaultDirName={{localappdata}}\\{{#MyAppName}}
DefaultGroupName={{#MyAppProgramName}}
OutputDir={{#MySetupOutputDir}}
OutputBaseFilename={{#MySetupName}}
SetupIconFile={{#MySetupIcon}}
Compression=lzma
SolidCompression=yes
VersionInfoVersion={{#MyAppVersion}}
VersionInfoCompany={{#MyAppPublisher}}
VersionInfoDescription={{#MyAppDescription}}
VersionInfoCopyright={{#MyAppCopyright}}
VersionInfoProductName={{#MyAppProgramName}}
VersionInfoProductVersion={{#MyAppVersion}}
[Languages]
Name: "korean"; MessagesFile: "compiler:Languages\\Korean.isl"
[Tasks]
Name: "desktopicon"; Description: "{{cm:CreateDesktopIcon}}"; GroupDescription: "{{cm:AdditionalIcons}}"
[Dirs]
; 설치 {{app}}\\logs 폴더를 생성하고,
; Users 그룹에 'modify' 권한(=쓰기 가능) 부여
Name: "{{app}}\\logs"; Permissions: users-modify
[Files]
; cx_Freeze로 빌드된 결과물 모두를 설치 폴더로 복사
Source: "build\\exe.win-amd64-3.11\\*"; DestDir: "{{app}}"; Flags: ignoreversion recursesubdirs createallsubdirs
; VC++ 재배포 패키지 파일을 임시 폴더({{tmp}}) 복사
Source: "VC_redist.x64.exe"; DestDir: "{{tmp}}"; Flags: deleteafterinstall
[Icons]
; 시작 메뉴 바로가기
Name: "{{group}}\\{{#MyAppProgramName}}"; Filename: "{{app}}\\{{#MyAppExeName}}.exe"
; 바탕화면 바로가기
Name: "{{autodesktop}}\\{{#MyAppProgramName}}"; Filename: "{{app}}\\{{#MyAppExeName}}.exe"; Tasks: desktopicon
[Run]
; VC++ 재배포 패키지 설치 (필요할 경우)
Filename: "{{tmp}}\\VC_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "VC++ 재배포 패키지 설치 중..."; Check: NeedsVCredist
; 설치 프로그램 실행 (원할 경우 주석 해제)
Filename: "{{app}}\\{{#MyAppExeName}}.exe"; Description: "{{cm:LaunchProgram,{{#MyAppProgramName}}}}"; Flags: nowait postinstall skipifsilent
[Code]
function NeedsVCredist: Boolean;
begin
// : 레지스트리 확인으로 VC++ 2015~2022 x64 런타임이 깔려있는지 판단
// (VC++ 버전에 따라 /값이 달라질 있으므로, 실제 환경에 맞게 수정 필요)
if RegKeyExists(HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\VisualStudio\\14.0\\VC\\Runtimes\\x64') then
Result := False // 이미 설치됨
else
Result := True; // 미설치 -> 설치 필요
end;
"""
# .iss 파일 저장
with open(iss_filename, 'w', encoding='utf-8') as f:
f.write(iss_template)
print(f".iss 파일이 성공적으로 생성되었습니다: {iss_filename}")
return iss_filename
except Exception as e:
print(f"오류 발생: {e}")
sys.exit(1)
if __name__ == "__main__":
generate_iss_file()

View File

@ -9,6 +9,11 @@ from updateManager.__version__ import (
__author_email__, __license__, __install_requires__,
__exe_name__, __icon_file__, __main_script__
)
import subprocess
from setuptools.command.build_ext import build_ext
from setuptools.command.install import install
from cx_Freeze.command.build_exe import build_exe as _build_exe
import importlib.util
# 패들 코어 패치 적용
print("패들 코어 패치 검사 및 적용...")
@ -189,7 +194,26 @@ if len(sys.argv) > 1 and sys.argv[1] == 'build_exe':
'--add-data=resources;resources'
])
# Setup 설정
# build_exe 클래스를 확장하여 빌드 후 iss 파일 생성
class build_exe(_build_exe):
def run(self):
# 원래 빌드 프로세스 실행
_build_exe.run(self)
print("\n빌드가 완료되었습니다. 이제 Inno Setup 스크립트 생성을 시작합니다...\n")
try:
# generate_iss.py 스크립트 실행
result = subprocess.run([sys.executable, "generate_iss.py"], capture_output=True, text=True)
if result.returncode == 0:
print(result.stdout)
print("\nInno Setup 스크립트 생성이 완료되었습니다!")
else:
print(f"Inno Setup 스크립트 생성 중 오류 발생: {result.stderr}")
except Exception as e:
print(f"Inno Setup 스크립트 생성 중 예외 발생: {e}")
# Setup 설정 (cmdclass에 build_exe 추가)
setup(
name=__title__,
version=__version__,
@ -203,5 +227,8 @@ setup(
include_package_data=True,
zip_safe=False,
options={'build_exe': build_exe_options},
executables=executables
executables=executables,
cmdclass={
"build_exe": build_exe,
},
)

View File

@ -3,7 +3,7 @@
모든 버전 관련 정보와 메타데이터를 파일에서 관리합니다.
"""
# 프로그램 기본 정보
""" 프로그램 기본 정보 """
__title__ = "AutoPercenty"
__description__ = "편집알바생"
__version__ = "3.8.1"
@ -13,12 +13,12 @@ __author_email__ = "abc@gmail.com"
__license__ = "MIT"
__copyright__ = "Copyright 2024"
# 프로그램 추가 정보
""" 프로그램 추가 정보 """
__program_name__ = "오토퍼센티" # 표시용 한글 이름
__program_id__ = "autopercenty" # 시스템 내부 식별자
__company_name__ = "WhenRideMyCar"
# 설치 관련 정보
""" 설치 관련 정보 """
__install_requires__ = [
"PySide6>=6.5.0",
"supabase>=1.0.3",
@ -27,12 +27,12 @@ __install_requires__ = [
"packaging>=23.1"
]
# 실행 파일 정보 (Windows)
""" 실행 파일 정보 (Windows) """
__exe_name__ = "AutoPercenty"
__icon_file__ = "AutoPercenty3.ico"
__main_script__ = "main.py"
# InnoSetup 설치 프로그램 정보
""" InnoSetup 설치 프로그램 정보 """
__setup_name__ = "AutoPercenty Setup"
__publisher__ = __company_name__
__setup_icon__ = __icon_file__