sage-mode / spkg-install

#!/bin/sh

CUR=`pwd`

# Build and install Python support files
cd src/
python setup.py build

if [ $? -ne 0 ]; then
    echo "Failure to build sage-mode Python support files"
    exit 1
fi

python setup.py install

if [ $? -ne 0 ]; then
    echo "Failure to install sage-mode Python support files"
    exit 1
fi

# Copy emacs lisp to SAGE_DATA, and print helpful instructions
cd "$CUR"
rm -rf $SAGE_DATA/emacs
cp -r emacs $SAGE_DATA/emacs

# Remove old elc files if any.
# Then, even if byte compiling fails, they won't taint the setup.
rm -f $SAGE_DATA/emacs/*.elc

# Byte compile -- this can fail since we don't require emacs for Sage
EMACS=${EMACS-emacs}
$EMACS -batch 2> /dev/null > /dev/null
if [ $? -ne 0 ]; then
    echo
    echo WARNING: Could not find emacs at "'$EMACS'"
    echo "Set the EMACS environment variable or ignore this if you don't have emacs installed"

else

    echo Byte compiling sage-mode with "'$EMACS'"
    echo Set the EMACS environment variable to compile with a different emacs.
    $EMACS -batch -L $SAGE_DATA/emacs/ -f batch-byte-compile $SAGE_DATA/emacs/*.el

    # Trick the shell into expanding $SAGE_DATA and $SAGE_ROOT
    sh -c "cat <<EOF
$(perl -ne 'print if (/Start .emacs/../End .emacs/)' SPKG.txt)
EOF"

fi
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.