Issue 33435: incorrect detection of information of some distributions (original) (raw)

Created on 2018-05-06 09:53 by mrandybu, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fixed_lib_platform_os-release.patch mrandybu,2018-05-06 09:53
Pull Requests
URL Status Linked Edit
PR 6718 closed python-dev,2018-05-07 07:16
PR 6719 closed python-dev,2018-05-07 08:07
Messages (9)
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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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) * (Python committer) 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.
History
Date User Action Args
2022-04-11 14:59:00 admin set github: 77616
2018-07-29 09:33:58 petr.viktorin set status: open -> closedresolution: rejectedmessages: + stage: patch review -> resolved
2018-05-16 20:05:07 petr.viktorin set messages: +
2018-05-16 08:39:30 mrandybu set messages: +
2018-05-15 15:37:49 petr.viktorin set messages: +
2018-05-15 15:03:52 mrandybu set messages: +
2018-05-15 14:15:18 petr.viktorin set messages: +
2018-05-15 14:10:35 petr.viktorin set nosy: + petr.viktorinmessages: +
2018-05-15 06:57:15 mrandybu set messages: +
2018-05-07 08:07:02 python-dev set pull_requests: + <pull%5Frequest6411>
2018-05-07 07:16:46 python-dev set stage: patch reviewpull_requests: + <pull%5Frequest6410>
2018-05-06 09:53:32 mrandybu create