exe6
This commit is contained in:
1 parent
4d3f3cd6fd
commit
56d915aa6d
4 files changed
+54
No files matched your search
@@ -138,6 +138,11 @@ def build_exe():
|
|||||||
# 也添加到 download_batch_data/utils/ 目录(备用路径)
|
# 也添加到 download_batch_data/utils/ 目录(备用路径)
|
||||||
cmd.append(f'--add-data={small_transform_file}{path_sep}download_batch_data/utils')
|
cmd.append(f'--add-data={small_transform_file}{path_sep}download_batch_data/utils')
|
||||||
|
|
||||||
|
# 添加 hook 文件路径(如果存在)
|
||||||
|
hook_path = current_dir
|
||||||
|
if os.path.exists(os.path.join(current_dir, 'hook-auto_sliceing_operate.py')):
|
||||||
|
cmd.append(f'--additional-hooks-dir={hook_path}')
|
||||||
|
|
||||||
# 添加工作目录设置和主脚本
|
# 添加工作目录设置和主脚本
|
||||||
cmd.extend([
|
cmd.extend([
|
||||||
f'--workpath={os.path.join(current_dir, "build")}',
|
f'--workpath={os.path.join(current_dir, "build")}',
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# PyInstaller hook for auto_sliceing_operate package
|
||||||
|
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
|
||||||
|
|
||||||
|
# 收集所有子模块
|
||||||
|
hiddenimports = collect_submodules('auto_sliceing_operate')
|
||||||
|
|
||||||
|
# 确保包含所有必要的模块
|
||||||
|
hiddenimports += [
|
||||||
|
'auto_sliceing_operate.main_begin_sliceing',
|
||||||
|
'auto_sliceing_operate.main_download_zip',
|
||||||
|
'auto_sliceing_operate.utils',
|
||||||
|
'auto_sliceing_operate.utils.exe_operate',
|
||||||
|
'auto_sliceing_operate.utils.click_soft_button',
|
||||||
|
'auto_sliceing_operate.utils.import_all_file',
|
||||||
|
'auto_sliceing_operate.utils.miniIo',
|
||||||
|
'auto_sliceing_operate.utils.oss_redis',
|
||||||
|
'auto_sliceing_operate.utils.request',
|
||||||
|
'auto_sliceing_operate.utils.logs',
|
||||||
|
]
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# PyInstaller hook for download_batch_data package
|
||||||
|
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
|
||||||
|
|
||||||
|
# 收集所有子模块
|
||||||
|
hiddenimports = collect_submodules('download_batch_data')
|
||||||
|
|
||||||
|
# 确保包含所有必要的模块
|
||||||
|
hiddenimports += [
|
||||||
|
'download_batch_data.main_download_batch_data_and_trans',
|
||||||
|
'download_batch_data.utils',
|
||||||
|
'download_batch_data.utils.funcs',
|
||||||
|
'download_batch_data.utils.small_machine_transform',
|
||||||
|
'download_batch_data.utils.oss_redis',
|
||||||
|
'download_batch_data.utils.oss_func',
|
||||||
|
'download_batch_data.utils.changeFiles',
|
||||||
|
'download_batch_data.utils.logs',
|
||||||
|
]
|
||||||
|
|
||||||
@@ -3,6 +3,17 @@ import os
|
|||||||
import importlib
|
import importlib
|
||||||
from utils.config import cfg, get_work_dir
|
from utils.config import cfg, get_work_dir
|
||||||
|
|
||||||
|
# 在模块级别显式导入,确保 PyInstaller 能检测到并打包这些模块
|
||||||
|
# 使用 try-except 避免在运行时出错(虽然这些导入应该总是成功的)
|
||||||
|
try:
|
||||||
|
# 这些导入语句会被 PyInstaller 分析,确保模块被包含
|
||||||
|
import auto_sliceing_operate.main_begin_sliceing as _unused1
|
||||||
|
import auto_sliceing_operate.main_download_zip as _unused2
|
||||||
|
import download_batch_data.main_download_batch_data_and_trans as _unused3
|
||||||
|
except ImportError:
|
||||||
|
# 如果导入失败(不应该发生),继续执行
|
||||||
|
pass
|
||||||
|
|
||||||
def get_command_handler(command):
|
def get_command_handler(command):
|
||||||
"""动态导入并返回命令处理函数"""
|
"""动态导入并返回命令处理函数"""
|
||||||
if command == 'batch_download':
|
if command == 'batch_download':
|
||||||
|
|||||||
Reference in new issue
Block a user