| OLD | NEW |
| 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 import abc | 5 import abc |
| 6 import re | 6 import re |
| 7 | 7 |
| 8 from collections import namedtuple | 8 from collections import namedtuple |
| 9 | 9 |
| 10 from . import types | 10 from . import types |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 class ModuleBasePath(BasePath, namedtuple('ModuleBasePath', 'module')): | 88 class ModuleBasePath(BasePath, namedtuple('ModuleBasePath', 'module')): |
| 89 def __repr__(self): | 89 def __repr__(self): |
| 90 prefix = '%s.' % RECIPE_MODULE_PREFIX | 90 prefix = '%s.' % RECIPE_MODULE_PREFIX |
| 91 assert self.module.__name__.startswith(prefix) | 91 assert self.module.__name__.startswith(prefix) |
| 92 name = self.module.__name__[len(prefix):] | 92 name = self.module.__name__[len(prefix):] |
| 93 # We change python's module delimiter . to ::, since . is already used | 93 # We change python's module delimiter . to ::, since . is already used |
| 94 # by expect tests. | 94 # by expect tests. |
| 95 return 'RECIPE_MODULE[%s]' % re.sub('\.', '::', name) | 95 return 'RECIPE_MODULE[%s]' % re.sub('\.', '::', name) |
| 96 | 96 |
| 97 | 97 |
| 98 class PackageBasePath(BasePath, namedtuple('PackageBasePath', 'package')): | 98 class PackageRepoBasePath( |
| 99 BasePath, namedtuple('PackageRepoBasePath', 'package')): |
| 99 def __repr__(self): | 100 def __repr__(self): |
| 100 return 'RECIPE_PACKAGE[%s]' % self.package.name | 101 return 'RECIPE_PACKAGE_REPO[%s]' % self.package.name |
| 101 | 102 |
| 102 | 103 |
| 103 class Path(RecipeConfigType): | 104 class Path(RecipeConfigType): |
| 104 """Represents a path which is relative to a semantically-named base. | 105 """Represents a path which is relative to a semantically-named base. |
| 105 | 106 |
| 106 Because there's a lot of platform (separator style) and runtime-specific | 107 Because there's a lot of platform (separator style) and runtime-specific |
| 107 context (working directory) which goes into assembling a final OS-specific | 108 context (working directory) which goes into assembling a final OS-specific |
| 108 absolute path, we only store three context-free attributes in this Path | 109 absolute path, we only store three context-free attributes in this Path |
| 109 object. | 110 object. |
| 110 """ | 111 """ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 return child.pieces[:len(self.pieces)] == self.pieces | 161 return child.pieces[:len(self.pieces)] == self.pieces |
| 161 | 162 |
| 162 def default_tostring_fn(self): | 163 def default_tostring_fn(self): |
| 163 suffix = '' | 164 suffix = '' |
| 164 if self.platform_ext: | 165 if self.platform_ext: |
| 165 suffix = ', platform_ext=%r' % (self.platform_ext,) | 166 suffix = ', platform_ext=%r' % (self.platform_ext,) |
| 166 pieces = '' | 167 pieces = '' |
| 167 if self.pieces: | 168 if self.pieces: |
| 168 pieces = ', ' + (', '.join(map(repr, self.pieces))) | 169 pieces = ', ' + (', '.join(map(repr, self.pieces))) |
| 169 return 'Path(\'%s\'%s%s)' % (self.base, pieces, suffix) | 170 return 'Path(\'%s\'%s%s)' % (self.base, pieces, suffix) |
| OLD | NEW |