| Index: recipe_engine/loader.py
|
| diff --git a/recipe_engine/loader.py b/recipe_engine/loader.py
|
| index 8f26265d4b94af2897448db6f2149525a73803f6..b27f454e6f2bff98f5cc28d23f554aa2be51e97c 100644
|
| --- a/recipe_engine/loader.py
|
| +++ b/recipe_engine/loader.py
|
| @@ -345,39 +345,26 @@ def _load_recipe_module_module(path, universe_view):
|
| # Prevent any modules that mess with sys.path from leaking.
|
| with env.temp_sys_path():
|
| sys.modules['%s.DEPS' % fullname] = mod.LOADED_DEPS
|
| - _recursive_import(
|
| - path, '%s.%s' % (RECIPE_MODULE_PREFIX, universe_view.package.name))
|
| + _load_recipe_module_files(path, mod, fullname)
|
| _patchup_module(modname, mod, universe_view)
|
|
|
| return mod
|
|
|
|
|
| -def _recursive_import(path, prefix):
|
| - modname = os.path.splitext(os.path.basename(path))[0]
|
| - fullname = '%s.%s' % (prefix, modname)
|
| - mod = _find_and_load_module(fullname, modname, path)
|
| - if not os.path.isdir(path):
|
| - return mod
|
| -
|
| +def _load_recipe_module_files(path, mod, prefix):
|
| for subitem in os.listdir(path):
|
| - subpath = os.path.join(path, subitem)
|
| - subname = os.path.splitext(subitem)[0]
|
| - if os.path.isdir(subpath):
|
| - if not os.path.exists(os.path.join(subpath, '__init__.py')):
|
| - continue
|
| - elif not subpath.endswith('.py') or subitem.startswith('__init__.py'):
|
| - continue
|
| -
|
| - submod = _recursive_import(subpath, fullname)
|
| -
|
| - if not hasattr(mod, subname):
|
| - setattr(mod, subname, submod)
|
| - else:
|
| - prev = getattr(mod, subname)
|
| - assert submod is prev, (
|
| - 'Conflicting modules: %s and %s' % (prev, mod))
|
| -
|
| - return mod
|
| + if subitem in ('api.py', 'test_api.py') or subitem.endswith('config.py'):
|
| + subpath = os.path.join(path, subitem)
|
| + subname = os.path.splitext(subitem)[0]
|
| + fullname = '%s.%s' % (prefix, subname)
|
| + submod = _find_and_load_module(fullname, subname, subpath)
|
| +
|
| + if not hasattr(mod, subname):
|
| + setattr(mod, subname, submod)
|
| + else:
|
| + prev = getattr(mod, subname)
|
| + assert submod is prev, (
|
| + 'Conflicting modules: %s and %s' % (prev, mod))
|
|
|
|
|
| def _patchup_module(name, submod, universe_view):
|
|
|