Skip to content

Commit

Permalink
Add install-dependencies script and use it for .travis.yml install.
Browse files Browse the repository at this point in the history
  • Loading branch information
isislovecruft committed Mar 26, 2015
1 parent 25e6543 commit 2c9bc88
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -59,8 +59,7 @@ before_install:
- chmod -R og-w $PYTHON_EGG_CACHE

install:
- sudo apt-get install -qq --no-install-suggests --no-install-recommends build-essential openssl sqlite3 python-dev python-setuptools libgeoip-dev geoip-database
- pip install -q --no-use-wheel -r .travis.requirements.txt
- ./scripts/install-dependencies
- pip install -q --no-use-wheel Twisted==$TWISTED_VERSION pyOpenSSL==$PYOPENSSL_VERSION
- make install

Expand Down
38 changes: 38 additions & 0 deletions scripts/install-dependencies
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

set -x --

# $1 should be $TWISTED_VERSION from .travis.yml
# $2 should be $PYOPENSSL_VERSION from .travis.yml

SUDO=
APT_GET=$(which apt-get)
APT_FLAGS='-q --no-install-suggests --no-install-recommends'
PIP=$(which pip)
PIP_FLAGS='--no-use-wheel'
DEPENDS="build-essential openssl sqlite3 python-dev python-setuptools"
DEPENDS="${DEPENDS} libgeoip-dev geoip-database libjpeg-dev"
HERE=$(dirname $0)

if [ "$EUID" != "0" ] ; then SUDO=$(which sudo); fi
# pip is pre-installed on Travis-CI machines in their Python environment, so
# we should avoid reinstalling it (as that might do odd things to the
# virtualenv that we're already inside):
if [ "$TRAVIS" != "true" ] ; then
DEPENDS="${DEPENDS} python-pip"
fi

MISSING=""
for dep in $DEPENDS ; do
if ! test "$(dpkg -l $dep | grep \"ii $dep\")" ; then
MISSING="${MISSING} $dep"
fi
done

$SUDO $APT_GET install ${APT_FLAGS} ${MISSING}

if [ "$TRAVIS" == "true" ] ; then
$PIP install $PIP_FLAGS -r "$HERE/../.travis.requirements.txt"
else
$PIP install $PIP_FLAGS -r "$HERE/../requirements.txt"
fi

0 comments on commit 2c9bc88

Please sign in to comment.