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

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: Update expectations. 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') | recipe_engine/recipe_test_api.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 class PackageDependency(PathDependency): 123 class PackageDependency(PathDependency):
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):
Sergiy Byelozyorov 2015/11/13 13:14:55 can you please document what this does or add a TO
martiniss 2015/11/13 23:19:02 luqui@ wrote this, would be a better person to doc
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
138
139 def copy(self):
140 return RecipeUniverse(self._package_deps, self._config_file)
137 141
138 @property 142 @property
139 def module_dirs(self): 143 def module_dirs(self):
140 return self._package_deps.all_module_dirs 144 return self._package_deps.all_module_dirs
141 145
142 @property 146 @property
143 def recipe_dirs(self): 147 def recipe_dirs(self):
144 return self._package_deps.all_recipe_dirs 148 return self._package_deps.all_recipe_dirs
145 149
146 @property 150 @property
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return modapi 500 return modapi
497 501
498 mapper = DependencyMapper(instantiator) 502 mapper = DependencyMapper(instantiator)
499 api = RecipeTestApi(module=None) 503 api = RecipeTestApi(module=None)
500 for k,v in toplevel_deps.iteritems(): 504 for k,v in toplevel_deps.iteritems():
501 setattr(api, k, mapper.instantiate(v)) 505 setattr(api, k, mapper.instantiate(v))
502 return api 506 return api
503 507
504 508
505 509
OLDNEW
« no previous file with comments | « no previous file | recipe_engine/recipe_api.py » ('j') | recipe_engine/recipe_test_api.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698