From 22570183f7284e167b2877aa4bd19715dd817ac2 Mon Sep 17 00:00:00 2001 From: Adrian Haas <11636405+haasad@users.noreply.github.com> Date: Tue, 9 Nov 2021 09:37:48 +0100 Subject: [PATCH] Automate the version number in setup.py and info.py (#684) Co-authored-by: haasad --- activity_browser/info.py | 9 ++++++--- setup.py | 7 ++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/activity_browser/info.py b/activity_browser/info.py index 8c8388e18..e8aa9a416 100644 --- a/activity_browser/info.py +++ b/activity_browser/info.py @@ -1,3 +1,6 @@ -# -*- coding: utf-8 -*- -__version__ = "2.6.3" -__version_info__ = (2, 6, 3) +from importlib.metadata import version, PackageNotFoundError + +try: + __version__ = version(__package__) +except PackageNotFoundError: + __version__ = "0.0.0" diff --git a/setup.py b/setup.py index bf9bed815..2ec918454 100644 --- a/setup.py +++ b/setup.py @@ -17,9 +17,14 @@ pkg = pkg.replace(os.path.altsep, '.') packages.append(pkg) +if 'VERSION' in os.environ: + version = os.environ['VERSION'] +else: + version = os.environ.get('GIT_DESCRIBE_TAG', '0.0.0') + setup( name='activity-browser', - version="2.6.3", + version=version, packages=packages, include_package_data=True, author="Bernhard Steubing",