Ask Your Question
0

When would sage -sh not work?

asked 2011-08-24 14:49:59 +0100

kcrisman gravatar image

updated 2011-08-24 14:54:33 +0100

When is ./sage -sh NOT supposed to work? That is, where should this work in the spkg build process? My sense is that it should work almost immediately - even before Python, right? - but sometimes I get the message about it not working in the middle of a build I need to ./sage -sh in to set environment variables correctly.

I should point out that currently I have a lot of stuff built - Python, Pari, GSL, ecl, elliptic curves - but when I do what the message says (edit $SAGE_ROOT in ./sage) then I just get a message about sage-sage not existing in local/bin, which it is true, it does not.

An acceptable answer to this could include any other way to set the appropriate variables during a build.

edit retag flag offensive close merge delete

Comments

Which spkgs give these messages? If they really need "sage -sh" to work, then they should be changed so that they have the scripts spkg as a prerequisite in SAGE_ROOT/spkg/standard/deps.

John Palmieri gravatar imageJohn Palmieri ( 2011-08-24 23:24:14 +0100 )edit

Oh, I think nearly ALL of them do! That's in the standard error message when an spkg fails to build.

kcrisman gravatar imagekcrisman ( 2011-08-25 13:50:48 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2011-08-24 21:22:49 +0100

benjaminfjones gravatar image

updated 2011-08-25 14:26:44 +0100

The script at $SAGE_ROOT/local/bin/sage-env sets the shell environment up for building spks's. Here's what it reads at the top:

###########################################################################
#
#  Set environment variables for building and/or running Sage.
#  You must *source* this instead of executing; see below!
#
#  AUTHORS:   William Stein                            2005-12
#             David Kirkby <david.kirkby@onetel.net>   2005-12-17
#
###########################################################################

##########################################################################
#
#  If you want to set all environment variables for your shell like
#  they are during the build of Sage packages, type
#
#             source local/bin/sage-env
#
#  from the SAGE_ROOT directory.   To do the same from a /bin/bash
#  script use ". local/bin/sage-env".
#
##########################################################################

Note that you should run source local/bin/sage-env from $SAGE_ROOT for it to work.

Essentially, sage -sh calls your shell (say /bin/bash) with an option to prevent loading of the user's .profile or rc file (for /bin/bash it runs the shell without sourcing .profile, .bash_profile, .bashrc) to ensure that the paths are correct. If you are using Bash, then running ./sage -sh from $SAGE_ROOT should be equivalent to doing:

> /bin/bash --norc
> source local/bin/sage-env
edit flag offensive delete link more

Comments

What would the difference between this and `sage -sh` be?

kcrisman gravatar imagekcrisman ( 2011-08-24 22:32:09 +0100 )edit

Essentially, sage -sh calls your shell (say /bin/bash) with an option to prevent loading of the user's .profile or .XXXrc file (for /bin/bash it runs the shell without sourcing .profile, .bash_profile, .bashrc) to ensure that the paths are correct. If you are using Bash, then running `./sage -sh` from `$SAGE_ROOT` should be equivalent to doing: `/bin/bash --norc; source local/bin/sage-env`

benjaminfjones gravatar imagebenjaminfjones ( 2011-08-24 22:53:11 +0100 )edit

Note also that sage-env is in SAGE_ROOT/spkg/base, so it is there right at the start of the Sage installation.

John Palmieri gravatar imageJohn Palmieri ( 2011-08-24 23:22:45 +0100 )edit

Okay, this at least clears up most of what I wanted to know. @benjaminfjones, can you add that info to the main answer so that others could find it more easily?

kcrisman gravatar imagekcrisman ( 2011-08-25 13:47:33 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-08-24 14:49:59 +0100

Seen: 712 times

Last updated: Aug 25 '11