This commit is contained in:
xunbu
2025-12-15 17:26:28 +08:00
parent 97062f33f1
commit 3f509542c3
3 changed files with 14 additions and 3260 deletions

View File

@@ -1,16 +1,18 @@
# -*- mode: python ; coding: utf-8 -*- # -*- mode: python ; coding: utf-8 -*-
import os import os
from PyInstaller.utils.hooks import collect_all from PyInstaller.utils.hooks import collect_all, copy_metadata
import docutranslate import docutranslate
# 初始化列表 # 初始化列表
datas = [] datas = []
binaries = [] binaries = []
hiddenimports = ['markdown.extensions.tables', 'pymdownx.arithmatex', hiddenimports = ['markdown.extensions.tables', 'pymdownx.arithmatex',
'pymdownx.superfences', 'pymdownx.highlight', 'pygments'] 'pymdownx.superfences', 'pymdownx.highlight', 'pygments',
'docling_ibm_models',
'docling_parse','cv2']
# 先收集第三方包的资源 # 先收集第三方包的资源
for package in ['easyocr', 'docling', 'pygments']: for package in ['easyocr', 'docling', 'pygments', 'docling_ibm_models']:
try: try:
tmp_ret = collect_all(package) tmp_ret = collect_all(package)
datas += tmp_ret[0] datas += tmp_ret[0]
@@ -19,6 +21,12 @@ for package in ['easyocr', 'docling', 'pygments']:
except Exception as e: except Exception as e:
print(f"Warning: Failed to collect resources for {package}: {e}") print(f"Warning: Failed to collect resources for {package}: {e}")
try:
datas += copy_metadata('docling-ibm-models') # 这里必须用连字符(pip名)
datas += copy_metadata('docling-parse') # 预防性添加
except Exception as e:
print(f"Warning: Failed to copy metadata: {e}")
# 然后添加您的自定义资源(避免重复) # 然后添加您的自定义资源(避免重复)
custom_datas = [ custom_datas = [
('./.venv/Lib/site-packages/docling_parse/pdf_resources_v2', 'docling_parse/pdf_resources_v2'), ('./.venv/Lib/site-packages/docling_parse/pdf_resources_v2', 'docling_parse/pdf_resources_v2'),

View File

@@ -20,14 +20,15 @@ dependencies = [
"pysubs2>=1.8.0", "pysubs2>=1.8.0",
"httpx>=0.28.1", "httpx>=0.28.1",
"python-pptx>=1.0.2", "python-pptx>=1.0.2",
] ]
dynamic = ["version"] dynamic = ["version"]
[project.optional-dependencies] [project.optional-dependencies]
docling = ["opencv-python>=4.11.0.86", "docling>=2.40.0", "hf-xet>=1.1.10"] docling = ["opencv-python>=4.12.0.88", "docling>=2.40.0", "hf-xet>=1.1.10"]
[dependency-groups] [dependency-groups]
dev = ["opencv-python>=4.11.0.86", "docling>=2.40.0", "hf-xet>=1.1.10"] dev = ["opencv-python>=4.12.0.88","docling>=2.40.0", "hf-xet>=1.1.10"]
[project.scripts] [project.scripts]
docutranslate = "docutranslate.cli:main" docutranslate = "docutranslate.cli:main"

3255
uv.lock generated

File diff suppressed because it is too large Load Diff