commit dc30f7572d8da06377ec8029ccc58f3bde54ea48 Author: Isis Lovecruft isis@torproject.org Date: Thu Mar 26 05:26:06 2015 +0000
Add install-dependencies script and use it for .travis.yml install. --- .travis.yml | 4 +--- scripts/install-dependencies | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/.travis.yml b/.travis.yml index 75f8857..7cda131 100644 --- a/.travis.yml +++ b/.travis.yml @@ -59,9 +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 - - pip install -q --no-use-wheel Twisted==$TWISTED_VERSION pyOpenSSL==$PYOPENSSL_VERSION + - TWISTED_VERSION=$TWISTED_VERSION PYOPENSSL_VERSION=$PYOPENSSL_VERSION ./scripts/install-dependencies - make install
# Start a BridgeDB instance before running the tests: diff --git a/scripts/install-dependencies b/scripts/install-dependencies new file mode 100755 index 0000000..0093700 --- /dev/null +++ b/scripts/install-dependencies @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +set -x -- + +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} realpath" +else + 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} + +# When running on Travis, be sure that environment variables are passed from +# .travis.yml to this script: +if [ "$TRAVIS" == "true" ] ; then + $PIP install $PIP_FLAGS -r "$HERE/../.travis.requirements.txt" + $PIP install $PIP_FLAGS "Twisted==$TWISTED_VERSION" "pyOpenSSL==$PYOPENSSL_VERSION" +else + $PIP install $PIP_FLAGS -r "$HERE/../requirements.txt" +fi