40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
def build():
|
|
# PyInstaller 명령어 옵션
|
|
command = [
|
|
"pyinstaller",
|
|
"--onefile", # 단일 실행 파일 생성
|
|
"--windowed", # 콘솔 창 없이 GUI 모드로 실행
|
|
"--icon=icon.ico", # 아이콘 포함 (icon.ico 파일이 존재해야 함)
|
|
"--add-data", "src/browsers;browsers", # src/browsers 폴더를 실행파일 내의 browsers 폴더로 포함 (Windows: 세미콜론, Mac/Linux: 콜론)
|
|
"--hidden-import=playwright", # 자동 탐지되지 않는 의존성 포함
|
|
"--hidden-import=PySide6",
|
|
"--clean", # 이전 빌드 캐시 삭제
|
|
"--noconfirm", # 기존 빌드 덮어쓰기 확인 없이 진행
|
|
"main.py" # 진입점 스크립트
|
|
]
|
|
|
|
|
|
# 작업 디렉토리를 스크립트 파일이 있는 폴더로 변경 (선택사항)
|
|
os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
print("PyInstaller 빌드를 시작합니다...")
|
|
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
|
|
print("===== stdout =====")
|
|
print(result.stdout)
|
|
print("===== stderr =====")
|
|
print(result.stderr)
|
|
|
|
if result.returncode != 0:
|
|
print("빌드 중 오류가 발생했습니다.")
|
|
sys.exit(result.returncode)
|
|
else:
|
|
print("빌드가 성공적으로 완료되었습니다.")
|
|
|
|
if __name__ == "__main__":
|
|
build()
|