9. Creating a SAGE Package

Here's how to make your own SAGE package.

For example, the location of GAP is $SAGE_ROOT/local/lib/gap-4.4.6/. Thus to install gap code you have to copy it there. You should check that the directory with the given version your package is created for exists, e.g., with the following code:

if [ ! -d $SAGE_ROOT/local/lib/gap-4.4.6 ]; then
    echo "This package requires that GAP 4.4.6 is installed."
    exit 1
fi

Do not just copy to $SAGE_ROOT/local/lib/gap*/ since that will copy your package to the lib directory of the old version of GAP if GAP is upgraded.

External Magma code goes in $SAGE_ROOT/data/extcode/magma/user, so if you want to redistribute Magma code with SAGE as a package that Magma-enabled users can use, that's where you'd put it. You'd also want to have relevant Python code to make the Magma code easily useable.

Example: These instructions provide directions for creating a particular SAGE package.

To test this, within the sagefiles directory (or whatever directory contains guava-2.4.spkg), type

<path>sage -i guava-2.4.spkg
It should install and compile the guava program in sage. Test it:

sage: gap('LoadPackage("guava")')          # requires optional package
true
sage: gap('HammingCode(3,3)')              # requires optional package
a linear [13,10,3]1 Hamming (3,3) code over GF(3)

To build again if you've already installed the package, use

<path>sage -f guava-2.4.spkg

See About this document... for information on suggesting changes.