Newer
Older
skill-ovos-flowtoys / scripts / bump_alpha.py
@Daniel McKnight Daniel McKnight on 4 Mar 2023 567 bytes Add PyPI Automation scripts and workflows (#2)
import fileinput
from os.path import join, dirname


version_file = join(dirname(dirname(__file__)), "version.py")
version_var_name = "VERSION_ALPHA"

with open(version_file, "r", encoding="utf-8") as v:
    for line in v.readlines():
        if line.startswith(version_var_name):
            version = int(line.split("=")[-1])
            new_version = int(version) + 1

for line in fileinput.input(version_file, inplace=True):
    if line.startswith(version_var_name):
        print(f"{version_var_name} = {new_version}")
    else:
        print(line.rstrip('\n'))