From 631ced3d8953a1ea1b1382ff43cef11c7b971ac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Bonhomme?= Date: Fri, 13 Oct 2023 21:54:15 +0200 Subject: [PATCH] chg: [release] Bumped version number. --- NEWS.md | 8 ++++++++ bin/main.py | 4 ++-- pyhids/__init__.py | 22 +++++++++++----------- pyproject.toml | 2 +- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/NEWS.md b/NEWS.md index 703b0c6..f50a5d9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,14 @@ # pyHIDS project news +### 0.9.2 (2023-13-10) + +#### Fix + +Fixed an issue related to the function responsible of returning the version of +the software. + + ### 0.9.1 (2023-13-10) #### Changes diff --git a/bin/main.py b/bin/main.py index 07ea34c..97729e1 100644 --- a/bin/main.py +++ b/bin/main.py @@ -2,7 +2,7 @@ import argparse -from pyhids import __version__, utils +from pyhids import get_version, utils from pyhids.genBase import main as genBase from pyhids.genKeys import main as genKeys from pyhids.hashlookup import main as hashlookup @@ -97,7 +97,7 @@ def main(): arguments = parser.parse_args() if arguments.version: - return __version__ + return get_version() if arguments.command == "gen-keys": genKeys(arguments.nb_bits) diff --git a/pyhids/__init__.py b/pyhids/__init__.py index 155b733..35d8524 100644 --- a/pyhids/__init__.py +++ b/pyhids/__init__.py @@ -33,20 +33,20 @@ def get_version(): """Returns the version of the software. Checks if the Python package is installed or uses the Git tag.""" - version = ( - os.environ.get("PKGVER") - or subprocess.run( - ["git", "-C", BASE_DIR, "describe", "--tags"], stdout=subprocess.PIPE - ) - .stdout.decode() - .strip() - ) or "" + try: + version = ( + os.environ.get("PKGVER") + or subprocess.run( + ["git", "-C", BASE_DIR, "describe", "--tags"], stdout=subprocess.PIPE + ) + .stdout.decode() + .strip() + ) or "" + except Exception: + version = "" if not version: try: version = "v" + importlib.metadata.version("pyhids") # type: ignore except PackageNotFoundError: version = "" return version - - -__version__ = get_version() diff --git a/pyproject.toml b/pyproject.toml index af5af30..e34d83d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "pyHIDS" -version = "0.9.1" +version = "0.9.2" description = "A host-based intrusion detection system." authors = ["Cédric Bonhomme "] license = "GPL-3.0-or-later"