85 lines
2.0 KiB
RPMSpec
85 lines
2.0 KiB
RPMSpec
|
|
# -*- mode: python ; coding: utf-8 -*-
|
|||
|
|
"""PyInstaller spec for openmesh-server (one-dir bundle)."""
|
|||
|
|
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
from PyInstaller.utils.hooks import collect_all, collect_data_files, collect_submodules
|
|||
|
|
|
|||
|
|
ROOT = SPECPATH # spec 文件所在目录就是 packaging
|
|||
|
|
PROJECT_ROOT = os.path.dirname(ROOT) # 项目根目录(coworker 包所在处)
|
|||
|
|
|
|||
|
|
# 确保 collect_submodules 能找到 coworker 包
|
|||
|
|
sys.path.insert(0, PROJECT_ROOT)
|
|||
|
|
|
|||
|
|
IS_WINDOWS = sys.platform == "win32"
|
|||
|
|
|
|||
|
|
hiddenimports = [
|
|||
|
|
"coworker.file_upload",
|
|||
|
|
"coworker.providers.capabilities",
|
|||
|
|
]
|
|||
|
|
datas = []
|
|||
|
|
binaries = []
|
|||
|
|
|
|||
|
|
for pkg in ("coworker", "aisuite", "mcp", "ddgs", "croniter", "docstring_parser"):
|
|||
|
|
try:
|
|||
|
|
hiddenimports += collect_submodules(pkg)
|
|||
|
|
except Exception:
|
|||
|
|
pass
|
|||
|
|
|
|||
|
|
datas += collect_data_files("coworker")
|
|||
|
|
|
|||
|
|
for pkg in ("uvicorn", "certifi", "anyio", "websockets", "pypdf", "pypdfium2",
|
|||
|
|
"pdfplumber", "reportlab", "openpyxl", "pandas", "numpy",
|
|||
|
|
"playwright", "pytesseract", "markdownify", "beautifulsoup4",
|
|||
|
|
"lxml", "defusedxml", "Pillow", "pptx", "docx"):
|
|||
|
|
try:
|
|||
|
|
d, b, h = collect_all(pkg)
|
|||
|
|
datas += d
|
|||
|
|
binaries += b
|
|||
|
|
hiddenimports += h
|
|||
|
|
except Exception:
|
|||
|
|
pass
|
|||
|
|
|
|||
|
|
if IS_WINDOWS:
|
|||
|
|
try:
|
|||
|
|
d, b, h = collect_all("tzdata")
|
|||
|
|
datas += d
|
|||
|
|
binaries += b
|
|||
|
|
hiddenimports += h
|
|||
|
|
except Exception:
|
|||
|
|
pass
|
|||
|
|
|
|||
|
|
a = Analysis(
|
|||
|
|
[os.path.join(ROOT, "server_entry.py")],
|
|||
|
|
pathex=[ROOT, PROJECT_ROOT],
|
|||
|
|
binaries=binaries,
|
|||
|
|
datas=datas,
|
|||
|
|
hiddenimports=hiddenimports,
|
|||
|
|
hookspath=[],
|
|||
|
|
runtime_hooks=[],
|
|||
|
|
excludes=["tkinter", "matplotlib", "PyQt5", "PySide6"],
|
|||
|
|
noarchive=False,
|
|||
|
|
)
|
|||
|
|
pyz = PYZ(a.pure)
|
|||
|
|
exe = EXE(
|
|||
|
|
pyz,
|
|||
|
|
a.scripts,
|
|||
|
|
[],
|
|||
|
|
exclude_binaries=True,
|
|||
|
|
name="openmesh-server",
|
|||
|
|
debug=False,
|
|||
|
|
bootloader_ignore_signals=False,
|
|||
|
|
strip=False,
|
|||
|
|
upx=False,
|
|||
|
|
console=True,
|
|||
|
|
)
|
|||
|
|
coll = COLLECT(
|
|||
|
|
exe,
|
|||
|
|
a.binaries,
|
|||
|
|
a.datas,
|
|||
|
|
strip=False,
|
|||
|
|
upx=False,
|
|||
|
|
name="openmesh-server",
|
|||
|
|
)
|