Hi, in fact, I have been considering the usage of "$SAGE_LOCAL/toolchain/toolchain-env", but it is not in the "right place" in "sage-env" (the "PATH" is set but the "LD_LIBRARY_PATH", "CPATH", "MULTI_ARCH" are not; even if one sets some variables, like "PYTHONPATH", they will be overwritten; if one needs any user's setting from "$DOT_SAGE/sagerc", then it has not been sourced yet; moreover it might become difficult to maintain it if several packages need to be added and the initialization needs to be performed in a specific order).
However, fortunately you are not right that the "${SAGE_LOCAL}/toolchain/" will not be stored in a binary distribution. In fact everything that resides in "${SAGE_LOCAL}" will be copied (I create a "${SAGE_LOCAL}/extra/" subdirectory where I keep my new binary packages, for example, and fortunately they get copied when I try "./sage --bdist"). So, please find attached my proposal ... "sage-env.sage-5.7.patch". It should be "flexible" enough to cover a wide range of possible situations. The modified "sage-env" script looks TWICE into the "${SAGE_LOCAL}/toolchain/" subdirectory. The first time, right after all important variables have been set (PATH, LD_LIBRARY_PATH, CPATH, MULTI_ARCH) it searches for any "pre-??-env-*" shell scripts. The second time, in the end of the "sage-env" script, after the "$DOT_SAGE/sagerc" has been sourced, it searches for any "post-??-env-*" shell scripts. What's the trick with these two "??" characters? Well, assume you have two packages which both need initialization but you must make sure that they will be initialized in a specific order ... so ... you can create something like: pre-10-env-PackageOne pre-20-env-PackageTwo post-10-env-PackageOne post-20-env-PackageTwo and then "*-10-*" scripts will be executed prior to "*-20-*" scripts (instead of two digits one might simply use two letters, like "*-AA-*", "*-AB-*", of course.) Of course, for any package, you may have just one single script, a "pre-*" or a "post-*" one (no need to provide both of them). For backwards compatibility reasons, I did not touch the original "${SAGE_LOCAL}/toolchain/toolchain-env" logic. Hope it helps, Best regards, Jacek. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
--- sage-env.orig 2013-02-19 13:49:55.000000000 +0100 +++ sage-env 2013-02-25 18:06:00.124016125 +0100 @@ -267,6 +267,15 @@ CPATH="${CPATH}:/usr/include/$MULTI_ARCH" fi +# Source any "${SAGE_LOCAL}/toolchain/pre-??-env-*" scripts. +if [ -d "${SAGE_LOCAL}/toolchain" ] ; then + for f in ${SAGE_LOCAL}/toolchain/pre-??-env-* ; do + [ ! -e "${f}" ] && continue # skip nonexistent files + # echo "sage-env ... sourcing ... ${f}" + source "${f}" + done +fi + # For PARI/GP GP_DATA_DIR="$SAGE_LOCAL/share/pari" && export GP_DATA_DIR GPHELP="$SAGE_LOCAL/bin/gphelp" && export GPHELP @@ -605,3 +614,12 @@ exit 1 fi fi + +# Source any "${SAGE_LOCAL}/toolchain/post-??-env-*" scripts. +if [ -d "${SAGE_LOCAL}/toolchain" ] ; then + for f in ${SAGE_LOCAL}/toolchain/post-??-env-* ; do + [ ! -e "${f}" ] && continue # skip nonexistent files + # echo "sage-env ... sourcing ... ${f}" + source "${f}" + done +fi