-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathgui.spec
More file actions
121 lines (107 loc) · 2.81 KB
/
gui.spec
File metadata and controls
121 lines (107 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- mode: python ; coding: utf-8 -*-
import os
from pathlib import Path
from PyInstaller.utils.hooks import collect_data_files, collect_dynamic_libs, copy_metadata
project_root = Path(globals().get("__file__", os.path.abspath("gui.spec"))).resolve().parent
model_variant = os.environ.get("MINERU_OCR_MODEL_VARIANT", "default").lower()
datas = []
# PaddleOCR 3.x depends on PaddleX pipeline configs (for pipeline="OCR")
# and internal OCR resources at runtime. Bundle these data files explicitly
# to avoid runtime initialization failures in packaged builds.
try:
datas += collect_data_files(
"paddlex",
includes=[
"configs/**/*.yaml",
"configs/**/*.yml",
"configs/**/*.json",
"**/.version",
"**/*.ttf",
],
)
except Exception:
pass
try:
datas += collect_data_files(
"paddleocr",
includes=["**/*.yaml", "**/*.yml", "**/*.json", "**/*.txt"],
)
except Exception:
pass
# PaddleX checks optional extras via package metadata at runtime
# (importlib.metadata). In onefile mode this metadata is not always
# automatically collected, which can trigger false DependencyError.
try:
datas += copy_metadata("paddlex", recursive=True)
except Exception:
pass
try:
datas += copy_metadata("paddleocr", recursive=True)
except Exception:
pass
# PaddleX checks extras at runtime via importlib.metadata and then checks
# dependency package metadata/version. Explicitly include metadata for the
# OCR-core dependency chain to avoid false negatives in onefile mode.
for pkg in [
"imagesize",
"opencv-contrib-python",
"pyclipper",
"pypdfium2",
"python-bidi",
"Shapely",
]:
try:
datas += copy_metadata(pkg, recursive=True)
except Exception:
pass
binaries = []
# Paddle runtime shared libraries are required in frozen apps.
# onefile extraction may miss these unless they are explicitly collected.
try:
binaries += collect_dynamic_libs("paddle")
except Exception:
pass
a = Analysis(
['gui.py'],
pathex=[],
binaries=binaries,
datas=datas,
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='MinerU2PPT',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=str(project_root / "img" / "logo.png"),
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='MinerU2PPT',
)