diff --git a/webui_zip.spec b/webui_zip.spec index e34e7196b..3568c36f7 100644 --- a/webui_zip.spec +++ b/webui_zip.spec @@ -1,8 +1,31 @@ # -*- mode: python ; coding: utf-8 -*- +from pathlib import Path + +import rapidocr_onnxruntime block_cipher = None +# 参考 https://github.com/RapidAI/RapidOCR/blob/main/ocrweb/rapidocr_web/ocrweb.spec +package_name = "rapidocr_onnxruntime" +install_dir = Path(rapidocr_onnxruntime.__file__).resolve().parent + +onnx_paths = list(install_dir.rglob("*.onnx")) +yaml_paths = list(install_dir.rglob("*.yaml")) + +onnx_add_data = [(str(v.parent), f"{package_name}/{v.parent.name}") for v in onnx_paths] + +yaml_add_data = [] +for v in yaml_paths: + if package_name == v.parent.name: + yaml_add_data.append((str(v.parent / "*.yaml"), package_name)) + else: + yaml_add_data.append( + (str(v.parent / "*.yaml"), f"{package_name}/{v.parent.name}") + ) + +add_data = list(set(yaml_add_data + onnx_add_data)) + mower_a = Analysis( ["webview_ui.py"], @@ -21,16 +44,12 @@ mower_a = Analysis( "venv/Lib/site-packages/onnxruntime/capi/onnxruntime_providers_shared.dll", "onnxruntime/capi/", ), - ("venv/Lib/site-packages/paddleocr", "paddleocr"), - ("venv/Lib/site-packages/paddle/libs/mklml.dll", "."), ("venv/Lib/site-packages/shapely/DLLs/geos.dll", "."), - ("venv/Lib/site-packages/paddle/fluid/proto/framework_pb2.py", "."), - ("venv/Lib/site-packages/paddle/fluid/libpaddle.lib", "."), - ("venv/Lib/site-packages/paddle/fluid/libpaddle.pyd", "."), ("venv/Lib/site-packages/shapely/DLLs/geos_c.dll", "."), ("logo.png", "."), ("dist", "dist"), - ], + ] + + add_data, hiddenimports=["imghdr", "imgaug", "scipy.io", "lmdb"], hookspath=[], hooksconfig={}, @@ -63,74 +82,11 @@ mower_exe = EXE( icon="logo.ico", ) -mower0_a = Analysis( - ["Mower0.py"], - pathex=[], - binaries=[], - datas=[ - ("arknights_mower/fonts", "arknights_mower/__init__/fonts"), - ("arknights_mower/models", "arknights_mower/__init__/models"), - ("arknights_mower/templates", "arknights_mower/__init__/templates"), - ("arknights_mower/resources", "arknights_mower/__init__/resources"), - ("arknights_mower/data", "arknights_mower/__init__/data"), - ("arknights_mower/ocr", "arknights_mower/__init__/ocr"), - ("arknights_mower/vendor", "arknights_mower/__init__/vendor"), - ("arknights_mower/solvers", "arknights_mower/__init__/solvers"), - ( - "venv/Lib/site-packages/onnxruntime/capi/onnxruntime_providers_shared.dll", - "onnxruntime/capi/", - ), - ("venv/Lib/site-packages/paddleocr", "paddleocr"), - ("venv/Lib/site-packages/paddle/libs/mklml.dll", "."), - ("venv/Lib/site-packages/shapely/DLLs/geos.dll", "."), - ("venv/Lib/site-packages/paddle/fluid/proto/framework_pb2.py", "."), - ("venv/Lib/site-packages/paddle/fluid/libpaddle.lib", "."), - ("venv/Lib/site-packages/paddle/fluid/libpaddle.pyd", "."), - ("venv/Lib/site-packages/shapely/DLLs/geos_c.dll", "."), - ("Mower0用户配置文件.yaml", "."), - ("logo.png", "."), - ], - hiddenimports=["imghdr", "imgaug", "scipy.io", "lmdb"], - hookspath=[], - hooksconfig={}, - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False, -) - -mower0_pyz = PYZ(mower0_a.pure, mower0_a.zipped_data, cipher=block_cipher) - -mower0_exe = EXE( - mower0_pyz, - mower0_a.scripts, - [], - exclude_binaries=True, - name="Mower0", - debug=False, - bootloader_ignore_signals=False, - strip=False, - upx=True, - console=True, - disable_windowed_traceback=False, - argv_emulation=False, - target_arch=None, - codesign_identity=None, - entitlements_file=None, - icon="logo.ico", -) - coll = COLLECT( mower_exe, mower_a.binaries, mower_a.zipfiles, mower_a.datas, - mower0_exe, - mower0_a.binaries, - mower0_a.zipfiles, - mower0_a.datas, strip=False, upx=True, upx_exclude=[],