2020-04-21 09:49:16 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2020-07-04 09:34:41 +02:00
|
|
|
"This tool is intended to be used from meson"
|
2020-05-28 12:31:15 +02:00
|
|
|
|
2020-07-04 09:34:41 +02:00
|
|
|
import os, sys, shutil
|
2020-04-21 09:49:16 +02:00
|
|
|
|
2020-09-07 18:11:17 +02:00
|
|
|
if len (sys.argv) < 4:
|
2020-05-28 12:31:15 +02:00
|
|
|
sys.exit(__doc__)
|
2020-04-21 09:49:16 +02:00
|
|
|
|
|
|
|
version = sys.argv[1]
|
|
|
|
major, minor, micro = version.split (".")
|
2020-05-23 19:43:32 +02:00
|
|
|
|
2020-07-04 09:34:41 +02:00
|
|
|
OUTPUT = sys.argv[2]
|
2020-09-07 18:11:17 +02:00
|
|
|
INPUT = sys.argv[3]
|
|
|
|
CURRENT_SOURCE_DIR = os.path.dirname(INPUT)
|
2020-07-04 09:34:41 +02:00
|
|
|
|
|
|
|
with open (INPUT, "r", encoding='utf-8') as template:
|
|
|
|
with open (OUTPUT, "wb") as output:
|
|
|
|
output.write (template.read ()
|
|
|
|
.replace ("@HB_VERSION_MAJOR@", major)
|
|
|
|
.replace ("@HB_VERSION_MINOR@", minor)
|
|
|
|
.replace ("@HB_VERSION_MICRO@", micro)
|
|
|
|
.replace ("@HB_VERSION@", version)
|
|
|
|
.encode ())
|
|
|
|
|
|
|
|
# copy it also to src/
|
|
|
|
shutil.copyfile (OUTPUT, os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT)))
|