From c58e6a72bf9c2f74a84b303a0d78a42235d5cb0f Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Fri, 6 Mar 2020 23:26:01 +0100 Subject: Improved method to detect current version of the Newspipe instance. --- newspipe/web/__init__.py | 16 +++++++++++++++- newspipe/web/templates/about_more.html | 2 +- newspipe/web/views/views.py | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/newspipe/web/__init__.py b/newspipe/web/__init__.py index 810d55ce..16d84cc5 100644 --- a/newspipe/web/__init__.py +++ b/newspipe/web/__init__.py @@ -5,4 +5,18 @@ __revision__ = "$Date: 2020/02/27 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" -__all__ = [__version__] +import os +import subprocess + +BASE_DIR = os.path.abspath(os.path.dirname(__file__)) + +__version__ = ( + os.environ.get("PKGVER") + or subprocess.run(["git", + "-C", + BASE_DIR, + "describe", + "--tags"], stdout=subprocess.PIPE) + .stdout.decode() + .strip() +) diff --git a/newspipe/web/templates/about_more.html b/newspipe/web/templates/about_more.html index 3b253b25..94a01c07 100644 --- a/newspipe/web/templates/about_more.html +++ b/newspipe/web/templates/about_more.html @@ -2,7 +2,7 @@ {% block content %}