| Index: scripts/slave/recipe_loader.py
|
| diff --git a/scripts/slave/recipe_loader.py b/scripts/slave/recipe_loader.py
|
| index 76360d08cb9faa11da53a5007a4c2ad3d224a6fc..62dc0d76635f0a952b4f93df52ee793464c28f1d 100644
|
| --- a/scripts/slave/recipe_loader.py
|
| +++ b/scripts/slave/recipe_loader.py
|
| @@ -12,17 +12,10 @@ from .recipe_util import (ROOT_PATH, RECIPE_DIRS, MODULE_DIRS,
|
| cached_unary, scan_directory)
|
| from .recipe_api import RecipeApi, RecipeApiPlain
|
| from .recipe_config import ConfigContext
|
| -from .recipe_config_types import Path
|
| +from .recipe_config_types import Path, ModuleBasePath
|
| from .recipe_test_api import RecipeTestApi, DisabledTestData
|
|
|
|
|
| -# Keys MUST match base paths defined in recipe_modules/path/config.py.
|
| -MODULES_BASE_PATHS = {
|
| - 'build': os.path.join(ROOT_PATH, 'build'),
|
| - 'build_internal': os.path.join(ROOT_PATH, 'build_internal'),
|
| -}
|
| -
|
| -
|
| class NoSuchRecipe(Exception):
|
| """Raised by load_recipe is recipe is not found."""
|
|
|
| @@ -54,15 +47,6 @@ def load_recipe_modules(mod_dirs):
|
| Args:
|
| mod_dirs (list of str): list of module search paths.
|
| """
|
| - def get_module_directory(path):
|
| - """Path to a module as a string -> recipe_config_types.Path object."""
|
| - dir_path = os.path.dirname(os.path.abspath(path))
|
| - for key, base_path in MODULES_BASE_PATHS.iteritems():
|
| - if dir_path.startswith(base_path + os.path.sep):
|
| - suffix = dir_path[len(base_path)+1:].split(os.path.sep)
|
| - return Path(key, *suffix, _bypass=True)
|
| - raise AssertionError('Unexpected module path: %s' % (dir_path,))
|
| -
|
| def patchup_module(name, submod):
|
| """Finds framework related classes and functions in a |submod| and adds
|
| them to |submod| as top level constants with well known names such as
|
| @@ -73,7 +57,7 @@ def load_recipe_modules(mod_dirs):
|
| submodules to find subclasses of RecipeApi, RecipeTestApi, etc.
|
| """
|
| submod.NAME = name
|
| - submod.MODULE_DIRECTORY = get_module_directory(submod.__file__)
|
| + submod.MODULE_DIRECTORY = Path(ModuleBasePath(submod))
|
| submod.CONFIG_CTX = getattr(submod, 'CONFIG_CTX', None)
|
| submod.DEPS = frozenset(getattr(submod, 'DEPS', ()))
|
|
|
|
|