Skip to content

Instantly share code, notes, and snippets.

@mikelambert
Created March 12, 2016 23:00
Show Gist options
  • Save mikelambert/1deeb8f2f7b4fcda1dd7 to your computer and use it in GitHub Desktop.
Save mikelambert/1deeb8f2f7b4fcda1dd7 to your computer and use it in GitHub Desktop.
Auto-build and deploy eggs to scrapinghub
#!/bin/bash
# Should be called with "shub_add_egg.sh PROJECT_ID PIP_PACKAGE_NAME"
#
set -e
cd $(mktemp -d)
PIP_OUTPUT=$(pip download $2)
TAR_GZ=$(echo $PIP_OUTPUT | grep -o "[^ ]*.tar.gz" | head -1)
tar xzf $TAR_GZ
cd $(dirname $(find . -name 'setup.py'))
BDIST_OUTPUT=$(python setup.py bdist_egg)
BDIST_FILE=$(echo $BDIST_OUTPUT | sed "s/.*creating '\([^']*\)'.*/\1/")
REAL_BDIST_FILE="$(pwd)/$BDIST_FILE"
NAME=$(python setup.py --name)
VERSION=$(python setup.py --version)
shubc eggs-add $0 "$REAL_BDIST_FILE" name "$NAME" version "$VERSION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment