Skip to content

Commit

Permalink
IPU workflow config actor: use distro.version() if python minor versi…
Browse files Browse the repository at this point in the history
…on >= 9
  • Loading branch information
yuravk committed Dec 19, 2024
1 parent 7a97222 commit fb75495
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import sys
import platform

from leapp.exceptions import StopActorExecutionError
Expand Down Expand Up @@ -47,7 +48,12 @@ def get_os_release(path):
:return: `OSRelease` model if the file can be parsed
:raises: `IOError`
"""
os_version = '.'.join(platform.dist()[1].split('.')[:2])
if sys.version_info.minor < 9:
os_version = platform.dist()[1]
else:
import distro
os_version = distro.version()
os_version = '.'.join(os_version.split('.')[:2])
try:
with open(path) as f:
data = dict(l.strip().split('=', 1) for l in f.readlines() if '=' in l)
Expand Down

0 comments on commit fb75495

Please sign in to comment.