rpm-ostree/scripts/rpmostree-group2json.py
Jonathan Lebon 206ae24d4e tests: Bump to Python 3 only
This bumps the requirement on the controlling host to Python 3 only.
It also bumps the requirement on the target host to Python 3 as well
since FCOS doesn't ship Python 2 right now.

Though we'll need to eventually drop all Python usage anyway, but at
least let's get tests passing on FCOS first. (See related previous
patch).

Closes: #1828
Approved by: cgwalters
2019-05-08 19:02:32 +00:00

21 lines
468 B
Python
Executable File

#!/usr/bin/python3
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)