From 0f295e25c67bb1bcbd589d81b6c856a5eadcc957 Mon Sep 17 00:00:00 2001 From: Manuel Fritsch Date: Sun, 7 Feb 2021 13:52:03 +0100 Subject: [PATCH] "1" --- cbpi/__init__.py | 2 +- release.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 3 ++- 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 release.py diff --git a/cbpi/__init__.py b/cbpi/__init__.py index 37ab84d..a131110 100644 --- a/cbpi/__init__.py +++ b/cbpi/__init__.py @@ -1 +1 @@ -__version__ = "4.0.0.16" \ No newline at end of file +__version__ = "4.0.0.17" \ No newline at end of file diff --git a/release.py b/release.py new file mode 100644 index 0000000..8fe6f53 --- /dev/null +++ b/release.py @@ -0,0 +1,54 @@ +import subprocess +import click +import re + +@click.group() +def main(): + pass + +@click.command() +@click.option('-m', prompt='Commit Message') +def commit(m): + + 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) + with open(file,'w',encoding = 'utf-8') as file: + print("New Version {}".format(new_version) ) + file.write(new_version) + + + subprocess.run(["git", "add", "-A"]) + subprocess.run(["git", "commit", "-m", "\"{}\"".format(m)]) + subprocess.run(["git", "push"]) + + +@click.command() +def build(): + subprocess.run(["python3", "setup.py", "sdist"]) + + + +@click.command() +def release(): + subprocess.run(["python3", "setup.py", "sdist"]) + file = "./cbpi/__init__.py" + with open(file) as reader: + match = re.search('.*\"(.*)\"', reader.readline()) + version = match.group(1) + + path = "dist/cbpi-{}.tar.gz".format(version) + print("Uploading File {} ".format(path)) + subprocess.run(["twine", "upload", path]) + + +main.add_command(commit) +main.add_command(release) +main.add_command(build) + +if __name__ == '__main__': + main() diff --git a/requirements.txt b/requirements.txt index c93cee6..632d57d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -13,5 +13,6 @@ pyfiglet==0.8.post1 pandas==1.1.5 shortuuid==1.0.1 tabulate==0.8.7 -cbpi4-ui +cbpi4ui +click asyncio-mqtt \ No newline at end of file