Skip to content
Snippets Groups Projects
Commit 941e051f authored by Julien Castiaux's avatar Julien Castiaux
Browse files

[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#39164

Signed-off-by: default avatarXavier Dollé (xdo) <xdo@odoo.com>
parent 852ee32e
No related branches found
No related tags found
No related merge requests found
......@@ -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__)
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment