As of Python >3.5 the function platform.linux_distribution()
is being deprecated:
https://docs.python.org/3.5/library/platform.html#platform.linux_distribution
Is there anything that directly replaces it?
Unfortunately for me, platform.uname() doesn't yield the information I need since I'm building in a docker container and this returns the details of the host machine not the image.
In particular: I'm building a portable linux distribution (https://www.python.org/dev/peps/pep-0513/) and want to test it on the canonical CentOS 5.11 distribution. I'm looking for a simple way to identify the OS so I can identify/tag the build results.
Another option is
platform.uname()
:According to this, the
platform.linux_distribution()
will be deprecated beginning with Python 3.7. I can confirm that it is indeed present in 3.6. The link recommend the distro package as the alternative.After installing the package, you can do