msg316232 - (view) |
Author: Andrey Bychkov (mrandybu) * |
Date: 2018-05-06 09:53 |
In some linux distributions, the information about the distribution is incorrectly determined when the linux_distribution() method is called from the platform class. Since the information file os-release becomes a certain standard, I propose first of all to check its availability and if it is in the system, then parse the information from it. I apply the patch. It will work well with version 2.7. |
|
|
msg316627 - (view) |
Author: Andrey Bychkov (mrandybu) * |
Date: 2018-05-15 06:57 |
it's patch is not actual. new diff in git pull request! |
|
|
msg316658 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-05-15 14:10 |
linux_distribution is deprecated since 3.5, so I don't think it makes sense to modify it. (see https://docs.python.org/3/library/platform.html#platform.linux_distribution) Can you use a third-party package instead, e.g. distro? http://distro.readthedocs.io/en/latest/ |
|
|
msg316659 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-05-15 14:15 |
Oh, and there's a long discussion on the deprecation here: https://bugs.python.org/issue1322 |
|
|
msg316663 - (view) |
Author: Andrey Bychkov (mrandybu) * |
Date: 2018-05-15 15:03 |
I think that it would be good to update linux_distribution, the discussion has been going on for a long time, but still in some cases the information is not determined correctly. It seems to me that the methods used are not entirely correct. My change more accurately determines information about the distribution using the modern standard-file os-release. If my change seems to be good, I can continue to edit linux_distribution. |
|
|
msg316671 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-05-15 15:37 |
Python's deprecation process takes several years, but linux_distribution is actually nearing the end of it. It is planned to be removed. Your improvement is great, but at this point, it is more similar to adding a new feature to the standard library, than fixing a bug. What are the use cases for linux_distribution()? Does it solve a common enough (and clear enough) problem that it should be in the stdlib? |
|
|
msg316788 - (view) |
Author: Andrey Bychkov (mrandybu) * |
Date: 2018-05-16 08:39 |
I think, at this moment, the optimal is parsing information from os-release file, because it's contained in majority linux distributions. Also can using 'Lsb_release -a' command, but not all distributions support 'Linux Standard Base'. At final can using at first parsing the os-release and if it failed, can using the lsb command parse. |
|
|
msg316857 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-05-16 20:05 |
I understand that's what distro (https://github.com/nir0s/distro) is based on -- but a lot of complexity is required on top of that. |
|
|
msg322623 - (view) |
Author: Petr Viktorin (petr.viktorin) *  |
Date: 2018-07-29 09:33 |
linux_distribution has beed deprecated for a while and has been removed in GH-6871 (bpo-28167) See https://pypi.org/project/distro for distro detection. |
|
|