[FIX] core: using absolute paths
Start odoo-bin using a tier module (like `python3 -m pdb odoo-bin`), the odoo/addons __path__ contains the relative link to the modules instead of the absolute link like when directly started (`python3 odoo-bin`). This cause trouble importing modules because it reuses the relative path from within other directories. closes odoo/odoo#39182 X-original-commit: 941e051fc6b33e7a90400c77d63d589049b027a6 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
+6
-1
@@ -8,7 +8,12 @@
|
||||
# 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__)
|
||||
import pkgutil
|
||||
import os.path
|
||||
__path__ = [
|
||||
os.path.abspath(path)
|
||||
for path in pkgutil.extend_path(__path__, __name__)
|
||||
]
|
||||
|
||||
import sys
|
||||
assert sys.version_info > (3, 6), "Outdated python version detected, Odoo requires Python >= 3.6 to run."
|
||||
|
||||
@@ -17,4 +17,9 @@ Importing them from here is deprecated.
|
||||
# make odoo.addons a namespace package, while keeping this __init__.py
|
||||
# present, for python 2 compatibility
|
||||
# https://packaging.python.org/guides/packaging-namespace-packages/
|
||||
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
|
||||
import pkgutil
|
||||
import os.path
|
||||
__path__ = [
|
||||
os.path.abspath(path)
|
||||
for path in pkgutil.extend_path(__path__, __name__)
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user