Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flow/scripts/defaults.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env python3

import json
import os
import yaml

dir_path = os.path.dirname(os.path.realpath(__file__))

yaml_path = os.path.join(dir_path, "variables.yaml")
with open(yaml_path, "r") as file:
data = yaml.safe_load(file)
json_path = os.path.join(dir_path, "variables.json")
with open(json_path, "r") as file:
data = json.load(file)

for key, value in data.items():
if value.get("default", None) is None:
Expand Down
8 changes: 8 additions & 0 deletions flow/scripts/generate-variables-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
# This script injects an autogenerated section in FlowVariables.md with
# information about the variables from variables.yaml.
# It also outputs variables.json so other scripts can use the built-in json
# module instead of depending on the external yaml module.
import json
import os
import yaml

Expand All @@ -14,6 +17,11 @@
with open(yaml_path, "r") as file:
data = yaml.safe_load(file)

json_path = os.path.join(dir_path, "variables.json")
with open(json_path, "w") as file:
json.dump(data, file, indent=2)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maliberty Wr already check that docs are regenerated and this script also updates .json file

file.write("\n")

preferred_order = ["synth", "floorplan", "place", "cts", "grt", "route", "final"]
stages = {stage for value in data.values() for stage in value.get("stages", [])}
# convert set of stages to stages in a list in the preferred order, but
Expand Down
10 changes: 5 additions & 5 deletions flow/scripts/non_stage_variables.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#!/usr/bin/env python3
#
# Reading .yaml from tcl is tedious and we already have
# a yaml library in Python.
# a json library in Python.
#
# This script generates a list of variables known
# not to be in the current stage.
import json
import os
import sys
import yaml

dir_path = os.path.dirname(os.path.realpath(__file__))

yaml_path = os.path.join(dir_path, "variables.yaml")
with open(yaml_path, "r") as file:
data = yaml.safe_load(file)
json_path = os.path.join(dir_path, "variables.json")
with open(json_path, "r") as file:
data = json.load(file)

for key, value in data.items():
if "stages" not in value:
Expand Down
Loading