-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgen_autogentest.py
More file actions
33 lines (25 loc) · 802 Bytes
/
gen_autogentest.py
File metadata and controls
33 lines (25 loc) · 802 Bytes
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
30
31
32
33
"""
Test script for generating a wrapper for the code in autogentest.h using gccxml.
"""
import sys
import os
import pybindgen
from pybindgen import FileCodeSink
from pybindgen.gccxmlparser import ModuleParser
NAME = 'autogentest'
SRC = 'autogentest.h'
DEST = 'autogentest_wrap.cpp'
# TODO: look for this on the PATH, for now I've just installed it in my VirtualEnv
GCCXML = os.path.join(sys.prefix, 'bin', 'gccxml')
def my_module_gen():
module_parser = ModuleParser(NAME)
module = module_parser.parse(
[SRC],
gccxml_options=dict(gccxml_path=GCCXML),
#pygen_sink=FileCodeSink(sys.stdout),
)
module.add_include('"%s"' % SRC)
output = open(DEST, 'w')
module.generate(FileCodeSink(output))
if __name__ == '__main__':
my_module_gen()