#!/usr/bin/env bash if [ $# -ne 2 ]; then echo "Usage: $0 <SAGE_VERSION> <SAGE_ROOT>" echo "Build SAGE source code package." exit 0 fi SAGE_VERSION=$1 SAGE_ROOT=$2 PATH=$SAGE_ROOT/local/bin/:$PATH export PATH SAGE_VERSION SAGE_ROOT if [ -e tmp ]; then rm -rf tmp fi mkdir tmp if [ ! -d dist ]; then mkdir dist fi CUR=`pwd` # Remove the doctest cache files. rm -rf */.doctest */*/.doctest */*/*/.doctest */*/*/*/.doctest */*/*/*/*/.doctest */*/*/*/*/*/.doctest rm -rf */.doctest* */*/.doctest* */*/*/.doctest* */*/*/*/.doctest* */*/*/*/*/.doctest* */*/*/*/*/*/.doctest* cp -pr MANIFEST.in README* install doc sage sage-push pull setup.py module_list.py spkg-* .hg .hgtags .hgignore bundle export build.py clib.py sagebuild.py spkg-delauto c_lib debian tmp/ cd tmp/ rm -rf c_lib/*.so c_lib/*.os c_lib/*/*.os c_lib/*/*/*.os if [ $? -ne 0 ]; then echo "Error deleting c_lib temp files" fi # Remove the .cython_hash file, since including this in the bdist will # completely break "sage -br". # Also, do not distribute these build files (.os and .os); # it wastes space and causes problems! rm -f .cython_hash c_lib/*.so c_lib/*.os # Delete all the autogenerated files, since they will get created again # when SAGE is built or upgraded. cd sage; "$CUR"/spkg-delauto .; cd .. # Create the sdist using Python's distutils. python setup.py sdist # Recompress it in bz2 format, which is better. cd dist gunzip sage-$SAGE_VERSION.tar.gz bzip2 -f sage-$SAGE_VERSION.tar mv sage-$SAGE_VERSION.tar.bz2 ../../dist/sage-$SAGE_VERSION.spkg # Delete the tmp directory. cd ../.. rm -rf tmp