From 80c3fd1170bde2a2d2172d236e92590dff5a5e4a Mon Sep 17 00:00:00 2001 From: Mohan Boddu Date: Thu, 26 Jul 2018 17:03:58 -0400 Subject: [PATCH] Include exact version of pungi in the logs Fixes #990 Signed-off-by: Mohan Boddu --- pungi/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pungi/__init__.py b/pungi/__init__.py index 2e252106..0970d221 100644 --- a/pungi/__init__.py +++ b/pungi/__init__.py @@ -25,8 +25,10 @@ def get_full_version(): output, _ = proc.communicate() return re.sub(r'-1.fc\d\d?', '', output.strip().replace('pungi-', '')) else: - import pkg_resources - try: - return pkg_resources.get_distribution('pungi').version - except pkg_resources.DistributionNotFound: + import subprocess + proc = subprocess.Popen(["rpm", "-q", "pungi"], stdout=subprocess.PIPE) + (output, err) = proc.communicate() + if not err: + return output.rstrip() + else: return 'unknown'