[FIX] base: ensure python version >= 3.5

Odoo 12.0 does *not* officially support any python version below 3.5,
but no effort had been made to gracefully announce this to the end user
if they were to run Odoo in an unsupported python version.

This is done because Odoo 12.0 uses py3-only constructs which can
and will raise different errors if ran in python 2.

With this patch, Odoo will display an appropriate error message and won't
launch at all unless it is being run with python 3.5 or greater.

closes odoo/odoo#28502
This commit is contained in:
Adrian Torres
2018-11-08 11:53:35 +00:00
parent 7a0fb3de1e
commit 2824efee4b
+5 -1
View File
@@ -3,17 +3,21 @@
""" OpenERP core library."""
#----------------------------------------------------------
# odoo must be a namespace package for odoo.addons to become one too
# https://packaging.python.org/guides/packaging-namespace-packages/
#----------------------------------------------------------
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
# As of version 12.0, python 2 is no longer supported, ensure py version is >= 3.5
import sys
assert sys.version_info > (3, 5), "Python 2 detected, Odoo requires Python >= 3.5 to run."
#----------------------------------------------------------
# Running mode flags (gevent, prefork)
#----------------------------------------------------------
# Is the server running with gevent.
import sys
evented = False
if len(sys.argv) > 1 and sys.argv[1] == 'gevent':
sys.argv.remove('gevent')