[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread STINNER Victor
STINNER Victor added the comment: Marc-Andre Lemburg: > It's not pointless. The rate of change in the field is why this > particular API did not work out in practice. It was working fine > at the time I added it, but then quickly became unmaintainable. Please look at the history of the os-rele

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread STINNER Victor
STINNER Victor added the comment: Marc-Andre Lemburg: > The main reason why it failed was the Linux distros keep inventing new ways > to identify themselves, sometimes misuse existing mechanisms to maintain > compatibility (e.g. as a Ubuntu or RedHat based OS) or ship with two > different re

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 25.11.2020 10:39, Christian Heimes wrote: > >> It would be an interface to a file /etc/os-release >> that's common nowadays, just like /etc/lsb-release was some years >> ago. These things change too often to make the stdlib a good fit. >> I'm pretty sur

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread Matthias Klose
Matthias Klose added the comment: > Where do you draw the line? there's a module available outside cpython. Your use case is to add some work around for some tests (like issue42142). If you need it for the tests, add it to the test framework. -- ___

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread Christian Heimes
Christian Heimes added the comment: > It would be an interface to a file /etc/os-release > that's common nowadays, just like /etc/lsb-release was some years > ago. These things change too often to make the stdlib a good fit. > I'm pretty sure distros will invent something new in 5 years which >

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 25.11.2020 10:06, Christian Heimes wrote: > > It's not a replacement for platform.linux_distribution(). Right, not even that :-) It would be an interface to a file /etc/os-release that's common nowadays, just like /etc/lsb-release was some years ago.

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread Christian Heimes
Christian Heimes added the comment: It's not a replacement for platform.linux_distribution(). -- ___ Python tracker ___ ___ Python-

[issue28468] Add platform.freedesktop_osrelease()

2020-11-25 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: I'm -1 on adding any kind of replacement for platform.linux_distribution() tp Python's stdlib. The experiment has failed and we should acknowledge this. The main reason why it failed was the Linux distros keep inventing new ways to identify themselves, s

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Christian Heimes
Christian Heimes added the comment: >From PR discussion on GH: I made ID_LIKE a special case because it's likely a users will use the field in a wrong way. The issue won't be detected in common CI because the field is either not present or contains a single item for majority of Linux distros

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: The distro module has been mentioned multiple times. I looked at its code base and I suggest to not add it to the Python stdlib. It contains code specific to some Linux distributions. Examples. elif 'ubuntu_codename' in props: # Same as above but a non-

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Christian Heimes
Christian Heimes added the comment: Correction: It was ArchLinux, not Alpine. ArchLinux used to have /usr/lib/os-release only. Recent ArchLinux releases has a symlink from /etc/os-release to /usr/lib/os-release. -- ___ Python tracker

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: > In the case of this it's mood to even discuss requiring > os-release. (a) the PR does not add a hard dependency > on os-release, and (b) the file is present anyway. For anything outside cpython, there is the distro module, and the distro module is checking

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Christian Heimes
Christian Heimes added the comment: > IMO it's interesting to see which Linux distributions provide os-release. The > list of quite long! As I said before I could not find any supported release of a Linux distribution without a proper os-release file. It might be possible that there are micr

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: pmp-p: > android and aosp, termux are also linux distributions without /etc/os-release I replied ealier. It's fine that platform.freedesktop_os_release() (I prefer a name with two underscores :-)) raises an error on embedded Linux distributions. Usually, whe

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: Matthias Klose: > There's no need to expose a second implementation as another API in the > standard library. When linux_distribution() has been removed, platform.platform() became less useful. Example: $ python2 -m platform Linux-5.9.8-200.fc33.x86_64-x86_

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread pmp-p
pmp-p added the comment: -1 android and aosp, termux are also linux distributions without /etc/os-release the only thing reliable there is probably sysconfig.get_config_vars('MULTIARCH') when properly used. -- nosy: +pmpp ___ Python tracker

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: > Python could also follow the lead of other software like D-Bus and make the > presence of os-release mandatory on Linux. Any Linux platform without it > would be considered broken. I don't think it is necessary to impose such > restriction on vendors. I d

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: > os-release is covered by the distro module. Ah, I didn't know. https://pypi.org/project/distro/ """ The distro package implements a robust and inclusive way of retrieving the information about a distribution based on new standards and old methods, namely

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: Christian, is it necessary to start with threats? > Python could also follow the lead of other software like D-Bus > and make the presence of os-release mandatory on Linux. > Any Linux platform without it would be considered broken. > I don't think it is neces

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: Matthias Klose > "The os-release file has been a well-defined standard for over 8 years." > ... doesn't implicate that it's a good style to base your checks on that > information. IMO /etc/os-release is a reliable way to retrieve the Linux distribution name.

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: > * /etc/os-release file <= this PR > * /etc/*release file <= covered by the PyPI distro module no Victor, you are wrong. os-release is covered by the distro module. There's no need to expose a second implementation as another API in the standard library.

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Christian Heimes
Christian Heimes added the comment: The os-release file is not tight to systemd. Only the reverse relationship is true: systemd, d-bus and other software require os-release. The file is present in the minimal base image of distributions like Alpine, ArchLinux, CentOS, Debian, Fedora, RHEL, S

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: "How to Check Linux Version" article: https://linuxize.com/post/how-to-check-linux-version/ * lsb_release command <= is it still used nowadays? * /etc/os-release file <= this PR * /etc/issue file * hostnamectl command * /etc/*release file <= covered by the PyP

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: Article about os-release: https://opensource.com/article/18/6/linux-version -- ___ Python tracker ___ ___

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: the Chef repo seems to be a little bit out-of-date, but anyway. I don't see the relevance for this issue. -- ___ Python tracker ___

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: "The os-release file has been a well-defined standard for over 8 years." ... doesn't implicate that it's a good style to base your checks on that information. -- ___ Python tracker

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: The Chef Software seems to maintain a copy of the os-release of major Linux distribution: https://github.com/chef/os_release Copy of the project README: # os_release This repo contains the /etc/os-release file from Linux distros. ## About os-release /etc/

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: > Since the filename is now fixed and the format is well specified, > IMO it's perfectly fine to add PR 23492. I disagree with that. The distro module is the preferred way to do this (which cannot be used in the Python core). The rationale given is an not ye

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread STINNER Victor
STINNER Victor added the comment: Matthias Klose: > I'm not aware of any embedded Linux distro using systemd (no, I don't > consider Raspian an embedded Linux distro). As soon as the function is documented to return an error if the file doesn't exist, I don't see how this is a blocker issue.

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Christian Heimes
Christian Heimes added the comment: What do you mean by "that"? Python never had any code to parse and handle freekdesktop.org's os-release file. Are you referring to linux_distribution() function? Petr removed platform.linux_distribution() in bpo-28167 because the function was problematic o

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Matthias Klose
Matthias Klose added the comment: it's easy to say "we need it". It took a while to remove that, so I don't think it should be easily re-introduced. so why do you need it, and why should it be exposed as part of the standard library? -- ___ Pytho

[issue28468] Add platform.freedesktop_osrelease()

2020-11-24 Thread Christian Heimes
Christian Heimes added the comment: Since we need distribution information in tests and code, I decided to reopen the bug. I named the new function freedesktop_osrelease because it's technically not restricted to Linux. It's freedesktop.org standard that may be used by non-Linux platforms,