AutoPercenty3/setup.py

92 lines
3.2 KiB
Python

# setup.py
import sys, os
from cx_Freeze import setup, Executable
import shutil
from distutils.sysconfig import get_python_lib
# 이전 빌드 폴더 삭제
folders_to_remove = ['build', 'dist']
for folder in folders_to_remove:
if os.path.exists(folder):
shutil.rmtree(folder)
print(f"Deleted folder: {folder}")
os.environ['PATH'] += os.pathsep + r"C:\Windows\System32"
# 필요한 파일 경로 설정
base_dir = os.path.dirname(__file__)
browsers_dir = os.path.join(base_dir, 'browsers')
chromium_dir = os.path.join(browsers_dir, 'chromium-1112')
whale_dir = os.path.join(browsers_dir, 'whale')
extensions_dir = os.path.join(browsers_dir, 'extensions')
user_data_dir = os.path.join(browsers_dir, 'user_data')
include_files = [
os.path.abspath('config.ini'),
os.path.abspath('leensoo1nt.json'),
os.path.abspath('prompt.json'),
os.path.abspath('userDB.db'),
(os.path.abspath('src/initialDB.db'), 'src/initialDB.db'),
(os.path.abspath('src/Percenty_SS_Code.json'), 'src/Percenty_SS_Code.json'),
(os.path.abspath(chromium_dir), 'browsers/chromium-1112'),
(os.path.abspath(whale_dir), 'browsers/whale'),
(os.path.abspath(extensions_dir), 'browsers/extensions'),
(os.path.abspath(user_data_dir), 'browsers/user_data'),
]
for file in include_files:
if isinstance(file, tuple):
file = file[0]
print(f"{file}: {'존재함' if os.path.exists(file) else '존재하지 않음'}")
# pywin32_system32 경로 추가
site_packages_path = get_python_lib()
pywin32_path = os.path.join(site_packages_path, 'pywin32_system32')
if os.path.exists(pywin32_path):
include_files.append((pywin32_path, 'pywin32_system32'))
# 사용된 패키지 정의
build_exe_options = {
'packages': [
'ctypes', 'asyncio', 'os', 're', 'time', 'math', 'json', 'logging', 'shutil', 'random', 'base64',
'subprocess', 'configparser', 'pyperclip', 'numpy', 'cv2', 'requests', 'win32clipboard', 'win32gui',
'win32con', 'win32process', 'PIL', 'bs4', 'pyautogui', 'pyvda', 'sqlalchemy', 'sqlalchemy.orm',
'sqlalchemy.exc', 'collections', 'pandas'
],
'includes': [
'PySide6.QtWidgets', 'PySide6.QtCore', 'PySide6.QtGui',
'whale_new', 'gui', 'logger_module_pyside6', 'toggleSwitch',
'browser_control', 'clipboardImageManager', 'vertexAI', 'option',
'price', 'title', 'thumb', 'locatorManager', 'src.cmb_diag', 'src.DatabaseManager',
'vertexai.generative_models', 'src.cmb_diag', 'src.DatabaseManager', 'locatorManager', 'toggleSwitch',
'win32clipboard', 'win32con', 'win32gui'
],
'include_files': include_files,
'excludes': [
'tkinter', 'PyQt4', 'PyQt5', 'PyQt6', 'AppKit', 'Foundation', 'IPython', 'OpenSSL', 'asyncpg',
'curses', 'pydantic', 'test', 'unittest', 'matplotlib', 'tensorflow', 'torch', 'scipy'
],
'silent': False # 디버그 메시지 활성화
}
# 애플리케이션 메인 파일 및 설정
base = None
if sys.platform == 'win32':
base = 'Win32GUI'
executables = [
Executable('main.py', base=base, target_name='AutoPercenty3.exe')
]
# Setup 설정
setup(
name='AutoPercenty3',
version='3.1',
description='자동화도구',
options={'build_exe': build_exe_options},
executables=executables
)