This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: incorrect detection of information of some distributions
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: mrandybu, petr.viktorin
Priority: normal Keywords: patch

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:00adminsetgithub: 77616
2018-07-29 09:33:58petr.viktorinsetstatus: open -> closed
resolution: rejected
messages: + msg322623

stage: patch review -> resolved
2018-05-16 20:05:07petr.viktorinsetmessages: + msg316857
2018-05-16 08:39:30mrandybusetmessages: + msg316788
2018-05-15 15:37:49petr.viktorinsetmessages: + msg316671
2018-05-15 15:03:52mrandybusetmessages: + msg316663
2018-05-15 14:15:18petr.viktorinsetmessages: + msg316659
2018-05-15 14:10:35petr.viktorinsetnosy: + petr.viktorin
messages: + msg316658
2018-05-15 06:57:15mrandybusetmessages: + msg316627
2018-05-07 08:07:02python-devsetpull_requests: + pull_request6411
2018-05-07 07:16:46python-devsetstage: patch review
pull_requests: + pull_request6410
2018-05-06 09:53:32mrandybucreate