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

Unified Diff: recipe_engine/recipe_api.py

Issue 2512253002: Add name, package_repo_resource and resource support to recipe scripts. (Closed)
Patch Set: Fix bug, add additional test Created 4 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 side-by-side diff with in-line comments
Download patch
Index: recipe_engine/recipe_api.py
diff --git a/recipe_engine/recipe_api.py b/recipe_engine/recipe_api.py
index 8827e4c4cf81994edf679d5d216406a3d7829fd6..83b59dad51a691ae98c909b63eaf0cda73323658 100644
--- a/recipe_engine/recipe_api.py
+++ b/recipe_engine/recipe_api.py
@@ -647,7 +647,10 @@ class RecipeApiPlain(object):
# If we're the 'root' api, inject directly into 'self'.
# Otherwise inject into 'self.m'
- self.m = self if module is None else ModuleInjectionSite(self)
+ if not isinstance(module, types.ModuleType):
+ self.m = self
+ else:
+ self.m = ModuleInjectionSite(self)
iannucci 2016/11/19 00:15:32 this is really dumb, but it's what caused the erro
# If our module has a test api, it gets injected here.
self.test_api = None
@@ -735,7 +738,7 @@ class RecipeApiPlain(object):
"""
# TODO(vadimsh): Verify that file exists. Including a case like:
# module.resource('dir').join('subdir', 'file.py')
- return self._module.MODULE_DIRECTORY.join('resources', *path)
+ return self._module.RESOURCE_DIRECTORY.join(*path)
def package_repo_resource(self, *path):
"""Returns a resource path, where path is relative to the root of
« recipe_engine/loader.py ('K') | « recipe_engine/loader.py ('k') | recipe_engine/run.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698