diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-06-03 21:59:11 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2020-06-03 21:59:11 +0000 |
commit | 6fdc8929296cf4197489d90fc0ad22085c6b4cbb (patch) | |
tree | 4f9a225a3c337f445480655fbf09df82624528a2 /Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py | |
parent | a5770373d74efcb24a0caf8ca58c52a92d4ca7b9 (diff) |
harfbuzz 2.6.7
git-svn-id: svn://tug.org/texlive/trunk@55409 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py')
-rw-r--r-- | Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py new file mode 100644 index 00000000000..f21e5deb38d --- /dev/null +++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 + +"usage: gen-hb-version.py 1.0.0 hb-version.h.in hb-version.h" + +import os, re, sys + +os.chdir (os.path.dirname (__file__)) + +if len (sys.argv) < 4: + sys.exit(__doc__) + +version = sys.argv[1] +major, minor, micro = version.split (".") +input = sys.argv[2] +output = sys.argv[3] + +with open (input, "r", encoding='utf-8') as input_file: + generated = (input_file.read () + .replace ("@HB_VERSION_MAJOR@", major) + .replace ("@HB_VERSION_MINOR@", minor) + .replace ("@HB_VERSION_MICRO@", micro) + .replace ("@HB_VERSION@", version) + .encode ()) + + with open (output, "rb") as current_file: + current = current_file.read() + + # write only if is changed + if generated != current: + with open (output, "wb") as output_file: + output_file.write (generated) |