Closed frdbonif closed 4 years ago
psuedo import distro
linux_distribution()
('Ubuntu', '18.04', 'bionic')
Only for Linux, explore alternative options for Windows - I believe that this option supports FreeBSD but will need testing. If so, a simple os
module check to identify posix
or nt
will work to decide whether to run distro
or some other windows specific version.
distro.linux_distribution() output =
FreeBSD 12.1 = ('FreeBSD', '12.1', '') Ubuntu 18.04 = ('Ubuntu', '18.04', 'bionic') Debian 10 = ('Debian GNU/Linux', '10', 'buster') -- distro.linux_distribution(full_distribution_name=False) = ('debian', '10', 'buster') CentOS 8 = ('CentOS Linux', '8', 'Core') -- distro.linux_distribution(full_distribution_name=False) = ('centos, '8', 'Core') Sangoma Linux 7.6 = ('Sangoma Linux', '7', 'Core')
Windows 10 = ('', '', '')
os.name
Windows = 'nt' Linux/BSD = 'posix' JVM = 'java'
platform.uname()
Windows 10 = (system='Windows', node='HOSTNAME', release='10', version='10.0.19041', machine='AMD64', processor='proc details')
Less useful for windows so consider: PSUEDO
if os.name = posix then do distro check elif do platform.uname check else set var to unknown.
Done, needs testing on all platforms before closing.
Tested on Ubuntu 20.04, suffucient to close issue and test together with other features.
Using
distro
module.