File: meson-gen-sym.py

package info (click to toggle)
libvirt 11.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 209,020 kB
  • sloc: ansic: 535,831; xml: 321,783; python: 11,974; perl: 2,626; sh: 2,185; makefile: 448; javascript: 126; cpp: 22
file content (29 lines) | stat: -rwxr-xr-x 670 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3

import sys

if len(sys.argv) < 5:
    print('invalid arguments')
    print('usage: {0} OUTPUT VERSION PUBLIC PRIVATE ...')
    sys.exit(1)

outfilepath = sys.argv[1]
version = sys.argv[2]
public = sys.argv[3]
private = sys.argv[4:]

with open(outfilepath, 'w') as out:
    out.write('# WARNING: generated from the following files:\n\n')

    with open(public) as tmp:
        out.write(tmp.read())

    out.write('\n\n# Private symbols\n\n')
    out.write('{0} {{\n\n'.format(version))
    out.write('global:\n\n')

    for priv in private:
        with open(priv) as tmp:
            out.write(tmp.read())

    out.write('\n\nlocal:\n*;\n\n};')