On 06/27/10 10:58 PM, Jason B. Hill wrote:
Thanks!

Do you think there is an advantage to using lsb_release over the 'platform'
Python module in sage/local/lib/python? My idea here is to limit execution
to within Sage (I'm assuming that this platform module can be imported in
any Sage, compiled / binary, so let me know if that is incorrect) until the
distro is pinned down, then to issue commands outside of Sage to gather more
in-depth information.

I.e., can I assume that something such as

sage: import platform
sage: platform.system().lower()
'linux'

will function consistently in different Sages? What happens in Mac OSX or
SunOS??


drkir...@hawk:~$ python
Python 2.6.4 (r264:75706, Feb 14 2010, 14:03:47) [C] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.system().lower()
'sunos'
>>>

but having looked at a few of those platform.x things on Solaris, I'm not over impressed.

I would have thought using platform.system() or os.uname to decide what set of commands to run, then just run some half a dozen useful command on each platform, making sure they do not require root access, and do not require things installed which people may not have.

lsb_release might be fine on Linux IF someone has it installed, but its not a lot of use if they do not. I recall someone making this mistake in Sage by assuming 'top' would exist. It caused havoc on Solaris as it was slow,

http://trac.sagemath.org/sage_trac/ticket/6028

and even more havoc if someone had not installed it

http://trac.sagemath.org/sage_trac/ticket/8391



Dave

This allows then something like:

sage: platform.dist()
('debian', 'squeeze/sid', '')

>>> platform.dist()
('', '', '')

drkir...@hawk:~$ cat /etc/release
                       OpenSolaris Development snv_134 X86
           Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
                        Use is subject to license terms.
                             Assembled 01 March 2010

tells me immediately someone is running OpenSolaris and what release and date it is. However, trying to get that into some sort of structured array would be difficult, as I don't know that the format of /etc/release will be consistent on all versions of Solaris. In fact, I know it is not totally consistent if I go back long enough. It is fine for a human to read, but more difficult to reliably parse.

Jason B. Hill



On Sat, Jun 26, 2010 at 12:09 AM, William Stein<[email protected]>  wrote:

On Fri, Jun 25, 2010 at 6:48 AM, Minh Nguyen<[email protected]>
wrote:
Hi David,

On Fri, Jun 25, 2010 at 11:40 PM, David Kirkby<[email protected]>
wrote:

<SNIP>

Of course, that could change over time. If you want to know your way
around a Solaris system a bit more, here are some semi-useful commands

Thank you for giving such a useful list of commands for getting
information about a Solaris system. Let me repay in kind for a Linux
system:

$ uname -a
$ cat /etc/issue
$ cat /proc/cpuinfo
$ cat /proc/meminfo

I think lsb_release provides the best canonical way to identify the
Linux OS type.  It's part of the Linux Standards Base, and can be
installed easily from the package system on most any linux distro.

Some examples:

wst...@sage:~$ lsb_release -d -s
Ubuntu 8.04.4 LTS
wst...@sage:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 8.04.4 LTS
Release:        8.04
Codename:       hardy


My script here computes canonical names for Sage binaries:

  http://sage.math.washington.edu/home/wstein/bin/botdist



--
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]<sage-devel%[email protected]>
For more options, visit this group at
http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to