| Issue 216: | Fix Python issue #1322: "platform.dist() has unpredictable result under Linux" | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
The task is to get this issue resolved:
http://bugs.python.org/issue1322
What you have to do:
Enhance Python's platform module by porting Christian Heimes' outdated patch
'platform_py25.patch' to Python 2.6 (trunk). Create tests for the new
feature and update the documentation accordingly.
The GettingAndCompilingPython wiki page will help you setting up your
working directory with Python 2.6. WorkingOnDocumentation has details
on writing documentation.
Completion:
Attach a diff file to this issue and send an e-mail to the
mailing list.
Task duration: please complete this task within 5 days (120 hours) of claiming it.
|
||||||||||||||||||
,
Dec 07, 2007
I claim this task |
|||||||||||||||||||
,
Dec 07, 2007
Great!
Status: Claimed
Labels: Due-20071212.2000 ClaimedBy-fastnix |
|||||||||||||||||||
,
Dec 07, 2007
Feel free to contact me if you have questions or problems. Christian
Owner: tiran79
|
|||||||||||||||||||
,
Dec 09, 2007
Are you making progress? I haven't heard from you in a while. |
|||||||||||||||||||
,
Dec 09, 2007
Yes, my work in progress. I attach first (alpha) version of patch. It include updated patch platform_py25.patch to work clear with python 2.6 trunk. Also in include additional test cases for Debian Etch and Red Hat Nahant. And when i have it done i have some question: 1. In http://bugs.python.org/issue1322 you say that "/etc/*-release file has a higher priority than /etc/lsb-release". But Ubuntu test case use '7.10' as version (from /etc/lsb-release) instead from lenny/sid (from debian_version) 2. In current trunk function dist() marked as deprecated and forward call to linux_distribution(). I update patch to change linux_distribution. But this function also contain full_distribution_name parameter. I also remove it because i don't see any utility for it. But i don't sure there. 3. Task contain requirement of updating documentation accordingly, but i don't see any appropriate docs around. I glad to hear comments and suggest about current patch, but remember this it in alpha stage only. |
|||||||||||||||||||
,
Dec 09, 2007
(No comment was entered for this change.)
Labels: NeedsReview-tiran79
|
|||||||||||||||||||
,
Dec 10, 2007
I'm going to review the patch later. Sorry, but I was busy today. 1) Have you read the documentation at http://linux.die.net/man/1/lsb_release ? The method should return the same information as the script lsb_release. In Debian and Ubuntu it's a Python script so you may want to read it. ;) The output for my system is Distributor ID: Ubuntu Description: Ubuntu 7.10 Release: 7.10 Codename: gutsy /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=7.10 DISTRIB_CODENAME=gutsy DISTRIB_DESCRIPTION="Ubuntu 7.10" As far as I see /etc/debian_version is not part of the LSB standard. But if you have time and energy for some extra credits you can implement a new API method that returns some extra information as a dict: id: Ubuntu description: Ubuntu 7.10 release: 7.10 codename: gutsy debian_version : lenny/sid os: GNU/Linux 2) I don't know why _supported_dists and full_distribution_name was added, too. I'm going to ask Thomas Wouters about it. 3) For one there is Misc/NEWS which contains a list of changes. The file is used to fill Doc/whatsnew/. There is also Doc/library/platform.rst which must be updated accordantly. |
|||||||||||||||||||
,
Dec 11, 2007
Attach updated patch. Added: 1. File lsb_release have higher priority than other *release files. Now pass all exist testes. 2. Updated Misc/NEWS and Doc/library/platform.rst files. But i confused with dist() and linux_distributions() functions. ps: I don't want write new API method for debian_version because it would work only on Debian/Ubuntu. But platform.py already have some code to parse such files and extract information. Still wait for review. |
|||||||||||||||||||
,
Dec 11, 2007
You did a good job so far! :)
Some suggestions:
* Please change code like::
info = open(installed).readlines()
for line in info:
pkg = line.split('-')
to::
with open(installed) as fp:
for line in fp:
pkg = line.split('-')
In modern Python readlines() isn't required any more and the with statement takes
care of closing the file.
* In linux_distribution's doc string don't substitute /etc with _ETC_DIR. The
_ETC_DIR variable is for internal use and unit testing only.
* Why did you remove the block?
@@ -1147,11 +1172,6 @@
if processor == 'unknown':
processor = ''
- # normalize name
- if system == 'Microsoft' and release == 'Windows':
- system = 'Windows'
- release = 'Vista'
-
* Can you please explain in a few words how linux_distribution() tries to determinate
the distribution? Just explain that it uses the LSB standard files /etc/... and falls
back to ... if the files are not available.
* How do the arguments of linux_distribution(distname='', version='', id='') affect
the output? Please explain that in the docs as well.
|
|||||||||||||||||||
,
Dec 11, 2007
Thanks for suggestion. I will fix it later today. Except removed block of code - this code was removed in original platform_py25.py Do i need to revert this change? |
|||||||||||||||||||
,
Dec 11, 2007
Please leave the code block. It's Windows related code and not part of your task. I don't know why it was added, too. I don't like to mess around with code I don't understand. *g* |
|||||||||||||||||||
,
Dec 11, 2007
1. I'm rewrite in three place "with open ... as" code. Please review it more carefully, i don't sure in other two places. 2. _ETC_DIR replaced with /etc 3. Back removed windows code 4. Add some explanations in Doc/library/platform.rst about linux_distribution() 5. It already included in function description I'm add new test case for CentOS 5.1 Also i have one new question - which distribution name is more good to us: from <distrib>[-_]release or from it contents (if both presented)? F.e. in CentOS it differ: redhat and CentOS accordingly. |
|||||||||||||||||||
,
Dec 11, 2007
1) The new with blocks are fine. 2-5) fine, too Have you read the specs and examples at http://linux.die.net/man/1/lsb_release ? The content of the distrib-release file contains more and detailed information than the name. v4 patch is more than sufficient to finish the task. Do you want to add or change anything? |
|||||||||||||||||||
,
Dec 11, 2007
Yes, i read this manual. But i'm confused with RedHatEnterpriseLinuxAS returned as distrib. Therefore i don't know what is better to us redhat or RedHatEnterpriseLinuxAS I don't want change nothing, but i may update this patch for py3k on the nearest weekend (out of this issue) if you or anybody else interesting in it and may review my work. |
|||||||||||||||||||
,
Dec 12, 2007
I'm wait for final valuation. And during this time a have some updates: platform_py26_v5.patch + Add previously forgotten centos data for test. + Remove unneeded import of string module + rewrite yet one "open-for" loop to "with as" loop platform_py30_v2.patch Initial version of patch for current python 3.0 trunk (during this port i found unneeded string import and open-for loop) + replace dict.has_key with <key> in <dict> syntax |
|||||||||||||||||||
,
Dec 12, 2007
A patch for py3k is appreciated! :) Good work! You have completed the task successfully and in time. I hope you enjoyed it. I'm more than satisfied with your patches.
Status: Completed
Labels: -Due-20071212.2000 -NeedsReview-tiran79 NeedsCommit |
|||||||||||||||||||
,
Dec 12, 2007
Thanks. I only wish that this patches was finally merged trunk, and you don't create task to port it to 2.7 trunk;) If you have some appropriate for contest bugs in CPython - i will glad to see it in next batch. |
|||||||||||||||||||
,
Jan 28, 2008
tiran, are you remember about me? I'm submitted Contribution Agreement by email on last week. |
|||||||||||||||||||
,
Jan 30, 2008
I'm not involved in the contributor agreement process and I don't have access to the list of sent agreements. Sorry :) |
|||||||||||||||||||
,
Feb 02, 2008
Chris, we've received the CA now, you can commit this. |
|||||||||||||||||||
|
|
|||||||||||||||||||