/
install-dependencies
executable file
·40 lines (34 loc) · 1.21 KB
/
install-dependencies
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 flog"
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