Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/harfbuzz/src/gen-def.py @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 #!/usr/bin/env python3 | |
| 2 | |
| 3 "usage: gen-def.py harfbuzz.def hb.h [hb-blob.h hb-buffer.h ...]" | |
| 4 | |
| 5 import os, re, sys | |
| 6 | |
| 7 if len (sys.argv) < 3: | |
| 8 sys.exit(__doc__) | |
| 9 | |
| 10 output_file = sys.argv[1] | |
| 11 header_paths = sys.argv[2:] | |
| 12 | |
| 13 headers_content = [] | |
| 14 for h in header_paths: | |
| 15 if h.endswith (".h"): | |
| 16 with open (h, encoding='utf-8') as f: headers_content.append (f.read ()) | |
| 17 | |
| 18 symbols = sorted (re.findall (r"^hb_\w+(?= \()", "\n".join (headers_content), re.M)) | |
| 19 if '--experimental-api' not in sys.argv: | |
| 20 # Move these to harfbuzz-sections.txt when got stable | |
| 21 experimental_symbols = \ | |
| 22 """hb_subset_repack_or_fail | |
| 23 hb_subset_input_override_name_table | |
| 24 """.splitlines () | |
| 25 symbols = [x for x in symbols if x not in experimental_symbols] | |
| 26 symbols = "\n".join (symbols) | |
| 27 | |
| 28 result = symbols if os.getenv ('PLAIN_LIST', '') else """EXPORTS | |
| 29 %s | |
| 30 LIBRARY lib%s-0.dll""" % (symbols, output_file.replace ('src/', '').replace ('.def', '')) | |
| 31 | |
| 32 with open (output_file, "w") as f: f.write (result) |
