1
1
mirror of https://github.com/tonsky/FiraCode.git synced 2024-11-20 19:48:59 +03:00
FiraCode/script/update_version.py
2021-11-12 13:30:20 +00:00

21 lines
672 B
Python
Executable File

#! /usr/bin/env python3
import common, os, re, subprocess, sys
def update_version(major, minor, src):
print(f"update_version: {major}.{minor} in {src}")
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)
with open(src, 'w') as f:
f.write(contents)
if __name__ == '__main__':
os.chdir(common.root)
(major, minor) = common.version().split(".")
update_version(major, minor, 'FiraCode.glyphs')
sys.exit(0)