3 "usage: gen-hb-version.py 1.0.0 hb-version.h.in hb-version.h"
7 os.chdir (os.path.dirname (__file__))
13 major, minor, micro = version.split (".")
17 with open (input, "r", encoding='utf-8') as input_file:
18 generated = (input_file.read ()
19 .replace ("@HB_VERSION_MAJOR@", major)
20 .replace ("@HB_VERSION_MINOR@", minor)
21 .replace ("@HB_VERSION_MICRO@", micro)
22 .replace ("@HB_VERSION@", version)
25 with open (output, "rb") as current_file:
26 current = current_file.read()
28 # write only if is changed
29 if generated != current:
30 with open (output, "wb") as output_file:
31 output_file.write (generated)