| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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) |
| OLD | NEW |