36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from db import load_data, load_config
|
|
from graph import Graph
|
|
|
|
import os
|
|
|
|
DATA_DIR="/data"
|
|
CONFIG_FILE="/config.yaml"
|
|
|
|
def main():
|
|
# Get all YAML files in the data directory
|
|
yaml_files = [f for f in os.listdir(DATA_DIR) if f.endswith(('.yaml', '.yml'))]
|
|
config = load_config(CONFIG_FILE)
|
|
puudot_config = config.get('puudot', {})
|
|
|
|
for yaml_file in yaml_files:
|
|
print(f"Processing {yaml_file}...")
|
|
data = load_data(os.path.join(DATA_DIR, yaml_file))
|
|
|
|
graph = Graph()
|
|
graph.set_config(config)
|
|
graph.process_blocks(data)
|
|
graph.build_dot()
|
|
# Use the base name of the YAML file (without extension) as the output name
|
|
base_name = os.path.splitext(yaml_file)[0]
|
|
dot_file = os.path.join(DATA_DIR, f"{base_name}.gv")
|
|
|
|
if puudot_config.get('verbose') == True:
|
|
print(f"Output formats: {puudot_config.get('output')}")
|
|
|
|
for format in puudot_config.get('output'):
|
|
out_file = os.path.join(DATA_DIR, f"{base_name}.{format}")
|
|
graph.make_dot(dot_file, out_file, format)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|