fix: 更新后同步版本号到base_config.yaml
This commit is contained in:
@@ -231,6 +231,25 @@ class UpdateService:
|
|||||||
|
|
||||||
self.status["progress"] = 80
|
self.status["progress"] = 80
|
||||||
|
|
||||||
|
# 4.5 同步版本号到旧配置文件
|
||||||
|
try:
|
||||||
|
old_cfg_path = str(_PROJECT_ROOT / "config" / "framework" / "base_config.yaml")
|
||||||
|
new_tpl_path = str(_PROJECT_ROOT / "config" / "framework" / "base_config.yaml.example")
|
||||||
|
if os.path.exists(old_cfg_path) and os.path.exists(new_tpl_path):
|
||||||
|
import yaml as _yaml
|
||||||
|
with open(new_tpl_path) as f:
|
||||||
|
new_tpl = _yaml.safe_load(f)
|
||||||
|
new_ver = new_tpl.get("framework", {}).get("version", "")
|
||||||
|
if new_ver:
|
||||||
|
with open(old_cfg_path) as f:
|
||||||
|
old_cfg = _yaml.safe_load(f) or {}
|
||||||
|
old_cfg.setdefault("framework", {})["version"] = new_ver
|
||||||
|
with open(old_cfg_path, "w") as f:
|
||||||
|
_yaml.dump(old_cfg, f, default_flow_style=False, allow_unicode=True)
|
||||||
|
logger.info(f"📝 版本号已同步: {new_ver}")
|
||||||
|
except Exception as e:
|
||||||
|
logger.warning(f"版本号同步失败: {e}")
|
||||||
|
|
||||||
# 5. 安装依赖 (子进程)
|
# 5. 安装依赖 (子进程)
|
||||||
req_file = str(_PROJECT_ROOT / "requirements.txt")
|
req_file = str(_PROJECT_ROOT / "requirements.txt")
|
||||||
if os.path.exists(req_file):
|
if os.path.exists(req_file):
|
||||||
|
|||||||
Reference in New Issue
Block a user