[issue28468] Add platform.linux_os_release()

2020-11-24 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +22381
pull_request: https://github.com/python/cpython/pull/23492

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread R. David Murray

R. David Murray added the comment:

Sorry, it wasn't my intent to (re)start a flame war, just to point out that 
there are linux platforms in wide use that do not support systemd.  But I don't 
have an opinion on whether or not adding this function is a good idea or not.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

We need a fallback in the case where /etc/os-release does not exists, or just 
use hasattr on `platform`

if hasattr(platform, 'linux_os_release'):
   print(platform.linux_os_release())
else:
   ...

or just raise an exception if platform.linux_os_release is not available.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Christian Heimes

Christian Heimes added the comment:

ETOOMUCHBIKESHEDDING and another uncalled systemd flame wars.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread R. David Murray

R. David Murray added the comment:

I hate systemd.  So does the company I'm currently doing most of my work for.  
We're using centos6 because it doesn't have systemd.  I personally use gentoo 
without systemd.  

That said, I don't use the platform module, so this doesn't actually affect me.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Matthias Klose

Matthias Klose added the comment:

"The name of the function clearly indicats that the function only works on 
Linux with a os-release file."

No, it does not. That would be linux_distribution_with_os_release_file().

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Christian Heimes

Christian Heimes added the comment:

Please read the title of this issue. It is "Add platform.linux_os_release()". 
The name of the function clearly indicats that the function only works on Linux 
with a os-release file.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Matthias Klose

Matthias Klose added the comment:

"Since all major Linux distribution now use systemd, it makes sense to me to 
add such function."

I'm not aware of any embedded Linux distro using systemd (no, I don't consider 
Raspian an embedded Linux distro).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread STINNER Victor

STINNER Victor added the comment:

"This is not available everywhere, not even on Linux distributions. Why would 
you implement something which only works on 50% of existing Linux 
distributions?"

According to http://0pointer.de/blog/projects/os-release systemd requires 
/etc/os-release. Since all major Linux distribution now use systemd, it makes 
sense to me to add such function.

We can document that the feature is specific to Linux (or don't declare the 
function on Linux?), document that it only works on recent versions of Linux 
distributions, and document that it doesn't work on all Linux distributions.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Matthias Klose

Matthias Klose added the comment:

-1

This is not available everywhere, not even on Linux distributions. Why would 
you implement something which only works on 50% of existing Linux 
distributions? Who would even use that? And for what would you use it?  You 
have a distro module available now from PyPi, you can use that one instead, and 
it gives 100% correct results for all currently known distros, and can be 
updated independent of Python releases.

If it's that a simple function, then please implement it for your own needs.  I 
think it's bad style too, to rely on specific distro and release information 
instead of checking release names and versions.  Such a style should not be 
encouraged in the standard lib from my point of view.

--
nosy: +doko

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Christian Heimes

Christian Heimes added the comment:

I'm not suggesting a generic platform detection function but rather a limited 
function just for os-release. On platforms without /etc/os-release the function 
should obviously fail and raise an exception. 
/etc/os-release is available on distributions without systemd. Even my oldest 
Debian installation on a Raspberry Pi has it.

A large majority of Linux distributions has the file. It's available on Debian, 
Fedora, RHEL 6+, Ubuntu 14.04+ and many more.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Charalampos Stratakis

Charalampos Stratakis added the comment:

Also there is an external project now aiming to provide this functionality:

https://github.com/nir0s/distro

--
nosy: +cstratak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

and for the older distributions without Systemd ? What do you suggest ?

--
nosy: +matrixise

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28468] Add platform.linux_os_release()

2016-10-18 Thread Christian Heimes

New submission from Christian Heimes:

#1322 has deprecated platform.linux_distribution(). The feature is going to be 
removed without replacement functions in the stdlib. It's no longer possible to 
detect the Linux distribution from stdlib. Let's add a function to read 
/etc/os-release [1] instead. It's a very simple format and pretty standard for 
many years.

[1] http://0pointer.de/blog/projects/os-release

--
components: Library (Lib)
messages: 278847
nosy: christian.heimes
priority: normal
severity: normal
stage: test needed
status: open
title: Add platform.linux_os_release()
type: enhancement
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com