diff --git a/common/config.py b/common/config.py new file mode 100644 index 0000000000000000000000000000000000000000..ff6dc66cfdb4ffe8b5734b07485b3b216aae76ee --- /dev/null +++ b/common/config.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- +# cython:language_level=3 + +import io +import json5 +import os +import sys +import time + +# Initialize classes, load working directory and output directory, etc. +class Config: + @staticmethod + def init_config(opath, wpath , ipath ): + ''' + Initialize working directory information, must be called + ''' + Config.set_work_path(wpath) + Config.set_inst_path(ipath) + Config.set_out_path(opath) + + try: + with io.open(Config.conf_fn, 'r', encoding='utf-8') as file: + Config.dict_json = json5.load(file) + except Exception as err: + print("程序初始化失败: 配置文件内容设置异常 {},请修改后重新启动程序。".format(err)) + sys.exit() + + if not os.path.exists('{}/output-{}/'.format(Config.out_path, Config.dt)): + os.makedirs('{}/output-{}/'.format(Config.out_path, Config.dt)) + + if not os.path.exists(Config.out_path + '/log/'): + os.makedirs(Config.out_path + '/log/') + + # if not os.path.exists(Config.out_path+'/temp/'): + # os.makedirs(Config.out_path + '/temp/') + + \ No newline at end of file diff --git a/summary_info.py b/summary_info.py new file mode 100644 index 0000000000000000000000000000000000000000..d64395effd3065ec98f6628a165bb9f8b2d59058 --- /dev/null +++ b/summary_info.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- +# cython:language_level=3 + + +from common.config import Config + + +# Access to information for external use +class SummaryInfo: + @staticmethod + def init(out_path , work_path , inst_path ): + ''' + initialization, must be called first + ''' + Config.init_config(out_path, work_path, inst_path) + # Specify debug mode + # Logger().on_debug_type()