provision: Check for old Ubuntu or Python before starting Python.

This unblocks us from being able to use Python 3.6 syntax in
provision.py and its dependencies.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-09-02 15:29:59 -07:00
committed by Tim Abbott
parent c1618c16c1
commit 424b441bb1
3 changed files with 23 additions and 8 deletions

View File

@@ -10,6 +10,27 @@ if [ "$EUID" -eq 0 ]; then
exit 1
fi
os="$(. /etc/os-release && echo "$ID $VERSION_ID")"
case "$os" in
'ubuntu 14.04' | 'ubuntu 16.04')
echo "Error: $os is no longer a supported platform for Zulip." >&2
if [ -e /home/vagrant ]; then
# shellcheck disable=SC2016
echo 'To upgrade, run `vagrant destroy`, and then recreate the Vagrant guest.' >&2
echo 'See: https://zulip.readthedocs.io/en/latest/development/setup-vagrant.html' >&2
fi
exit 1
;;
esac
python_version="$(python3 --version)"
case "$python_version" in
Python\ 3.[0-5].*)
echo 'Error: Zulip requires an OS with Python 3.6 or later.' >&2
exit 1
;;
esac
FAIL='\033[91m'
WARNING='\033[93m'
ENDC='\033[0m'