Systemd/src/test/generate-sym-test.py
Zbigniew Jędrzejewski-Szmek 6b0c49e036 Mark python scripts executable
Since all our python scripts have a proper python3 shebang, there is no benefit
to letting meson autodetect them. On linux, meson will just uses exec(), so the
shebang is used anyway. The only difference should be in how meson reports the
script and that the detection won't fail for (most likely misconfigured)
non-UTF8 locales.

Closes #5855.
2017-05-07 20:16:47 -04:00

24 lines
499 B
Python
Executable file

#!/usr/bin/env python3
import sys, re
print('#include <stdio.h>')
for header in sys.argv[2:]:
print('#include "{}"'.format(header.split('/')[-1]))
print('''
void* functions[] = {''')
for line in open(sys.argv[1]):
match = re.search('^ +([a-zA-Z0-9_]+);', line)
if match:
print(' {},'.format(match.group(1)))
print('''};
int main(void) {
unsigned i;
for (i = 0; i < sizeof(functions)/sizeof(void*); i++)
printf("%p\\n", functions[i]);
return 0;
}''')