On 09/23/10 04:29 PM, John H Palmieri wrote:


On Sep 23, 8:14 am, "Dr. David Kirkby"<david.kir...@onetel.net>
wrote:
Readline is a package which has no dependences other than BASE (see
$SAGE_ROOT/spkg/standard/deps). So it can be built very early - before Python.

This is part of the log from a successful installation of readline.

=================================================================
-bash-4.1$ tail spkg/logs/readline-6.0.p2.log
make[2]: Leaving directory
`/home/users/drkirkby/sage-4.6.alpha1/spkg/build/readline-6.0.p2/src'

real    8m1.326s
user    4m33.895s
sys     0m50.145s
Successfully installed readline-6.0.p2
Now cleaning up tmp files.
Making Sage/Python scripts relocatable...
python: No such file or directory
Finished installing readline-6.0.p2.spkg
==================================================================

Notice two of the last last 3 lines above say

Making Sage/Python scripts relocatable...
python: No such file or directory

This is from the script sage-spkg:

   echo "Making Sage/Python scripts relocatable..."

   cd "$SAGE_LOCAL"/bin
   ./sage-make_relative

Then sage-make_relative is a python script.

Maybe this part of the script should test for python's existence
first, and if it's there, run it.  Or test for the existence of both
local/bin/python/... and python?

--
John

But what if Python does not exist? We probably can't build it at this point, as I doubt all Python's perquisites are in place.

This is the complete file, which is only 29 lines long.

=====================================================
drkir...@hawk:~/sage-4.6.alpha1$ cat ./spkg/base/sage-make_relative
#!/usr/bin/env python

import os

print "Making script relocatable"
for F in os.listdir('.'):
    if F == 'sage-sage':
        continue
    if not os.path.isfile(F):
        continue
    try:
        X = open(F,'r')
    except IOError:
        continue
    L = X.readline()
    if L.find("python") != -1 and L.find("#!") != -1:
        Y = X.read()
        X.close()
        #print "Making interpreter for script %s relative"%F
        try:
            O = open(F,'w')
        except IOError:
            os.system('chmod u+w "%s"'%F)
            O = open(F,'w')
        O.write("#!/usr/bin/env python\n"+Y)
        O.close()
==========================================================


I'm not a Python guru, but the first 12 lines seem to just try to check if "sage-sage" can be opened for reading. Is it me, or is that Python overly complicated?

I could easily do with:

if [ -r "sage-sage" ]

in a shell script.

I'd have to try to work out what the rest of this Python does, but at only 29 lines, I doubt it would be hard to rewrite this as a more portable shell script.

It looks like it creates the pyton script at the end, with the contents of just "#!/usr/bin/env python"



Dave

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

Reply via email to