2020-04-21 09:49:16 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import io, os, re, sys
|
|
|
|
|
|
|
|
if len (sys.argv) < 4:
|
|
|
|
sys.exit("usage: gen-hb-version.py 1.0.0 hb-version.h.in hb-version.h")
|
|
|
|
|
|
|
|
version = sys.argv[1]
|
|
|
|
major, minor, micro = version.split (".")
|
|
|
|
input = sys.argv[2]
|
|
|
|
output = sys.argv[3]
|
|
|
|
|
2020-05-21 06:07:44 +02:00
|
|
|
with open (output, "wb") as output_file, open (input, "r", encoding='utf-8') as input_file:
|
2020-04-21 09:49:16 +02:00
|
|
|
output_file.write (input_file.read ()
|
|
|
|
.replace ("@HB_VERSION_MAJOR@", major)
|
|
|
|
.replace ("@HB_VERSION_MINOR@", minor)
|
|
|
|
.replace ("@HB_VERSION_MICRO@", micro)
|
|
|
|
.replace ("@HB_VERSION@", version)
|
|
|
|
.encode ())
|