[sage-devel] Place .sage directory somewhere other than home?

2010-12-06 Thread Matthew Gwynne
Hi,

We are building sage as part of a development environment which we'd
like to be isolated (as much as possible) from the rest of the system,
and on which users might have system-wide versions of sage other than
the one we installed in this special environment.

Is it possible when compiling Sage, or as an option when running it,
to force it to always take a particular given directory as the
configuration .sage directory rather than creating it in the user's
home directory?

Thanks!

Matthew Gwynne

-- 
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


Re: [sage-devel] Place .sage directory somewhere other than home?

2010-12-06 Thread Minh Nguyen
Hi Matthew,

I'm not sure I understand your question correctly, but here goes...

On Mon, Dec 6, 2010 at 10:09 PM, Matthew Gwynne mathew.gwy...@gmail.com wrote:
 Is it possible when compiling Sage, or as an option when running it,
 to force it to always take a particular given directory as the
 configuration .sage directory rather than creating it in the user's
 home directory?

Yes to both when building Sage and when running the (pre)compiled
version. The Sage environment variable you want is DOT_SAGE, which
defaults to the home directory of the user building/running Sage, i.e.

$HOME/.sage/

When compiling Sage, you can set .sage to be a directory other than
$HOME/.sage/. You merely set DOT_SAGE to a directory of your choice
and export that variable. For example,

$ DOT_SAGE=/tmp/username/dot_sage/; export DOT_SAGE

The environment variable DOT_SAGE can in general be used to set the
default directory from which Sage reads in its configuration files
when building/running. To get Sage to by default read configuration
files from another .sage directory, put the above line in your
$HOME/.bashrc or $HOME/.profile.

For example, my custom build script [1] has these lines:

if [ -d /tmp/mvngu/dot_sage/ ]; then
rm -rf /tmp/mvngu/dot_sage/
fi
DOT_SAGE=/tmp/mvngu/dot_sage/; export DOT_SAGE

and my .bashrc file has these lines:

if [ `uname -s` = Linux ]; then
# The Sage working directory .sage/
DOT_SAGE=/dev/shm/mvngu/dot_sage; export DOT_SAGE
fi

I use /tmp and /dev/shm for my .sage directories because those are
fast-ish directories to read from. Sage can take a long time to load,
and I want to speed up the loading as much as I can.


[1] http://sage.math.washington.edu/home/mvngu/apps/sageutil/build.sh

-- 
Regards
Minh Van Nguyen

-- 
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


Re: [sage-devel] Place .sage directory somewhere other than home?

2010-12-06 Thread Matthew Gwynne
Hi Minh,

This is exactly what I was looking for! Thanks!

The reason we want to specify a different directory is we have a
special Sage installation which we don't want to interfere with the
system-wide one. This installation is likely only to be used by a
single user (the user who installed our library) and so that shouldn't
be a problem.

Thanks again!

Matthew

On Mon, Dec 6, 2010 at 11:25 AM, Minh Nguyen nguyenmi...@gmail.com wrote:
 Hi Matthew,

 I'm not sure I understand your question correctly, but here goes...

 On Mon, Dec 6, 2010 at 10:09 PM, Matthew Gwynne mathew.gwy...@gmail.com 
 wrote:
 Is it possible when compiling Sage, or as an option when running it,
 to force it to always take a particular given directory as the
 configuration .sage directory rather than creating it in the user's
 home directory?

 Yes to both when building Sage and when running the (pre)compiled
 version. The Sage environment variable you want is DOT_SAGE, which
 defaults to the home directory of the user building/running Sage, i.e.

 $HOME/.sage/

 When compiling Sage, you can set .sage to be a directory other than
 $HOME/.sage/. You merely set DOT_SAGE to a directory of your choice
 and export that variable. For example,

 $ DOT_SAGE=/tmp/username/dot_sage/; export DOT_SAGE

 The environment variable DOT_SAGE can in general be used to set the
 default directory from which Sage reads in its configuration files
 when building/running. To get Sage to by default read configuration
 files from another .sage directory, put the above line in your
 $HOME/.bashrc or $HOME/.profile.

 For example, my custom build script [1] has these lines:

 if [ -d /tmp/mvngu/dot_sage/ ]; then
    rm -rf /tmp/mvngu/dot_sage/
 fi
 DOT_SAGE=/tmp/mvngu/dot_sage/; export DOT_SAGE

 and my .bashrc file has these lines:

 if [ `uname -s` = Linux ]; then
    # The Sage working directory .sage/
    DOT_SAGE=/dev/shm/mvngu/dot_sage; export DOT_SAGE
 fi

 I use /tmp and /dev/shm for my .sage directories because those are
 fast-ish directories to read from. Sage can take a long time to load,
 and I want to speed up the loading as much as I can.


 [1] http://sage.math.washington.edu/home/mvngu/apps/sageutil/build.sh

 --
 Regards
 Minh Van Nguyen


-- 
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