distro
distro copied to clipboard
uname_info() return empty string on ubuntu20.04 and Fedora34
is this expected?
distro.__version__
'1.6.0'
print(distro.uname_info())
{}
Maybe? What does running uname -a print on those platforms?
the uname installed fine.
distro.LinuxDistribution(include_uname=True)
LinuxDistribution(os_release_file='/etc/os-release', distro_release_file='', include_lsb=True, include_uname=True, _os_release_info={'name': 'Ubuntu', 'version': '20.04.4 LTS (Focal Fossa)', 'id': 'ubuntu', 'id_like': 'debian', 'pretty_name': 'Ubuntu 20.04.4 LTS', 'version_id': '20.04', 'home_url': 'https://www.ubuntu.com/', 'support_url': 'https://help.ubuntu.com/', 'bug_report_url': 'https://bugs.launchpad.net/ubuntu/', 'privacy_policy_url': 'https://www.ubuntu.com/legal/terms-and-policies/privacy-policy', 'version_codename': 'focal', 'ubuntu_codename': 'focal', 'codename': 'focal'}, _lsb_release_info={'distributor_id': 'Ubuntu', 'description': 'Ubuntu 20.04.4 LTS', 'release': '20.04', 'codename': 'focal'}, _distro_release_info={}, _uname_info={})
subprocess.check_output(('uname', '-rs'))
b'Linux 5.4.0-109-generic\n'
Any idea what happens here?
I finally have time to dig into this. It turns out the uname content parser returns empty dict by design. So the uname_info() is actually never supposed to be called outside. It is merely a fallback method to get the distro id and distro version for some os such as AIX or some mac os. And even for those os the uname_info() does not really return the full kernel version.
So I think we should NOT expose the uname_info() and uname_attr() to user.