geary/build-aux/yaml_to_json.py
Michael Gratton f7f72143e0 Add a compatibility JSON-based flatpak manifest
GNOME Builder doesn't support YAML manifests, so generate one and
commit it.

Revert this once GNOME/gnome-builder#520 is fixed and deployed.
2019-10-25 11:48:09 +11:00

25 lines
661 B
Python
Executable file

#!/usr/bin/env python3
import json
import os
import sys
import yaml
def main(input_path, source_path, output_path):
with open(input_path) as input:
obj = yaml.safe_load(input)
comment = '/* Automatically generated from {}, do not modify. */'.format(
os.path.basename(input_path)
)
source_output_path = os.path.join(
source_path, os.path.basename(output_path)
)
for path in [output_path, source_output_path]:
with open(path, 'w') as output:
print(comment, file=output)
json.dump(obj, output, indent=4)
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2], sys.argv[3])