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

Unified Diff: scripts/slave/recipe_modules/path/api.py

Issue 985273002: Changed recipe_modules base paths to be abstract entities in their own right. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Actual code change Created 5 years, 9 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
Index: scripts/slave/recipe_modules/path/api.py
diff --git a/scripts/slave/recipe_modules/path/api.py b/scripts/slave/recipe_modules/path/api.py
index bde7c73b2086df5def43237a57c18e7e5e308929..88d4257bb3f3e3fe70f2c8817c135570ad369f57 100644
--- a/scripts/slave/recipe_modules/path/api.py
+++ b/scripts/slave/recipe_modules/path/api.py
@@ -4,6 +4,7 @@
import functools
import os
+import sys
import tempfile
from slave import recipe_api
@@ -15,13 +16,23 @@ def PathTostring(api, test):
assert isinstance(path, recipe_config_types.Path)
base_path = None
suffix = path.platform_ext.get(api.m.platform.name, '')
- if path.base in api.c.dynamic_paths:
- base_path = api.c.dynamic_paths[path.base]
- elif path.base in api.c.base_paths:
+ if isinstance(path.base, recipe_config_types.NamedBasePath):
+ name = path.base.name
+ if name in api.c.dynamic_paths:
+ base_path = api.c.dynamic_paths[name]
+ elif name in api.c.base_paths:
+ if test.enabled:
+ base_path = repr(path.base)
luqui 2015/03/07 02:48:04 See if you (I) can make this a normal method inste
luqui 2015/03/09 18:49:28 Changed my mind about this...
+ else: # pragma: no cover
+ base_path = api.join(*api.c.base_paths[name])
+ elif isinstance(path.base, recipe_config_types.ModuleBasePath):
if test.enabled:
- base_path = '[%s]' % path.base.upper()
+ base_path = repr(path.base)
else: # pragma: no cover
- base_path = api.join(*api.c.base_paths[path.base])
+ base_path = os.path.dirname(path.base.module.__file__)
+ else: # pragma: no cover
+ raise NotImplementedError('PathTostring not implemented for %s' %
+ path.base.__class__.__name__)
assert base_path, 'Could not get base %r for path' % path.base
return api.join(base_path, *path.pieces) + suffix
return PathTostring_inner
@@ -293,8 +304,8 @@ class PathApi(recipe_api.RecipeApi):
'Setting dynamic path to something other than a Path: %r' % path)
assert pathname in self.c.dynamic_paths, (
'Must declare dynamic path (%r) in config before setting it.' % path)
- assert path.base in self.c.base_paths, (
- 'Dynamic path values must be based on a base_path.')
+ assert isinstance(path.base, recipe_config_types.BasePath), (
+ 'Dynamic path values must be based on a base_path' % path.base)
self.c.dynamic_paths[pathname] = path
@recipe_api.non_step
@@ -305,7 +316,7 @@ class PathApi(recipe_api.RecipeApi):
'set yet.' % name)
return r
if name in self.c.base_paths:
- return recipe_config_types.Path(name, _bypass=True)
+ return recipe_config_types.Path(recipe_config_types.NamedBasePath(name))
@recipe_api.non_step
def __getattr__(self, name):

Powered by Google App Engine
This is Rietveld 408576698