diff options
author | Pavel Hrdina <phrdina@redhat.com> | 2020-05-03 13:48:37 +0200 |
---|---|---|
committer | Pavel Hrdina <phrdina@redhat.com> | 2020-08-03 09:27:04 +0200 |
commit | cc409ac5ed7cdb4ee6968abf40099f649a151def (patch) | |
tree | fe0055ff53c96d0cbb5f367da88d14c22af22c95 /scripts | |
parent | 8e7d93da76ce9bad706c722d5b92c813e213e75c (diff) | |
download | libvirt-cc409ac5ed7cdb4ee6968abf40099f649a151def.tar.gz |
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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/meson-gen-def.py | 23 | ||||
-rw-r--r-- | scripts/meson.build | 1 |
2 files changed, 24 insertions, 0 deletions
diff --git a/scripts/meson-gen-def.py b/scripts/meson-gen-def.py new file mode 100755 index 0000000000..06c9bdf66a --- /dev/null +++ b/scripts/meson-gen-def.py @@ -0,0 +1,23 @@ +#!/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) diff --git a/scripts/meson.build b/scripts/meson.build index 5d3f0af479..09340bb6c6 100644 --- a/scripts/meson.build +++ b/scripts/meson.build @@ -18,6 +18,7 @@ scripts = [ 'header-ifdef.py', 'hvsupport.py', 'hyperv_wmi_generator.py', + 'meson-gen-def.py', 'meson-python.sh', 'mock-noinline.py', 'prohibit-duplicate-header.py', |