Skip to content

Instantly share code, notes, and snippets.

@jseabold
Created March 23, 2012 20:16
Show Gist options
  • Save jseabold/2174544 to your computer and use it in GitHub Desktop.
Save jseabold/2174544 to your computer and use it in GitHub Desktop.
bootstrap installations that depend on numpy
#! /bin/bash
# edit this to install whatever you want that depends on numpy after you
# reinstall numpy
# edit these variables or add to them
npsrc="$HOME/src/numpy/"
spsrc="$HOME/src/scipy/"
pdsrc="$HOME/src/pandas/"
smsrc="$HOME/statsmodels/statsmodels/"
npversion="master"
spversion="master"
pdversion="master"
smversion="master"
cur_dir=`pwd`
function getd
{
echo `python -c "import os; exec(\"try: import $1; print os.path.dirname($1.__file__)\nexcept ImportError: print 0\")"`
} # returns the installed directory of a package
cleaninstall () # cleaninstall package_name package_src version
{
packagename=$1
packagesrc=$2
version=$3
dir_=`getd $packagename`
if [ $dir_ != 0 ]
then sudo rm -rf $dir_
fi
cd $packagesrc
git checkout $version
sudo rm -rf build
sudo rm -rf dist
sudo rm -rf *.egg-info
python setup.py build && python setup.py install
cd $cur_dir
}
cleaninstall numpy $npsrc $npversion
cleaninstall scipy $spsrc $spversion
cleaninstall pandas $pdsrc $pdversion
cleaninstall statsmodels $smsrc $smversion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment