| 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 imp | 6 import imp |
| 7 import inspect | 7 import inspect |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 submodules to find subclasses of RecipeApi, RecipeTestApi, etc. | 390 submodules to find subclasses of RecipeApi, RecipeTestApi, etc. |
| 391 """ | 391 """ |
| 392 fullname = '%s/%s' % (universe_view.package.name, name) | 392 fullname = '%s/%s' % (universe_view.package.name, name) |
| 393 submod.NAME = name | 393 submod.NAME = name |
| 394 submod.UNIQUE_NAME = fullname | 394 submod.UNIQUE_NAME = fullname |
| 395 submod.MODULE_DIRECTORY = Path(ModuleBasePath(submod)) | 395 submod.MODULE_DIRECTORY = Path(ModuleBasePath(submod)) |
| 396 submod.RESOURCE_DIRECTORY = submod.MODULE_DIRECTORY.join('resources') | 396 submod.RESOURCE_DIRECTORY = submod.MODULE_DIRECTORY.join('resources') |
| 397 submod.PACKAGE_REPO_ROOT = Path(PackageRepoBasePath(universe_view.package)) | 397 submod.PACKAGE_REPO_ROOT = Path(PackageRepoBasePath(universe_view.package)) |
| 398 submod.CONFIG_CTX = getattr(submod, 'CONFIG_CTX', None) | 398 submod.CONFIG_CTX = getattr(submod, 'CONFIG_CTX', None) |
| 399 | 399 |
| 400 # TODO(phajdan.jr): remove DISABLE_STRICT_COVERAGE (crbug/693058). |
| 401 submod.DISABLE_STRICT_COVERAGE = getattr( |
| 402 submod, 'DISABLE_STRICT_COVERAGE', False) |
| 403 |
| 400 if hasattr(submod, 'config'): | 404 if hasattr(submod, 'config'): |
| 401 for v in submod.config.__dict__.itervalues(): | 405 for v in submod.config.__dict__.itervalues(): |
| 402 if isinstance(v, ConfigContext): | 406 if isinstance(v, ConfigContext): |
| 403 assert not submod.CONFIG_CTX, ( | 407 assert not submod.CONFIG_CTX, ( |
| 404 'More than one configuration context: %s, %s' % | 408 'More than one configuration context: %s, %s' % |
| 405 (submod.config, submod.CONFIG_CTX)) | 409 (submod.config, submod.CONFIG_CTX)) |
| 406 submod.CONFIG_CTX = v | 410 submod.CONFIG_CTX = v |
| 407 assert submod.CONFIG_CTX, 'Config file, but no config context?' | 411 assert submod.CONFIG_CTX, 'Config file, but no config context?' |
| 408 | 412 |
| 409 # Identify the RecipeApiPlain subclass as this module's API. | 413 # Identify the RecipeApiPlain subclass as this module's API. |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 for k,v in toplevel_deps.iteritems(): | 636 for k,v in toplevel_deps.iteritems(): |
| 633 setattr(api, k, mapper.instantiate(v)) | 637 setattr(api, k, mapper.instantiate(v)) |
| 634 return api | 638 return api |
| 635 | 639 |
| 636 | 640 |
| 637 def _resolve_requirement(req, engine): | 641 def _resolve_requirement(req, engine): |
| 638 if req._typ == 'client': | 642 if req._typ == 'client': |
| 639 return engine._get_client(req._name) | 643 return engine._get_client(req._name) |
| 640 else: | 644 else: |
| 641 raise ValueError('Unknown requirement type [%s]' % (req._typ,)) | 645 raise ValueError('Unknown requirement type [%s]' % (req._typ,)) |
| OLD | NEW |