Skip to content

also take /etc/os-release into account in get_os_name and get_os_version#3930

Merged
SebastianAchilles merged 3 commits intoeasybuilders:developfrom
boegel:etc_os_release
Jan 18, 2022
Merged

also take /etc/os-release into account in get_os_name and get_os_version#3930
SebastianAchilles merged 3 commits intoeasybuilders:developfrom
boegel:etc_os_release

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Jan 18, 2022

For recent Python versions, where platform.linux_distribution is no longer available, we're not getting useful info on OS name/version unless the 3rd party distro package is installed.

Falling back to /etc/os-release largely fixes that...

Copy link
Copy Markdown
Member

@SebastianAchilles SebastianAchilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On some OS platform.linux_distribution doesn't yield any relevant information, e.g. on OpenSUSE Leap 15.2:

>>> platform.linux_distribution()
('', '', '')

We need to catch this.

Comment thread easybuild/tools/systemtools.py Outdated
Comment thread easybuild/tools/systemtools.py Outdated
Copy link
Copy Markdown
Member

@SebastianAchilles SebastianAchilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix UnboundLocalError: local variable 'os_version' referenced before assignment

Comment thread easybuild/tools/systemtools.py
Copy link
Copy Markdown
Member

@SebastianAchilles SebastianAchilles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants