logilab-common #122443 Support __path__ in modutils [validation pending]

As per the following docs:

http://docs.python.org/2/tutorial/modules.html#packages-in-multiple-directories

python packages (__init__.py files) can update their __path__ variable to contain a list of different directories. This allows developers to have different parts of their package live in different directories.

The function _module_file() in modutils.py, when handling package files, assumes that the "path = [mp_filename]" (line 636). This could support the __path__ mechanism by loading the module and then setting "path = module.__path__".

The following patch has been tested and works as intended.

608a609
> mod0 = modpath[0]
610c611
< _, mp_filename, mp_desc = find_module(modpath[0], path)
---
> mp_file, mp_filename, mp_desc = find_module(modpath[0], path)
636c637,638
< path = [mp_filename]
---
> module = load_module(mod0, mp_file, mp_filename, mp_desc)
> path = module.__path__

prioritynormal
typeenhancement
done in1.0.0
load1.000
load left0.000
closed by#5e15c1218a55 [modutils] Add basic support for namespace packages
patch[modutils] Add basic support for namespace packages [applied]