1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00
libvirt/scripts/meson-gen-def.py
Pavel Hrdina cc409ac5ed meson: scripts: introduce meson-gen-def.py script
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
2020-08-03 09:27:04 +02:00

24 lines
512 B
Python
Executable File

#!/usr/bin/env python3
import re
import sys
if len(sys.argv) != 3:
print('invalid arguments')
print('usage: {0} INPUT OUTPUT'.format(sys.argv[0]))
sys.exit(1)
infilepath = sys.argv[1]
outfilepath = sys.argv[2]
with open(infilepath) as f:
text = f.read()
text = re.sub(r'^(|.*[#:}*].*|LIBVIRT_.*)\n?', '', text, flags=re.M)
text = re.sub(r'\n$', '', text)
text = re.sub(r'^[ ]*(.*);', r' \1', text, flags=re.M)
with open(outfilepath, 'w') as f:
f.write('EXPORTS\n')
f.write(text)