Skip to content

Commit 277ed2c

Browse files
author
Derek Hower
committed
Create JSON index with resolved arch
1 parent b794472 commit 277ed2c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/yaml_resolver.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ def write_yaml(file_path: str | Path, data):
167167
yaml.dump(data, file)
168168

169169

170+
def write_json(file_path: str | Path, data):
171+
"""Write data as JSON to file_path
172+
173+
Parameters
174+
----------
175+
file_path : str, Path
176+
Filesystem path to the JSON file
177+
data : dict, list
178+
The object to write as JSON
179+
"""
180+
with open(file_path, "w") as file:
181+
json.dump(data, file)
182+
183+
170184
def dig(obj: dict, *keys):
171185
"""Digs data out of dictionary obj
172186
@@ -611,5 +625,6 @@ def resolve_file(
611625

612626
# create index
613627
write_yaml(f"{abs_resolved_dir}/index.yaml", arch_paths)
628+
write_json(f"{abs_resolved_dir}/index.json", arch_paths)
614629

615630
print(f"[INFO] Resolved architecture files written to {args.resolved_dir}")

0 commit comments

Comments
 (0)