mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-25 00:18:17 +01:00
Added codenae to release.py and adapted release.py code for 3 digits version
This commit is contained in:
parent
25327bab9f
commit
8a7525ef9d
1 changed files with 14 additions and 7 deletions
19
release.py
19
release.py
|
@ -1,3 +1,4 @@
|
||||||
|
import code
|
||||||
import subprocess
|
import subprocess
|
||||||
import click
|
import click
|
||||||
import re
|
import re
|
||||||
|
@ -10,16 +11,22 @@ def main():
|
||||||
@click.option('-m', prompt='Commit Message')
|
@click.option('-m', prompt='Commit Message')
|
||||||
def commit(m):
|
def commit(m):
|
||||||
|
|
||||||
|
new_content = []
|
||||||
file = "./cbpi/__init__.py"
|
file = "./cbpi/__init__.py"
|
||||||
with open(file) as reader:
|
with open(file) as reader:
|
||||||
match = re.search('.*\"(.*)\"', reader.readline())
|
match = re.search('.*\"(.*)\"', reader.readline())
|
||||||
major, minor, patch, build = match.group(1).split(".")
|
codename = reader.readline()
|
||||||
build = int(build)
|
try:
|
||||||
build += 1
|
major, minor, patch, build = match.group(1).split(".")
|
||||||
new_version = "__version__ = \"{}.{}.{}.{}\"".format(major,minor,patch, build)
|
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:
|
with open(file,'w',encoding = 'utf-8') as file:
|
||||||
print("New Version {}.{}.{}.{}".format(major,minor,patch, build))
|
print("New Version {}.{}.{}".format(major,minor,patch))
|
||||||
file.write(new_version)
|
file.writelines("%s\n" % i for i in new_content)
|
||||||
|
|
||||||
subprocess.run(["git", "add", "-A"])
|
subprocess.run(["git", "add", "-A"])
|
||||||
subprocess.run(["git", "commit", "-m", "\"{}\"".format(m)])
|
subprocess.run(["git", "commit", "-m", "\"{}\"".format(m)])
|
||||||
|
|
Loading…
Reference in a new issue