Fix printing version on Python 3
Don't crash when getting version from installed package. Fixes: https://pagure.io/pungi/issue/1152 Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
b165866f39
commit
2f8717ec97
@ -26,7 +26,9 @@ def get_full_version():
|
|||||||
return re.sub(r'-1.fc\d\d?', '', output.strip().replace('pungi-', ''))
|
return re.sub(r'-1.fc\d\d?', '', output.strip().replace('pungi-', ''))
|
||||||
else:
|
else:
|
||||||
import subprocess
|
import subprocess
|
||||||
proc = subprocess.Popen(["rpm", "-q", "pungi"], stdout=subprocess.PIPE)
|
proc = subprocess.Popen(
|
||||||
|
["rpm", "-q", "pungi"], stdout=subprocess.PIPE, universal_newlines=True
|
||||||
|
)
|
||||||
(output, err) = proc.communicate()
|
(output, err) = proc.communicate()
|
||||||
if not err:
|
if not err:
|
||||||
return output.rstrip()
|
return output.rstrip()
|
||||||
|
Loading…
Reference in New Issue
Block a user