diff options
| author | Christian Krinitsin <mail@krinitsin.com> | 2025-05-16 12:54:33 +0200 |
|---|---|---|
| committer | Christian Krinitsin <mail@krinitsin.com> | 2025-05-16 12:54:33 +0200 |
| commit | 53d4922d51b6b40ed85367ec611773abe47421e5 (patch) | |
| tree | d4ab5fa3a3ca24d3ccb33e30a92c80c463ef0378 /output.py | |
| parent | b2eaaabfd0fe50d3fab0d00d753193edc572f3c4 (diff) | |
| download | qemu-analysis-53d4922d51b6b40ed85367ec611773abe47421e5.tar.gz qemu-analysis-53d4922d51b6b40ed85367ec611773abe47421e5.zip | |
add output to files
Diffstat (limited to 'output.py')
| -rwxr-xr-x | output.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/output.py b/output.py new file mode 100755 index 000000000..745081aef --- /dev/null +++ b/output.py @@ -0,0 +1,23 @@ +from tomlkit import dumps +from os import path, makedirs + +def find_label(labels, keyword): + match = next((s for s in labels if f"{keyword}:" in s), None) + if not match: + return f"{keyword}_missing" + return match.replace(": ", "_") + +def write_file(file_path, string): + makedirs(path.dirname(file_path), exist_ok=True) + with open(file_path, "w") as file: + file.write(string) + +def output_issue(issue): + labels = issue['labels'] + issue_id = issue['id'] + toml_string = dumps(issue) + + target_label = find_label(labels, "target") + host_label = find_label(labels, "host") + accel_label = find_label(labels, "accel") + write_file(f"issues/{target_label}/{host_label}/{accel_label}/{issue_id}.toml", toml_string) |