代码拉取完成,页面将自动刷新
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
from dataService import DataService
from executeService import ExecuteService
from toolService import ToolService
class ConfigService:
def __init__(self):
self.exe = ExecuteService()
self.tool = ToolService()
self.ROOT = os.getcwd()
self.meta_path = os.path.join(self.ROOT, DataService.meta_file)
def switch_config(self, config_file):
print(f"Switch config file to {config_file}")
config_path = os.path.join(self.ROOT, config_file)
if not os.path.isfile(config_path):
print("config_path not found, switch failed.")
return
contents = self.tool.read_file(config_file)
# keys should contains in config
keys = ["DOWNLOAD","DEPENDENCY","ENV","APP","BUILD","RUN"]
for key in keys:
if f"[{key}]" not in contents:
print(f"key [{key}] not found in {config_file}, switch failed.")
return
self.tool.write_file(self.meta_path, config_file.strip())
print("Successfully switched. config file saved in file .meta")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。