rpm-ostree/scripts/rpmostree-group2json.py

21 lines
471 B
Python
Raw Normal View History

#! /usr/bin/python -tt
import os
import sys
out = """\
"check-groups": { "type": "data",\n\
"entries": { """
prefix_len = len(' "entries": { ')
done = False
for fname in sys.argv[1:]:
for line in open(fname):
(group,x,gid,x) = line.split(':', 3)
if done:
out += ',\n'
out += ' ' * prefix_len
done = True
out += '"%s": %s' % (group, gid)
out += ' } },'
print out