[MERGE] use an import hook instead of appending to sys.path.
This replaces sys.path mutation with an import hook. It removes the clash
between our own 'resource' addons and the standard Python resource module. It
provides a transition between our current practice and a cleaner
'openerp.addons' namespace.
The import hook makes it possible to either 'import openerp.addons.hr' or
'import hr' in the addons (ie. both paths are set in sys.modules). When trying
to import an already existing (non-openerp) Python module (e.g. resource), it
will indeed load the Python module and print a warning (to invite you to use
openerp.addons.resource if this is the one you want).
Unfortunately, the import hook doesn't support self-referential imports. E.g.
hr.wizard.xxx can't use 'import hr.yyy' or 'from hr import yyy'. Python will
fail to load hr with cryptic error messages or even a segmentation fault.
Beginning with this patch, 'import openerp.addons.xxx' is the way to go,
'import xxx' is deprecated. Once 'import xxx' support can be removed, we will
probably support pkgutil or setuptool namespaces.
bzr revid: vmt@openerp.com-
20120118104505-tns626ga47dwl7it