2016-04-27 09:34:17 +02:00
|
|
|
#!/bin/bash
|
2016-05-30 15:46:26 +02:00
|
|
|
set -e
|
2016-04-27 09:34:17 +02:00
|
|
|
|
|
|
|
# This script installs a python3 virtualenv called 'zulip-py3-venv' in zulip's parent directory.
|
|
|
|
# It then installs mypy and some other dependencies into that virtualenv.
|
|
|
|
# This script has been written for Ubuntu. If you want to install it on some other distro
|
|
|
|
# replace these commands with the corresponding commands for your distro.
|
|
|
|
# (for e.g. on Fedora replace apt-get with yum or dnf)
|
|
|
|
|
|
|
|
TOOLS_DIR=$(dirname "$0")
|
|
|
|
PY3_VENV_PATH="/srv/zulip-py3-venv"
|
|
|
|
|
|
|
|
if ! which python3 >/dev/null || ! which virtualenv >/dev/null; then
|
|
|
|
if which apt-get; then
|
|
|
|
sudo apt-get install -y python3 python-virtualenv
|
|
|
|
else
|
|
|
|
echo "Please install python3 and python-virtualenv."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create venv if required
|
|
|
|
if [ -d "$PY3_VENV_PATH" ]; then
|
|
|
|
echo "found virtualenv $PY3_VENV_PATH"
|
|
|
|
else
|
|
|
|
echo "creating virtualenv $PY3_VENV_PATH"
|
|
|
|
sudo virtualenv -p python3 "$PY3_VENV_PATH"
|
|
|
|
fi
|
|
|
|
source "$PY3_VENV_PATH/bin/activate"
|
|
|
|
|
|
|
|
# install mypy
|
|
|
|
sudo "$PY3_VENV_PATH/bin/pip3" install --upgrade pip
|
2016-06-19 00:56:58 +02:00
|
|
|
sudo "$PY3_VENV_PATH/bin/pip3" install --upgrade --no-deps -r "$TOOLS_DIR/../requirements/mypy.txt"
|