Skip to content

Instantly share code, notes, and snippets.

@steingrd
Created September 15, 2010 15:45
Show Gist options
  • Save steingrd/580931 to your computer and use it in GitHub Desktop.
Save steingrd/580931 to your computer and use it in GitHub Desktop.
Check setup.py config by installing a package to a temp virtualenv
#!/bin/bash
function check_setuppy_exists() {
if [ ! -e setup.py ]; then
echo "missing setup.py, aborting";
exit 1;
fi
}
function create_virtualenv() {
echo "creating virtualenv in $1"
virtualenv $1 > /dev/null
}
function activate_virtualenv() {
echo "activating virtualenv in $1"
source $1/bin/activate > /dev/null
}
TMPDIR=$HOME/Temporary
ENVDIR=$TMPDIR/distenv
rm -fr $ENVDIR
check_setuppy_exists
create_virtualenv $ENVDIR
activate_virtualenv $ENVDIR
echo "building source distribution"
# runs python setup.py sdist and captures dist file
python setup.py clean > /dev/null
DISTFILE="$(python setup.py sdist | grep gzip | cut -d '/' -f2).gz"
echo "trying to install with easy_install"
echo "-------------------------------------------------------------"
easy_install dist/$DISTFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment