Unverified Commit 99c44e93 authored by hyrulelinks's avatar hyrulelinks Committed by GitHub
Browse files

Create launch.spec for building macOS standalone app via pyinstaller

parent 62f1d3e1
Loading
Loading
Loading
Loading

launch.spec

0 → 100644
+199 −0
Original line number Diff line number Diff line
# 导入模块
import os
import sys
from PyInstaller.utils.hooks import collect_data_files
import subprocess

# 获取提交哈希值
commit_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('utf-8').strip()  

# 构造带提交哈希值的版本号
version = "1.3.35.dev." + commit_hash

block_cipher = None


a = Analysis([
    'launch.py',
    'modules/base.py',
    'modules/inpaint/aot.py',
    'modules/inpaint/ffc.py',
    'modules/inpaint/lama.py',
    'modules/inpaint/patch_match.py',
    'modules/ocr/macos_ocr.py',
    'modules/ocr/manga_ocr.py',
    'modules/ocr/mit48px_ctc.py',
    'modules/ocr/model_32px.py',
    'modules/ocr/windows_ocr.py',
    'modules/textdetector/db_utils.py',
    'modules/textdetector/textblock.py',
    'modules/textdetector/ctd/basemodel.py',
    'modules/textdetector/ctd/inference.py',
    'modules/textdetector/ctd/textmask.py',
    'modules/textdetector/yolov5/common.py',
    'modules/textdetector/yolov5/yolo.py',
    'modules/textdetector/yolov5/yolov5_utils.py',
    'modules/translators/base.py',
    'modules/translators/constants.py',
    'modules/translators/exceptions.py',
    'modules/translators/hooks.py',
    'modules/translators/trans_baidu.py',
    'modules/translators/trans_caiyun.py',
    'modules/translators/trans_chatgpt.py',
    'modules/translators/trans_deepl.py',
    'modules/translators/trans_deeplx.py',
    'modules/translators/trans_google.py',
    'modules/translators/trans_papago.py',
    'modules/translators/trans_sugoi.py',
    'modules/translators/trans_yandex.py',
    'scripts/svgscript.py',
    'scripts/update_translation.py',
    'ui/canvas.py',
    'ui/combobox.py',
    'ui/config.py',
    'ui/configpanel.py',
    'ui/constants.py',
    'ui/cursor.py',
    'ui/dlconfig_parse_widgets.py',
    'ui/drawing_commands.py',
    'ui/drawingpanel.py',
    'ui/fontformat_commands.py',
    'ui/fontformatpanel.py',
    'ui/funcmaps.py',
    'ui/global_search_widget.py',
    'ui/image_edit.py',
    'ui/imgtrans_proj.py',
    'ui/io_thread.py',
    'ui/keywordsubwidget.py',
    'ui/mainwindow.py',
    'ui/mainwindowbars.py',
    'ui/misc.py',
    'ui/module_manager.py',
    'ui/page_search_widget.py',
    'ui/preset_widget.py',
    'ui/scene_textlayout.py',
    'ui/scenetext_manager.py',
    'ui/shared_widget.py',
    'ui/stylewidgets.py',
    'ui/text_graphical_effect.py',
    'ui/textedit_area.py',
    'ui/textedit_commands.py',
    'ui/texteditshapecontrol.py',
    'ui/textitem.py',
    'ui/framelesswindow/fw_qt6/mac/window_effect.py',
    'ui/framelesswindow/fw_qt6/utils/linux_utils.py',
    'ui/framelesswindow/fw_qt6/utils/mac_utils.py',
    'ui/framelesswindow/fw_qt6/utils/win32_utils.py',
    'utils/appinfo.py',
    'utils/imgproc_utils.py',
    'utils/io_utils.py',
    'utils/logger.py',
    'utils/registry.py',
    'utils/stroke_width_calculator.py',
    'utils/structures.py',
    'utils/text_layout.py',
    'utils/text_processing.py',
    'utils/textblock_mask.py',],
    pathex=[],
    binaries=[],
    datas=[
        ('config', './config'),
        ('data', './data'),
        ('doc', './doc'),
        ('icons', './icons'),
        ('modules', './modules'),
        ('scripts', './scripts'),
        ('translate', './translate'),
        ('ui', './ui'),
        ('utils', './utils'),
        ('venv/lib/python3.11/site-packages/spacy_pkuseg', './spacy_pkuseg'),
        ('venv/lib/python3.11/site-packages/torchvision', './torchvision'),
        ],
    hiddenimports=[
        'PyQt6',
        'numpy',
        'urllib3',
        'jaconv',
        'torch',
        'torchvision',
        'transformers',
        'fugashi',
        'unidic_lite',
        'tqdm',
        'shapely',
        'pyclipper',
        'einops',
        'termcolor',
        'bs4',
        'deepl',
        'qtpy',
        'sentencepiece',
        'ctranslate2',
        'docx2txt',
        'piexif',
        'keyboard',
        'requests',
        'colorama',
        'openai',
        'httpx',
        'langdetect',
        'srsly',
        ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='launch',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)
coll = COLLECT(
    exe,
    a.binaries,
    a.zipfiles,
    a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='launch',
)
app = BUNDLE(
    coll,
    name='BallonsTranslator.app',
    icon='icons/icon.icns',
    bundle_identifier=None,
    info_plist={
        'CFBundleDisplayName': 'BallonsTranslator',
        'CFBundleName': 'BallonsTranslator',
        'CFBundlePackageType': 'APPL',
        'CFBundleSignature': 'BATR',
        'CFBundleShortVersionString': version,
        'CFBundleVersion': version,
        'CFBundleExecutable': 'launch',
        'CFBundleIconFile': 'icon.icns',
        'CFBundleIdentifier': 'dev.dmmaze.batr',
        'CFBundleInfoDictionaryVersion': '6.0',
        'LSApplicationCategoryType': 'public.app-category.graphics-design',
        'LSEnvironment': {'LANG': 'zh_CN.UTF-8'},
      }
)