From c9d34dc5144c2b009b0ba42916eae52d70775f7d Mon Sep 17 00:00:00 2001 From: eibex <40539455+eibex@users.noreply.github.com> Date: Wed, 18 Mar 2020 14:17:10 +0100 Subject: [PATCH] read version from local .version file --- bot.py | 6 ++++-- setup.py | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 8e45e5d5..af739d1f 100644 --- a/bot.py +++ b/bot.py @@ -12,9 +12,11 @@ # Original Repository: https://github.com/eibex/reaction-light # License: MIT - Copyright 2019-2020 eibex -__version__ = "0.3.0" - directory = os.path.dirname(os.path.realpath(__file__)) + +with open(f"{directory}/.version") as f: + __version__ = f.read().rstrip("\n").rstrip("\r") + folder = f"{directory}/files" config = configparser.ConfigParser() config.read(f"{directory}/config.ini") diff --git a/setup.py b/setup.py index 543a02c8..c76bfa78 100644 --- a/setup.py +++ b/setup.py @@ -4,8 +4,12 @@ # Original Repository: https://github.com/eibex/reaction-light # License: MIT - Copyright 2019-2020 eibex +folder = path.dirname(path.realpath(__file__)) +with open(f"{folder}/.version") as f: + __version__ = f.read().rstrip("\n").rstrip("\r") + print("Author: eibex") -print("Version: 0.3.0") +print(f"Version: {__version__}") print("License: MIT\n") print("### ### Reaction Light Setup ### ###") @@ -68,7 +72,6 @@ else: break -folder = path.dirname(path.realpath(__file__)) config = configparser.ConfigParser() config.read("{}/config.ini.sample".format(folder)) config["server"]["token"] = token