diff options
Diffstat (limited to 'src/gen-def.py')
-rwxr-xr-x | src/gen-def.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gen-def.py b/src/gen-def.py new file mode 100755 index 0000000..9a997d6 --- /dev/null +++ b/src/gen-def.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +from __future__ import print_function, division, absolute_import + +import io, os, re, sys + +headers_content = [] +for h in os.environ["headers"].split (' '): + if h.endswith (".h"): + with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ()) + +result = """EXPORTS +%s +LIBRARY lib%s-0.dll""" % ( + "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))), + sys.argv[1].replace ('.def', '') +) + +with open (sys.argv[1], "w") as f: f.write (result) |