summaryrefslogtreecommitdiff
path: root/odoo/__init__.py
diff options
context:
space:
mode:
authorAdrian Torres <adt@odoo.com>2018-11-08 11:11:07 +0000
committerAdrian Torres <adt@odoo.com>2018-11-08 11:53:35 +0000
commit2824efee4be08e01d553c0af296ba836ee486823 (patch)
tree763c35fab347dc1190f99d96b4ae08cf802fcf04 /odoo/__init__.py
parent7a0fb3de1ebaf9aa9a719d0a165827303f563a85 (diff)
[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
Diffstat (limited to 'odoo/__init__.py')
-rw-r--r--odoo/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/odoo/__init__.py b/odoo/__init__.py
index f9e2db590f6..6bfe00b8499 100644
--- a/odoo/__init__.py
+++ b/odoo/__init__.py
@@ -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')