modify: 日志重复问题
This commit is contained in:
@@ -3,6 +3,12 @@ import os
|
||||
from module_bank import PythonToSQLite
|
||||
from typing import Callable
|
||||
|
||||
# module_bank 依赖在每次加载 PyArmor 加密模块时都会 print 一行
|
||||
# "已部署 PyArmor 运行时",启动期会刷屏(约 50 行)。依赖包不便改动,
|
||||
# 这里用模块级 print 遮蔽(模块内名字解析 globals 优先于 builtins)静默掉。
|
||||
import module_bank.sqlite_module_loader as _sqlite_module_loader
|
||||
|
||||
_sqlite_module_loader.print = lambda *args, **kwargs: None
|
||||
|
||||
|
||||
def init_module_bank(config):
|
||||
@@ -10,7 +16,7 @@ def init_module_bank(config):
|
||||
初始化模块银行系统,将指定路径下的Python模块打包并安装导入器。
|
||||
|
||||
该函数会验证所有模块路径的有效性,创建PythonToSQLite打包器实例,
|
||||
列出所有可用模块,并为每个打包器安装导入器以支持模块的动态加载。
|
||||
并为每个打包器安装导入器以支持模块的动态加载。
|
||||
|
||||
Args:
|
||||
config (dict): 配置字典,必须包含 'production' -> 'module_system' -> 'path' 键,
|
||||
@@ -28,12 +34,9 @@ def init_module_bank(config):
|
||||
packer_list = [
|
||||
PythonToSQLite(module_path) for module_path in MODULE_BANK_PATH_LIST
|
||||
]
|
||||
# 遍历所有打包器,列出模块信息并安装导入器
|
||||
# 遍历所有打包器,安装导入器(模块清单不再打印,避免启动刷屏)
|
||||
for packer in packer_list:
|
||||
key = packer.get_key()
|
||||
modules = packer.list_modules()
|
||||
for module in modules:
|
||||
print(f"{module['module_name']} {'[包]' if module['is_package'] else ''}")
|
||||
packer.install_importer(key=key)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user