comparison mupdf-source/thirdparty/harfbuzz/src/gen-harfbuzzcc.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 "This tool is intended to be used from meson"
4
5 import os, sys, shutil
6
7 if len (sys.argv) < 3:
8 sys.exit (__doc__)
9
10 OUTPUT = sys.argv[1]
11 CURRENT_SOURCE_DIR = sys.argv[2]
12
13 # make sure input files are unique
14 sources = sorted(set(sys.argv[3:]))
15
16 with open (OUTPUT, "wb") as f:
17 f.write ("".join ('#include "{}"\n'.format (os.path.relpath (os.path.abspath (x), CURRENT_SOURCE_DIR)) for x in sources if x.endswith (".cc")).encode ())
18
19 # copy it also to the source tree, but only if it has changed
20 baseline_filename = os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))
21 with open(baseline_filename, "rb") as baseline:
22 with open(OUTPUT, "rb") as generated:
23 if baseline.read() != generated.read():
24 shutil.copyfile (OUTPUT, baseline_filename)