From 8a7525ef9ddc035764a3e0f92681cf8d8241b762 Mon Sep 17 00:00:00 2001 From: avollkopf <43980694+avollkopf@users.noreply.github.com> Date: Wed, 30 Mar 2022 07:42:07 +0200 Subject: [PATCH] Added codenae to release.py and adapted release.py code for 3 digits version --- release.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/release.py b/release.py index 4417727..60514b9 100644 --- a/release.py +++ b/release.py @@ -1,3 +1,4 @@ +import code import subprocess import click import re @@ -9,17 +10,23 @@ def main(): @click.command() @click.option('-m', prompt='Commit Message') def commit(m): - + + new_content = [] file = "./cbpi/__init__.py" with open(file) as reader: match = re.search('.*\"(.*)\"', reader.readline()) - major, minor, patch, build = match.group(1).split(".") - build = int(build) - build += 1 - new_version = "__version__ = \"{}.{}.{}.{}\"".format(major,minor,patch, build) + codename = reader.readline() + try: + major, minor, patch, build = match.group(1).split(".") + except: + major, minor, patch = match.group(1).split(".") + patch = int(patch) + patch += 1 + new_content.append("__version__ = \"{}.{}.{}\"".format(major,minor,patch)) + new_content.append(codename) with open(file,'w',encoding = 'utf-8') as file: - print("New Version {}.{}.{}.{}".format(major,minor,patch, build)) - file.write(new_version) + print("New Version {}.{}.{}".format(major,minor,patch)) + file.writelines("%s\n" % i for i in new_content) subprocess.run(["git", "add", "-A"]) subprocess.run(["git", "commit", "-m", "\"{}\"".format(m)])