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.
Created on 2013年04月16日 15:01 by doko, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| add_os_release_support.patch | elixir, 2013年10月24日 14:59 | review | ||
| add_os_release_support_2.patch | elixir, 2013年11月02日 21:02 | review | ||
| Messages (17) | |||
|---|---|---|---|
| msg187089 - (view) | Author: Matthias Klose (doko) * (Python committer) | Date: 2013年04月16日 15:01 | |
http://www.freedesktop.org/software/systemd/man/os-release.html is a recent standard describing release information for an operating system. platform.linux_distribution() should know about it. - should that be the first file to be parsed? - names returned for the ID are different than the ones returned from /etc/lsb-release. The os-release thing only allows lower case letters for the ID (e.g. Ubuntu vs. ubuntu). The list of _supported_distros may need to list both. - take the version from VERSION_ID - there is no real attribute for the code name. The closest maybe is VERSION. |
|||
| msg187389 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2013年04月19日 22:08 | |
os-release finally provides a cross-OS release file with a specification. I think it should be authoritative, then the lsb-release system (it’s officially a script but many OSes just parse a static file), then OS-specific files. |
|||
| msg201013 - (view) | Author: Christian Heimes (christian.heimes) * (Python committer) | Date: 2013年10月23日 11:05 | |
*bump up* I'd like to see the feature in 3.4. It shouldn't be too hard to implement it. A patch would also solve #1322 and #9514 on most modern systems. For the record RHEL 5, RHEL 6.4, SLES 11 and Ubuntu 10.04 don't have /etc/os-release. Ubuntu 12.04 has the file. |
|||
| msg201023 - (view) | Author: -- (elixir) * | Date: 2013年10月23日 13:47 | |
I'm working on a patch. Hopefully, it will be ready in a day or two. |
|||
| msg201144 - (view) | Author: -- (elixir) * | Date: 2013年10月24日 14:59 | |
I added a patch (my first patch!). platform.linux_distribution() now first looks in /etc/os-release. If this file is not found, checking continues as before. |
|||
| msg201152 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年10月24日 16:20 | |
Hi Andrei Duma, I have looked at your patch but have not tested it yet. But it seems to me that your patch is a little bit weak against the case where the file /etc/os-release is found, but not fully functional (either garbage, or only releases NAME information but not VERSION). But again, I am not so sure we should really bit pedantic about this or not. Need to do some investigation. |
|||
| msg201154 - (view) | Author: Marc-Andre Lemburg (lemburg) * (Python committer) | Date: 2013年10月24日 16:31 | |
On 24.10.2013 16:59, Andrei Dorian Duma wrote: > > I added a patch (my first patch!). > > platform.linux_distribution() now first looks in /etc/os-release. If this file is not found, checking continues as before. Looks good. |
|||
| msg201518 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年10月28日 09:09 | |
Apparently my fear is unfounded. The dist, version, id have been initialized with empty value. So if the os-release file does not have complete information, it should be okay with the patch from Andrei Duma. |
|||
| msg201543 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年10月28日 14:23 | |
Hi, Andrei. Could you provide the test? You could take a look at issue 17429 to see how it is done. http://bugs.python.org/issue17429 We would be grateful if you could test the case where os-release file is non-ascii encoded file (although technically it should be tested in issue 17429). Sometimes the Linux distro version has non-ascii characters, such as Schrödinger's Cat. |
|||
| msg201603 - (view) | Author: -- (elixir) * | Date: 2013年10月29日 05:09 | |
Yes, I will provide a patch including tests soon. |
|||
| msg201987 - (view) | Author: -- (elixir) * | Date: 2013年11月02日 21:02 | |
New patch. Added tests and fixed uncaught OSError. |
|||
| msg202394 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年11月07日 23:15 | |
Comments on add_os_release_support_2.patch:
- You should not write a huge try/except OSError block. I would prefer something like:
try:
f = open(...)
except OSError:
return None
with f:
...
- I'm not sure about that, but you might use errors='surrogateescape', just in case if the file is not correctly encoded. Surrogate characters are maybe less annoying than a huge UnicodeDecodeError
- You use /etc/os-release even if the file is empty. Do you know if there is a standard, or something like that explaining if some keys are mandatory? For example, we can ignore os-release if 'ID' or 'VERSION_ID' key is missing
- For the unit test, you should write at least a test on linux_distribution() to check that your private function is used correctly
- You add unit tests for all escaped characters (', ", \), for comments, and maybe also for maformated lines (to have a well defined behaviour, ignore them or raise an error)
- _UNIXCONFDIR looks to be dedicated to unit tests, can't you patch builtin open() instead? It would avoid the need of a temporary directory
|
|||
| msg202395 - (view) | Author: Matthias Klose (doko) * (Python committer) | Date: 2013年11月07日 23:33 | |
my concern here is that platform.linux_distribution returns different values for the tuple, wether os-release is found or the lsb config file is found. I don't know about a good solution, however if the return value has different values, that has to be clearly documented, or maybe unified in some form. |
|||
| msg205773 - (view) | Author: Vajrasky Kok (vajrasky) * | Date: 2013年12月10日 07:21 | |
This patch needs to be updated to tip since this commit: http://hg.python.org/cpython/rev/4580976c07cb |
|||
| msg224548 - (view) | Author: Jason Robinson (jaywink) * | Date: 2014年08月02日 10:53 | |
platform.linux_distribution is being deprecated in 3.5 and removed in 3.6 as stated in comment http://bugs.python.org/issue1322#msg207427 in issue #1322 I'm guessing this issue should be closed when that patch is merged in? |
|||
| msg243088 - (view) | Author: Petr Viktorin (petr.viktorin) * (Python committer) | Date: 2015年05月13日 14:15 | |
The functions have been deprecated in #1322, is it time to close this? |
|||
| msg243092 - (view) | Author: Marc-Andre Lemburg (lemburg) * (Python committer) | Date: 2015年05月13日 14:21 | |
See issue1322 for why we're closing this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:44 | admin | set | github: 61962 |
| 2015年05月13日 14:21:06 | lemburg | set | messages: + msg243092 |
| 2015年05月13日 14:19:56 | lemburg | set | status: open -> closed resolution: wont fix |
| 2015年05月13日 14:15:27 | petr.viktorin | set | messages: + msg243088 |
| 2015年05月12日 13:15:14 | petr.viktorin | set | nosy:
+ petr.viktorin |
| 2014年08月02日 10:53:54 | jaywink | set | nosy:
+ jaywink messages: + msg224548 |
| 2013年12月10日 11:07:02 | jwilk | set | nosy:
+ jwilk |
| 2013年12月10日 07:21:26 | vajrasky | set | messages: + msg205773 |
| 2013年11月07日 23:33:25 | doko | set | messages: + msg202395 |
| 2013年11月07日 23:15:52 | vstinner | set | messages: + msg202394 |
| 2013年11月03日 07:37:22 | elixir | set | nosy:
+ vstinner |
| 2013年11月02日 21:02:09 | elixir | set | files:
+ add_os_release_support_2.patch messages: + msg201987 |
| 2013年10月29日 05:09:20 | elixir | set | messages: + msg201603 |
| 2013年10月28日 23:12:22 | Arfrever | set | nosy:
+ Arfrever |
| 2013年10月28日 14:23:17 | vajrasky | set | messages: + msg201543 |
| 2013年10月28日 09:09:20 | vajrasky | set | messages: + msg201518 |
| 2013年10月24日 16:31:05 | lemburg | set | messages: + msg201154 |
| 2013年10月24日 16:20:28 | vajrasky | set | nosy:
+ vajrasky messages: + msg201152 |
| 2013年10月24日 14:59:41 | elixir | set | files:
+ add_os_release_support.patch keywords: + patch messages: + msg201144 |
| 2013年10月23日 13:47:51 | elixir | set | nosy:
+ elixir messages: + msg201023 |
| 2013年10月23日 11:05:10 | christian.heimes | set | keywords:
+ easy messages: + msg201013 |
| 2013年04月20日 22:36:13 | christian.heimes | set | nosy:
+ christian.heimes |
| 2013年04月19日 22:08:15 | eric.araujo | set | assignee: lemburg messages: + msg187389 nosy: + eric.araujo, lemburg |
| 2013年04月16日 15:03:10 | ezio.melotti | set | nosy:
+ ezio.melotti type: enhancement |
| 2013年04月16日 15:01:08 | doko | create | |