From 0fef4aa22cf733de8d1973564ae8a1b47a669de7 Mon Sep 17 00:00:00 2001 From: Adam Saudagar Date: Fri, 10 Feb 2023 11:11:40 +0530 Subject: [PATCH] moved version to version.txt --- MANIFEST.in | 1 + fishy/__init__.py | 5 +++-- fishy/constants.py | 3 --- fishy/helper/migration.py | 6 +++--- fishy/version.txt | 1 + 5 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 fishy/version.txt diff --git a/MANIFEST.in b/MANIFEST.in index 097c810..9e4c232 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,6 +1,7 @@ include LICENSE include README.md include requirements.txt +include fishy/version.txt include fishy/icon.ico include fishy/fishybot_logo.png include fishy/sound.mp3 diff --git a/fishy/__init__.py b/fishy/__init__.py index ac2cc6f..6fc845c 100644 --- a/fishy/__init__.py +++ b/fishy/__init__.py @@ -1,4 +1,5 @@ -from fishy import constants +import os +from pathlib import Path # this prevents importing from package while setup @@ -7,4 +8,4 @@ def main(): actual_main() -__version__ = constants.version +__version__ = (Path(os.path.dirname(__file__)) / "version.txt").read_text() diff --git a/fishy/constants.py b/fishy/constants.py index 9f61181..8e4cf22 100644 --- a/fishy/constants.py +++ b/fishy/constants.py @@ -10,6 +10,3 @@ libgps = ("LibGPS", "https://cdn.esoui.com/downloads/file601/LibGPS_3_2_0.zip", libmapping = ("LibMapPing", "https://cdn.esoui.com/downloads/file1302/LibMapPing_2_0_0.zip", 200) libdl = ("LibDebugLogger", "https://cdn.esoui.com/downloads/file2275/LibDebugLogger_2_4_1.zip", 241) libchatmsg = ("LibChatMessage", "https://cdn.esoui.com/downloads/file2382/LibChatMessage_1_2_0.zip", 120) - - -version = "0.5.14" diff --git a/fishy/helper/migration.py b/fishy/helper/migration.py index e45e7a9..b25d0d8 100644 --- a/fishy/helper/migration.py +++ b/fishy/helper/migration.py @@ -1,8 +1,8 @@ import logging +import fishy from fishy.helper.auto_update import _normalize_version -from fishy.constants import version from .config import config @@ -14,14 +14,14 @@ class Migration: @staticmethod def migrate(): prev_version = _normalize_version(config.get("prev_version", "0.0.0")) - current_version = _normalize_version(version) + current_version = _normalize_version(fishy.__version__) if current_version > prev_version: for v, f in migration_code: if prev_version < _normalize_version(v) <= current_version: logging.info(f"running migration for {v}") f() - config.set("prev_version", version) + config.set("prev_version", fishy.__version__) diff --git a/fishy/version.txt b/fishy/version.txt new file mode 100644 index 0000000..63df075 --- /dev/null +++ b/fishy/version.txt @@ -0,0 +1 @@ +0.5.14 \ No newline at end of file