Compare commits

..

3 Commits

2 changed files with 17 additions and 3 deletions

1
cube/.gitignore vendored Normal file

@ -0,0 +1 @@
output/*

@ -22,14 +22,26 @@ file_path = 'create_nicsensor.py'
absolute_path = os.path.abspath(file_path)
workspace_path = get_content_before_substring(absolute_path, "src")
model_path = "data\\"
board_feature_path = workspace_path + model_path + "BoardFeature.json"
hw_topo_path = workspace_path + model_path + "ServerHwTopo.json"
board_feature_path = os.path.join(workspace_path, "data", "BoardFeature.json")
hw_topo_path = os.path.join(workspace_path, "data", "ServerHwTopo.json")
output_path = os.path.join(workspace_path, "output", "nicsensor.sh")
dbg_print("info", "====== Pre Init ======")
dbg_print("info", f"workspace_path={workspace_path}")
dbg_print("info", f"board_feature_path={board_feature_path}")
dbg_print("info", f"hw_topo_path={hw_topo_path}")
dbg_print("info", f"output_path={output_path}")
def init_output_file():
dbg_print("info", "====== Init output file ======")
# if file exist , remove it
# create output file
try:
with open(output_path, 'w', encoding='utf-8') as file:
content = "#!/bin/sh"
file.write(content)
except Exception as e:
print(f"写入文件时出现错误: {e}")
def process_hw_topo():
dbg_print("info", "====== Process Server Hw Topo ======")
@ -100,4 +112,5 @@ def process_hw_topo():
# =====================================================
# Start execute script
# =====================================================
init_output_file()
process_hw_topo()