summaryrefslogtreecommitdiff
path: root/odoo/modules/module.py
diff options
context:
space:
mode:
author=?UTF-8?q?St=C3=A9phane=20Bidoul=20=28ACSONE=29?= <stephane.bidoul@acsone.eu>2016-09-27 12:00:44 +0200
committerSimon Lejeune <sle@openerp.com>2016-09-30 12:05:49 +0200
commit389c2ba97ba83dea01949d2a3cad295bd710d9ef (patch)
tree9505bb68bce48a29df770936a25fe49744dbcca9 /odoo/modules/module.py
parentffd3c513ed3178fc87a79b9244ef5967d5ebcdef (diff)
[REF] packaging: make odoo a namespaced package
by auto-extending addons path with odoo.addons.__path__. This patch also introduce * an explicit declaration of odoo.addons as a namespace package This is necessary because the standard way of declaring namespace packages in setup.py does not work as long as odoo/__init__.py contains code. * a more reliable way to find odoo root path.
Diffstat (limited to 'odoo/modules/module.py')
-rw-r--r--odoo/modules/module.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/odoo/modules/module.py b/odoo/modules/module.py
index 77fb1433d13..ed4318d9641 100644
--- a/odoo/modules/module.py
+++ b/odoo/modules/module.py
@@ -141,6 +141,12 @@ def initialize_sys_path():
if base_path not in ad_paths:
ad_paths.append(base_path)
+ # add odoo.addons.__path__
+ for ad in __import__('odoo.addons').addons.__path__:
+ ad = os.path.abspath(ad)
+ if ad not in ad_paths:
+ ad_paths.append(ad)
+
if not hooked:
sys.meta_path.append(AddonsHook())
sys.meta_path.append(OdooHook())