1
0
Fork 0
mirror of synced 2024-05-22 05:23:24 +12:00
FiraCode/script/update_version.py

21 lines
672 B
Python
Raw Permalink Normal View History

2021-11-07 04:48:49 +13:00
#! /usr/bin/env python3
2021-11-07 06:11:55 +13:00
import common, os, re, subprocess, sys
2021-11-07 04:48:49 +13:00
2021-11-07 06:11:55 +13:00
def update_version(major, minor, src):
print(f"update_version: {major}.{minor} in {src}")
2021-11-07 04:48:49 +13:00
with open(src, 'r') as f:
contents = f.read()
contents = re.sub(r"versionMajor\s+=\s+\d+;",
f"versionMajor = {major};",
contents)
contents = re.sub(r"versionMinor\s+=\s+\d+;",
f"versionMinor = {minor};",
contents)
2021-11-07 06:11:55 +13:00
with open(src, 'w') as f:
2021-11-07 04:48:49 +13:00
f.write(contents)
if __name__ == '__main__':
2021-11-07 06:11:55 +13:00
os.chdir(common.root)
(major, minor) = common.version().split(".")
update_version(major, minor, 'FiraCode.glyphs')
2021-11-07 04:48:49 +13:00
sys.exit(0)