diff --git a/InteractiveHtmlBom/version.py b/InteractiveHtmlBom/version.py index 47e998b8..65047d09 100644 --- a/InteractiveHtmlBom/version.py +++ b/InteractiveHtmlBom/version.py @@ -1,17 +1,21 @@ # Update this when new version is tagged. -LAST_TAG = 'v2.3' - import os -plugin_path = os.path.realpath(os.path.dirname(__file__)) -plugin_path if not os.path.islink(plugin_path) else os.readlink(plugin_path) +import subprocess + + +LAST_TAG = 'v2.4' + def _get_git_version(): - import os, subprocess + plugin_path = os.path.realpath(os.path.dirname(__file__)) try: git_version = subprocess.check_output( - ['git', 'describe', '--tags', '--abbrev=4', '--dirty=-*'], - cwd=plugin_path) - return git_version.decode('utf-8') if isinstance(git_version, bytes) else git_version + ['git', 'describe', '--tags', '--abbrev=4', '--dirty=-*'], + cwd=plugin_path) + if isinstance(git_version, bytes): + return git_version.decode('utf-8').rstrip() + else: + return git_version.rstrip() except subprocess.CalledProcessError as e: print('Git version check failed: ' + str(e)) except Exception as e: