fix: 多项稳定性修复与打包优化
- PyInstaller: runtime hook 预加载 osgeo DLL 避免 Qt5 符号冲突; spec 纳入 osgeo .py 文件 + 运行时 DLL 依赖 (ffi/lzma/bz2/expat/sqlite3); 移除 DLL 双副本防止 segfault - GDAL 环境: 新增 _MEIPASS/osgeo/data/gdal 路径搜索,改善打包后 GDAL_DATA 检测 - 预览生成器: 掩膜与底图同分辨率时跳过 Warp 加速读取 - 专题图: ConvexHull 坐标中心化修复 UTM 大坐标精度退化; 边界采样兜底防止外扩点为空; TIFF 已含 NaN 掩膜时跳过矢量擦除; 形态学闭运算填充掩膜小孔洞 - NDWI: int16→float32 防止减法溢出 - 面板注册表: 步骤模块分组重构 (模块一/二/三/四重划分)
This commit is contained in:
@ -17,9 +17,24 @@ def _safe_add(path: str) -> None:
|
||||
pass
|
||||
|
||||
|
||||
# PyInstaller onefile 解包目录
|
||||
# PyInstaller onedir 解包目录
|
||||
base = getattr(sys, "_MEIPASS", None)
|
||||
if base:
|
||||
_safe_add(base)
|
||||
_safe_add(os.path.join(base, "lib-dynload"))
|
||||
_safe_add(os.path.join(base, "DLLs"))
|
||||
_safe_add(os.path.join(base, "DLLs"))
|
||||
# osgeo 子目录包含 gdal.dll / geos.dll / proj_9.dll 等 GIS 核心库
|
||||
osgeo_dir = os.path.join(base, "osgeo")
|
||||
_safe_add(osgeo_dir)
|
||||
|
||||
# ★ 关键:在 PyQt5 之前预加载 osgeo 的所有 DLL
|
||||
# 避免 Qt5 DLL 加载后 osgeo DLL 加载时发生符号冲突
|
||||
if os.path.isdir(osgeo_dir):
|
||||
import ctypes as _ct
|
||||
for _f in os.listdir(osgeo_dir):
|
||||
if _f.lower().endswith('.dll'):
|
||||
_dll_path = os.path.join(osgeo_dir, _f)
|
||||
try:
|
||||
_ct.CDLL(_dll_path)
|
||||
except Exception:
|
||||
pass
|
||||
Reference in New Issue
Block a user