msg67052 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-05-19 00:15 |
Sometimes os.uname (which is used to bootstrap platform.uname) can return 'unknown' for some items. The fallback code in platform.uname can usually fill these blanks in. However, this is only used when os.uname is not present. It would be useful if platform tried to fill these unknowns in. |
|
|
msg67796 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-07 02:26 |
I can work on this task. |
|
|
msg67798 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-07 04:08 |
i'm looking at the source and there doesn't appear to be a function uname within os.py. are we just considering the uname function in platform.py? |
|
|
msg67799 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-07 05:14 |
much handling code already seems to exist under the line except AttributeError: in platform.py (function uname(), lines 1101-1161 platform.py) i'm not too familiar with the Python codebase (i just began developing with Python a few days back) |
|
|
msg67804 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-07 12:43 |
Thanks for volunteering, James! I think you misunderstood the task. Do you see how in platform's uname, it only tries to find missing values for os.uname if os.uname doesn't exist? Sometimes os.uname exists, but it doesn't provide all the values. Your task is to modify platform.uname to try to fill in missing values in os.uname if they are present. |
|
|
msg67913 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-10 19:33 |
Alright, that makes things much clearer. I'm looking at this code snippet in platform.py: if system == 'unknown': system = '' if node == 'unknown': node = '' if release == 'unknown': release = '' if version == 'unknown': version = '' if machine == 'unknown': machine = '' if processor == 'unknown': processor = '' So essentially what you want me to do is add code that tries to replace the ''s with meaningful information. From what I understand, os.uname() is only defined in posix-based systems (it is imported from the module posix, after all). That means that 'unknown' is returned because the uname command is unable to retrieve the necessary information. Are there any alternatives to uname that could provide me with system info? |
|
|
msg67914 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-10 19:39 |
Ah, ok, the code under except AttributeError: gives me some good ideas. Should I use the methods utilized there to extract information from the system? |
|
|
msg67924 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-10 21:16 |
>Ah, ok, the code under except AttributeError: gives me some good ideas. >Should I use the methods utilized there to extract information from the >system? Right on! You don't need to write any new code, just make sure the code under the except AttributeError is utilized even if os.uname returns blank spots. |
|
|
msg68029 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-11 22:46 |
Here is the patch (apply to platform.py) |
|
|
msg68098 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-12 21:56 |
Thanks for doing this. Would you please try on Windows the patch, I'm attaching now? |
|
|
msg68108 - (view) |
Author: James Thomas (jjt009) |
Date: 2008-06-13 00:04 |
Your patch works perfectly on windows. Thanks for your help. |
|
|
msg68111 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-13 00:16 |
Marc, could you look at this please? |
|
|
msg68139 - (view) |
Author: Marc-Andre Lemburg (lemburg) *  |
Date: 2008-06-13 09:18 |
There are two patches. Which one do you want me to look at ? Note that platform.py should stay Python 1.5.2 compatible, ie. no new builtins, no True/False. The second patch also appears to mix tabs/spaces. |
|
|
msg68162 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-13 14:20 |
Ok. I ran it through reindent.py and removed the True and False. |
|
|
msg68165 - (view) |
Author: Marc-Andre Lemburg (lemburg) *  |
Date: 2008-06-13 14:55 |
On 2008-06-13 16:20, Benjamin Peterson wrote: > Benjamin Peterson <musiccomposition@gmail.com> added the comment: > > Ok. I ran it through reindent.py and removed the True and False. Thanks, but the all() is still there :-) You can change that to: ... or not filter(None, [system, node, release, version, machine]): should work on all Python versions. |
|
|
msg68166 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-13 14:59 |
Wow, I really admire you for keeping it compatible with Python 1.5. As you may have noticed, I'm addicted to new feature. :) |
|
|
msg68167 - (view) |
Author: Marc-Andre Lemburg (lemburg) *  |
Date: 2008-06-13 15:05 |
On 2008-06-13 16:59, Benjamin Peterson wrote: > Benjamin Peterson <musiccomposition@gmail.com> added the comment: > > Wow, I really admire you for keeping it compatible with Python 1.5. As > you may have noticed, I'm addicted to new feature. :) Yeah, well... it's a hobby :-) We can probably bump that to Python 2.1 or even 2.3 after 2.6 is out. The main reason for keeping 1.5.2 compatibility was mxCGIPython which started platform.py in the first place. Since it turned out to be useful for all kinds of things, it's good to be able to backport any changes to installations still using older Python versions. The patches look OK now. Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Jun 13 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2008-07-07: EuroPython 2008, Vilnius, Lithuania 23 days to go :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 |
|
|
msg68168 - (view) |
Author: Benjamin Peterson (benjamin.peterson) *  |
Date: 2008-06-13 15:12 |
Ok. I applied the patch in r64233. |
|
|