Include exact version of pungi in the logs

Fixes #990

Signed-off-by: Mohan Boddu <mboddu@bhujji.com>
This commit is contained in:
Mohan Boddu 2018-07-26 17:03:58 -04:00
parent 4ecf75295a
commit 80c3fd1170

View File

@ -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'