New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
platform.linux_distribution() should honor /etc/os-release #61962
Comments
http://www.freedesktop.org/software/systemd/man/os-release.html
|
os-release finally provides a cross-OS release file with a specification. I think it should be authoritative, then the lsb-release system (it’s officially a script but many OSes just parse a static file), then OS-specific files. |
I'm working on a patch. Hopefully, it will be ready in a day or two. |
I added a patch (my first patch!). platform.linux_distribution() now first looks in /etc/os-release. If this file is not found, checking continues as before. |
Hi Andrei Duma, I have looked at your patch but have not tested it yet. But it seems to me that your patch is a little bit weak against the case where the file /etc/os-release is found, but not fully functional (either garbage, or only releases NAME information but not VERSION). But again, I am not so sure we should really bit pedantic about this or not. Need to do some investigation. |
On 24.10.2013 16:59, Andrei Dorian Duma wrote:
Looks good. |
Apparently my fear is unfounded. The dist, version, id have been initialized with empty value. So if the os-release file does not have complete information, it should be okay with the patch from Andrei Duma. |
Hi, Andrei. Could you provide the test? You could take a look at bpo-17429 to see how it is done. http://bugs.python.org/issue17429 We would be grateful if you could test the case where os-release file is non-ascii encoded file (although technically it should be tested in bpo-17429). Sometimes the Linux distro version has non-ascii characters, such as Schrödinger's Cat. |
Yes, I will provide a patch including tests soon. |
New patch. Added tests and fixed uncaught OSError. |
Comments on add_os_release_support_2.patch:
try:
|
my concern here is that platform.linux_distribution returns different values for the tuple, wether os-release is found or the lsb config file is found. I don't know about a good solution, however if the return value has different values, that has to be clearly documented, or maybe unified in some form. |
This patch needs to be updated to tip since this commit: http://hg.python.org/cpython/rev/4580976c07cb |
platform.linux_distribution is being deprecated in 3.5 and removed in 3.6 as stated in comment http://bugs.python.org/issue1322#msg207427 in issue bpo-1322 I'm guessing this issue should be closed when that patch is merged in? |
The functions have been deprecated in bpo-1322, is it time to close this? |
See bpo-1322 for why we're closing this. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: