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

Unified Diff: scripts/slave/recipe_modules/file/test_api.py

Issue 1347263002: Revert of Cross-repo recipe package system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 5 years, 3 months 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
« no previous file with comments | « scripts/slave/recipe_modules/file/example.py ('k') | scripts/slave/recipe_modules/gatekeeper/test_api.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/slave/recipe_modules/file/test_api.py
diff --git a/scripts/slave/recipe_modules/file/test_api.py b/scripts/slave/recipe_modules/file/test_api.py
index fa564aa472d3ac4c02e1c46992bdb02311ab14ed..be095c5fcdeba81478c73fcf72bdb9cbc2187636 100644
--- a/scripts/slave/recipe_modules/file/test_api.py
+++ b/scripts/slave/recipe_modules/file/test_api.py
@@ -31,6 +31,32 @@
BUILD_INTERNAL = os.path.join(_ROOT, 'build_internal')
class FileTestApi(recipe_test_api.RecipeTestApi):
+ def read_in_build(self, relpath):
+ """Read a file in chrome/trunk/tools/build.
+
+ Args:
+ relpath: A path inside chrome/trunk/tools/build.
+ """
+ # Prevent a user from using .. to escape the build repository.
+ assert '..' not in os.sep.split(relpath), (
+ 'You can\'t use .. in read_in_build.'
+ )
+ with open(os.path.join(BUILD, relpath)) as f:
+ return f.read()
+
+ def read_in_build_internal(self, relpath): # pragma: no cover
+ """Read a file in chrome-internal/trunk/tools/build.
+
+ Args:
+ relpath: A path inside chrome-internal/trunk/tools/build.
+ """
+ # Prevent a user from using .. to escape the build_internal repository.
+ assert '..' not in os.sep.split(relpath), (
+ 'You can\'t use .. in read_in_build.'
+ )
+ with open(os.path.join(BUILD_INTERNAL, relpath)) as f:
+ return f.read()
+
def listdir(self, files):
def listdir_callback():
return self.m.json.output(files)
« no previous file with comments | « scripts/slave/recipe_modules/file/example.py ('k') | scripts/slave/recipe_modules/gatekeeper/test_api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698