diff --git a/odoo-bin b/odoo-bin index c417b226d87..b2a0e17ff83 100755 --- a/odoo-bin +++ b/odoo-bin @@ -1,6 +1,6 @@ #!/usr/bin/env python +__import__('pkg_resources').declare_namespace('odoo.addons') import odoo if __name__ == "__main__": odoo.cli.main() - diff --git a/odoo/addons/__init__.py b/odoo/addons/__init__.py index 8f2c331e5c0..d3a3e7e9ba2 100644 --- a/odoo/addons/__init__.py +++ b/odoo/addons/__init__.py @@ -14,3 +14,4 @@ This module also conveniently reexports some symbols from odoo.modules. Importing them from here is deprecated. """ +__import__('pkg_resources').declare_namespace(__name__) 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()) diff --git a/odoo/tools/config.py b/odoo/tools/config.py index c400f61531b..07af83e7e3e 100644 --- a/odoo/tools/config.py +++ b/odoo/tools/config.py @@ -87,7 +87,7 @@ class configmanager(object): self.config_file = fname self._LOGLEVELS = dict([ - (getattr(loglevels, 'LOG_%s' % x), getattr(logging, x)) + (getattr(loglevels, 'LOG_%s' % x), getattr(logging, x)) for x in ('CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET') ]) @@ -427,7 +427,7 @@ class configmanager(object): elif isinstance(self.options[arg], basestring) and self.casts[arg].type in optparse.Option.TYPE_CHECKER: self.options[arg] = optparse.Option.TYPE_CHECKER[self.casts[arg].type](self.casts[arg], arg, self.options[arg]) - self.options['root_path'] = os.path.abspath(os.path.expanduser(os.path.expandvars(os.path.dirname(odoo.__file__)))) + self.options['root_path'] = os.path.abspath(os.path.expanduser(os.path.expandvars(os.path.join(os.path.dirname(__file__), '..')))) if not self.options['addons_path'] or self.options['addons_path']=='None': default_addons = [] base_addons = os.path.join(self.options['root_path'], 'addons') diff --git a/setup/odoo b/setup/odoo index 3cd3358ee23..b2a0e17ff83 100644 --- a/setup/odoo +++ b/setup/odoo @@ -1,4 +1,5 @@ #!/usr/bin/env python +__import__('pkg_resources').declare_namespace('odoo.addons') import odoo if __name__ == "__main__":