OLD | NEW |
1 # Copyright 2016 The LUCI Authors. All rights reserved. | 1 # Copyright 2016 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 import collections | 5 import collections |
6 import contextlib | |
7 import imp | 6 import imp |
8 import inspect | 7 import inspect |
9 import os | 8 import os |
10 import sys | 9 import sys |
11 | 10 |
12 from . import env | 11 from . import env |
13 | 12 |
14 from .config import ConfigContext, ConfigGroupSchema | 13 from .config import ConfigContext, ConfigGroupSchema |
15 from .config_types import Path, ModuleBasePath, PackageRepoBasePath | 14 from .config_types import Path, ModuleBasePath, PackageRepoBasePath |
16 from .config_types import RecipeScriptBasePath | 15 from .config_types import RecipeScriptBasePath |
17 from .config_types import RECIPE_MODULE_PREFIX | 16 from .config_types import RECIPE_MODULE_PREFIX |
18 from .recipe_api import RecipeApi, RecipeApiPlain, RecipeScriptApi | 17 from .recipe_api import RecipeApiPlain, RecipeScriptApi |
19 from .recipe_api import _UnresolvedRequirement | 18 from .recipe_api import _UnresolvedRequirement |
20 from .recipe_api import Property, BoundProperty | 19 from .recipe_api import BoundProperty |
21 from .recipe_api import UndefinedPropertyException, PROPERTY_SENTINEL | 20 from .recipe_api import UndefinedPropertyException, PROPERTY_SENTINEL |
22 from .recipe_test_api import RecipeTestApi, DisabledTestData | 21 from .recipe_test_api import RecipeTestApi, DisabledTestData |
23 | 22 |
24 | 23 |
25 class LoaderError(Exception): | 24 class LoaderError(Exception): |
26 """Raised when something goes wrong loading recipes or modules.""" | 25 """Raised when something goes wrong loading recipes or modules.""" |
27 | 26 |
28 | 27 |
29 class NoSuchRecipe(LoaderError): | 28 class NoSuchRecipe(LoaderError): |
30 """Raised by load_recipe is recipe is not found.""" | 29 """Raised by load_recipe is recipe is not found.""" |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 for k,v in toplevel_deps.iteritems(): | 632 for k,v in toplevel_deps.iteritems(): |
634 setattr(api, k, mapper.instantiate(v)) | 633 setattr(api, k, mapper.instantiate(v)) |
635 return api | 634 return api |
636 | 635 |
637 | 636 |
638 def _resolve_requirement(req, engine): | 637 def _resolve_requirement(req, engine): |
639 if req._typ == 'client': | 638 if req._typ == 'client': |
640 return engine._get_client(req._name) | 639 return engine._get_client(req._name) |
641 else: | 640 else: |
642 raise ValueError('Unknown requirement type [%s]' % (req._typ,)) | 641 raise ValueError('Unknown requirement type [%s]' % (req._typ,)) |
OLD | NEW |