Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

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

Anders Kaseorg424b441bb174
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 4f05b83127e..b5167c3032e 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -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:
diff --git a/tools/lib/provision.py b/tools/lib/provision.py
index 2b4d08feba7..d75b5e00578 100755
--- a/tools/lib/provision.py
+++ b/tools/lib/provision.py
@@ -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)
diff --git a/tools/provision b/tools/provision
index 169e446f271..5efce999459 100755
--- a/tools/provision
+++ b/tools/provision
@@ -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'