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

Side by Side Diff: recipe_engine/recipe_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/package.py ('k') | recipe_modules/path/api.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-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 from __future__ import absolute_import 5 from __future__ import absolute_import
6 import contextlib 6 import contextlib
7 import keyword 7 import keyword
8 import re 8 import re
9 import types 9 import types
10 10
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 def resource(self, *path): 439 def resource(self, *path):
440 """Returns path to a file under <recipe module>/resources/ directory. 440 """Returns path to a file under <recipe module>/resources/ directory.
441 441
442 Args: 442 Args:
443 path: path relative to module's resources/ directory. 443 path: path relative to module's resources/ directory.
444 """ 444 """
445 # TODO(vadimsh): Verify that file exists. Including a case like: 445 # TODO(vadimsh): Verify that file exists. Including a case like:
446 # module.resource('dir').join('subdir', 'file.py') 446 # module.resource('dir').join('subdir', 'file.py')
447 return self._module.MODULE_DIRECTORY.join('resources', *path) 447 return self._module.MODULE_DIRECTORY.join('resources', *path)
448 448
449 def package_resource(self, *path): 449 def package_repo_resource(self, *path):
450 """Returns a resource path, where path is relative to the root of 450 """Returns a resource path, where path is relative to the root of
451 the package where this module is defined. 451 the package repo where this module is defined.
452 """ 452 """
453 return self._module.PACKAGE_DIRECTORY.join(*path) 453 return self._module.PACKAGE_REPO_ROOT.join(*path)
454 454
455 @property 455 @property
456 def name(self): 456 def name(self):
457 return self._module.NAME 457 return self._module.NAME
458 458
459 459
460 class RecipeApi(RecipeApiPlain): 460 class RecipeApi(RecipeApiPlain):
461 __metaclass__ = RecipeApiMeta 461 __metaclass__ = RecipeApiMeta
462 462
463 463
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 """ 636 """
637 Gets the BoundProperty version of this Property. Requires a name. 637 Gets the BoundProperty version of this Property. Requires a name.
638 """ 638 """
639 return BoundProperty( 639 return BoundProperty(
640 self._default, self.help, self.kind, name, property_type, module, 640 self._default, self.help, self.kind, name, property_type, module,
641 self.param_name) 641 self.param_name)
642 642
643 class UndefinedPropertyException(TypeError): 643 class UndefinedPropertyException(TypeError):
644 pass 644 pass
645 645
OLDNEW
« no previous file with comments | « recipe_engine/package.py ('k') | recipe_modules/path/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698