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

Side by Side Diff: recipe_modules/path/api.py

Issue 1777003003: recipe_engine: change resource API to use repo root (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: review Created 4 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 unified diff | Download patch
« no previous file with comments | « recipe_engine/recipe_api.py ('k') | recipe_modules/path/example.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 functools 5 import functools
6 import os 6 import os
7 import sys 7 import sys
8 import tempfile 8 import tempfile
9 9
10 from recipe_engine import recipe_api 10 from recipe_engine import recipe_api
(...skipping 12 matching lines...) Expand all
23 elif name in api.c.base_paths: 23 elif name in api.c.base_paths:
24 if test.enabled: 24 if test.enabled:
25 base_path = repr(path.base) 25 base_path = repr(path.base)
26 else: # pragma: no cover 26 else: # pragma: no cover
27 base_path = api.join(*api.c.base_paths[name]) 27 base_path = api.join(*api.c.base_paths[name])
28 elif isinstance(path.base, config_types.ModuleBasePath): 28 elif isinstance(path.base, config_types.ModuleBasePath):
29 if test.enabled: 29 if test.enabled:
30 base_path = repr(path.base) 30 base_path = repr(path.base)
31 else: # pragma: no cover 31 else: # pragma: no cover
32 base_path = os.path.dirname(path.base.module.__file__) 32 base_path = os.path.dirname(path.base.module.__file__)
33 elif isinstance(path.base, config_types.PackageBasePath): 33 elif isinstance(path.base, config_types.PackageRepoBasePath):
34 if test.enabled: 34 if test.enabled:
35 base_path = repr(path.base) 35 base_path = repr(path.base)
36 else: # pragma: no cover 36 else: # pragma: no cover
37 base_path = path.base.package.recipes_dir 37 base_path = path.base.package.repo_root
38 else: # pragma: no cover 38 else: # pragma: no cover
39 raise NotImplementedError('PathToString not implemented for %s' % 39 raise NotImplementedError('PathToString not implemented for %s' %
40 path.base.__class__.__name__) 40 path.base.__class__.__name__)
41 assert base_path, 'Could not get base %r for path; pieces: %r' % ( 41 assert base_path, 'Could not get base %r for path; pieces: %r' % (
42 path.base, path.pieces) 42 path.base, path.pieces)
43 return api.join(base_path, *path.pieces) + suffix 43 return api.join(base_path, *path.pieces) + suffix
44 return PathToString_inner 44 return PathToString_inner
45 45
46 46
47 def string_filter(func): 47 def string_filter(func):
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 if name in self.OK_ATTRS: 232 if name in self.OK_ATTRS:
233 return getattr(self._path_mod, name) 233 return getattr(self._path_mod, name)
234 if name in self.FILTER_METHODS: 234 if name in self.FILTER_METHODS:
235 return string_filter(getattr(self._path_mod, name)) 235 return string_filter(getattr(self._path_mod, name))
236 raise AttributeError("'%s' object has no attribute '%s'" % 236 raise AttributeError("'%s' object has no attribute '%s'" %
237 (self._path_mod, name)) # pragma: no cover 237 (self._path_mod, name)) # pragma: no cover
238 238
239 def __dir__(self): # pragma: no cover 239 def __dir__(self): # pragma: no cover
240 # Used for helping out show_me_the_modules.py 240 # Used for helping out show_me_the_modules.py
241 return self.__dict__.keys() + list(self.OK_ATTRS + self.FILTER_METHODS) 241 return self.__dict__.keys() + list(self.OK_ATTRS + self.FILTER_METHODS)
OLDNEW
« no previous file with comments | « recipe_engine/recipe_api.py ('k') | recipe_modules/path/example.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698