On Jun 27, 6:50 pm, "Dr. David Kirkby" <david.kir...@onetel.net>
wrote:
> > #!/usr/bin/bash
> > if [ `uname` = "SunOS" -a "`ld  --version  2>&1  | grep GNU`" = "" ]; then
> >    echo "Solaris system. The linker is NOT the GNU linker"
> >    echo "The correct compiler flags are '-Wl,-h,'"
> > elif  [ `uname` = "darwin" ]; then
> >    echo "OS X"
> >    echo "Correct compiler flags are '-Wl,-h,'"
> > else
> >    echo "Not OSX, or Solaris with the Sun linker"
> >    echo "The correct flags are '-Wl,-soname,'"
> > fi
>
> Actually, what i put above is printing the wrong flags for OS X, but you
> should see what I mean. I want something like this, which returns the
> right flags in python.
>
> #!/usr/bin/bash
> if [ `uname` = "SunOS" -a "`ld  --version  2>&1  | grep GNU`" = "" ]; then
>    echo "Solaris system. The linker is NOT the GNU linker"
>    echo "The correct compiler flags are '-Wl,-h,'"
> elif  [ `uname` = "darwin" ]; then
>    echo "OS X"
>    echo "Correct compiler flags are -Wl,-dylib_install_name -Wl,"
> else
>    echo "Not OSX, or Solaris with the Sun linker"
>    echo "The correct flags are '-Wl,-soname,'"
> fi

I'm not exactly sure what you're looking for, but maybe try this:

(interactively)

sage: import os
sage: os.uname()
('Darwin',
 'Macintosh.local',
 '9.7.0',
 'Darwin Kernel Version 9.7.0: Tue Mar 31 22:52:17 PDT 2009;
root:xnu-1228.12.14~1/RELEASE_I386',
 'i386')

os.environ and os.system('ld --version') might also be helpful.  In a
python file:


import os

sysname = os.uname()[0]
ld_version = (something involving os.system('ld --version'))
if sysname == 'Darwin' and ld_version == blahblahblah:
    print "hello, this is Darwin"
elif sysname == 'Solaris':  # I don't really know what the right thing
is for sysname here
    print "solaris"
else:
    print "other system"

See <http://docs.python.org/library/os.html> for more on the Python os
module.

  John

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to