summaryrefslogtreecommitdiff
path: root/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py
diff options
context:
space:
mode:
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.py17
1 files changed, 13 insertions, 4 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
index 15e56b93f98..879811ffc83 100644
--- a/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py
+++ b/Build/source/libs/harfbuzz/harfbuzz-src/src/gen-hb-version.py
@@ -2,17 +2,26 @@
"This tool is intended to be used from meson"
-import os, sys, shutil
+import os, sys, shutil, re
-if len (sys.argv) < 5:
+if len (sys.argv) < 4:
sys.exit(__doc__)
version = sys.argv[1]
major, minor, micro = version.split (".")
OUTPUT = sys.argv[2]
-CURRENT_SOURCE_DIR = sys.argv[3]
-INPUT = sys.argv[4]
+INPUT = sys.argv[3]
+CURRENT_SOURCE_DIR = os.path.dirname(INPUT)
+
+try:
+ with open (OUTPUT, "r") as old_output:
+ for line in old_output:
+ old_version = re.match (r"#define HB_VERSION_STRING \"(\d.\d.\d)\"", line)
+ if old_version and old_version[1] == version:
+ sys.exit ()
+except IOError:
+ pass
with open (INPUT, "r", encoding='utf-8') as template:
with open (OUTPUT, "wb") as output: