Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(814)

Side by Side Diff: recipe_engine/loader.py

Issue 1421843006: Add simple depends_on API. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/recipes-py@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | recipe_engine/recipe_api.py » ('j') | recipes/top.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013-2015 The Chromium Authors. All rights reserved. 1 # Copyright 2013-2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import collections 5 import collections
6 import contextlib 6 import contextlib
7 import imp 7 import imp
8 import inspect 8 import inspect
9 import os 9 import os
10 import sys 10 import sys
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 # TODO(luqui): Forbid depending on a module from a (locally) undeclared 124 # TODO(luqui): Forbid depending on a module from a (locally) undeclared
125 # dependency. 125 # dependency.
126 def __init__(self, package, module, local_name, universe): 126 def __init__(self, package, module, local_name, universe):
127 mod_path = ( 127 mod_path = (
128 universe.package_deps.get_package(package).module_path(module)) 128 universe.package_deps.get_package(package).module_path(module))
129 super(PackageDependency, self).__init__( 129 super(PackageDependency, self).__init__(
130 mod_path, local_name, universe=universe) 130 mod_path, local_name, universe=universe)
131 131
132 132
133 class RecipeUniverse(object): 133 class RecipeUniverse(object):
134 def __init__(self, package_deps): 134 def __init__(self, package_deps, config_file):
135 self._loaded = {} 135 self._loaded = {}
136 self._package_deps = package_deps 136 self._package_deps = package_deps
137 self._config_file = config_file
137 138
138 @property 139 @property
139 def module_dirs(self): 140 def module_dirs(self):
140 return self._package_deps.all_module_dirs 141 return self._package_deps.all_module_dirs
141 142
142 @property 143 @property
143 def recipe_dirs(self): 144 def recipe_dirs(self):
144 return self._package_deps.all_recipe_dirs 145 return self._package_deps.all_recipe_dirs
145 146
146 @property 147 @property
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return modapi 497 return modapi
497 498
498 mapper = DependencyMapper(instantiator) 499 mapper = DependencyMapper(instantiator)
499 api = RecipeTestApi(module=None) 500 api = RecipeTestApi(module=None)
500 for k,v in toplevel_deps.iteritems(): 501 for k,v in toplevel_deps.iteritems():
501 setattr(api, k, mapper.instantiate(v)) 502 setattr(api, k, mapper.instantiate(v))
502 return api 503 return api
503 504
504 505
505 506
OLDNEW
« no previous file with comments | « no previous file | recipe_engine/recipe_api.py » ('j') | recipes/top.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698