Avoid giving out bridges with broken tor versions.
[tor-bridgedb.git] / scripts / install-dependencies
blob923b51ed3e76f02c825a42574f5017311260cd3c
1 #!/usr/bin/env bash
3 set -x --
5 SUDO=
6 APT_GET=$(which apt-get)
7 APT_FLAGS='-q --no-install-suggests --no-install-recommends'
8 PIP=$(which pip)
9 PIP_FLAGS='--no-binary :all'
11 DEPENDS="build-essential openssl sqlite3 python-dev python-setuptools"
12 DEPENDS="${DEPENDS} libgeoip-dev geoip-database libjpeg-dev"
13 HERE=$(dirname $0)
15 if [ "$EUID" != "0" ] ; then SUDO=$(which sudo); fi
16 # pip is pre-installed on Travis-CI machines in their Python environment, so
17 # we should avoid reinstalling it (as that might do odd things to the
18 # virtualenv that we're already inside):
19 if [ "$TRAVIS" == "true" ] ; then
20 DEPENDS="${DEPENDS} realpath"
21 else
22 DEPENDS="${DEPENDS} python-pip flog"
25 MISSING=""
26 for dep in $DEPENDS ; do
27 if ! test "$(dpkg -l $dep | grep \"ii $dep\")" ; then
28 MISSING="${MISSING} $dep"
30 done
32 $SUDO $APT_GET install ${APT_FLAGS} ${MISSING}
34 # When running on Travis, we are installing a few extra packages, e.g., to
35 # determine code coverage.
36 if [ "$TRAVIS" == "true" ] ; then
37 $PIP install $PIP_FLAGS -r "$HERE/../.travis.requirements.txt"
38 else
39 $PIP install $PIP_FLAGS -r "$HERE/../requirements.txt"