Imported Upstream version 1.8.1
[platform/upstream/harfbuzz.git] / src / gen-def.py
1 #!/usr/bin/env python
2
3 from __future__ import print_function, division, absolute_import
4
5 import io, os, re, sys
6
7 headers_content = []
8 for h in os.environ["headers"].split (' '):
9         if h.endswith (".h"):
10                 with io.open (h, encoding='utf-8') as f: headers_content.append (f.read ())
11
12 result = """EXPORTS
13 %s
14 LIBRARY lib%s-0.dll""" % (
15         "\n".join (sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M))),
16         sys.argv[1].replace ('.def', '')
17 )
18
19 with open (sys.argv[1], "w") as f: f.write (result)