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

@ -154,8 +154,8 @@ aliases:
run:
name: check tools/provision error message on xenial
command: |
! tools/provision > >(tee provision.out)
grep -Fqx 'CRITICAL:root:Unsupported platform: ubuntu 16.04' provision.out
! tools/provision 2> >(tee provision.err >&2)
grep -Fqx 'Error: ubuntu 16.04 is no longer a supported platform for Zulip.' provision.err
- &check_xenial_upgrade_error
run:

View File

@ -104,12 +104,6 @@ elif vendor == "centos" and os_version == "7":
POSTGRES_VERSION = "10"
else:
logging.critical("Unsupported platform: %s %s", vendor, os_version)
if vendor == 'ubuntu' and os_version == '14.04':
print()
print("Ubuntu Trusty reached end-of-life upstream and is no longer a supported platform for Zulip")
if os.path.exists('/home/vagrant'):
print("To upgrade, run `vagrant destroy`, and then recreate the Vagrant guest.\n")
print("See: https://zulip.readthedocs.io/en/latest/development/setup-vagrant.html")
sys.exit(1)
VENV_DEPENDENCIES = get_venv_dependencies(vendor, os_version)

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'