Chromium Code Reviews| Index: gclient.py |
| diff --git a/gclient.py b/gclient.py |
| index 671250c7eae55dbf3e4db2537b79644b9ab29f99..82e120e349abb1d176ab6cb60a704f9f673f1f57 100644 |
| --- a/gclient.py |
| +++ b/gclient.py |
| @@ -179,22 +179,26 @@ class DependencySettings(GClientKeywords): |
| @property |
| def deps_file(self): |
| - """Immutable so no need to lock.""" |
| return self._deps_file |
| @property |
| def managed(self): |
| - """Immutable so no need to lock.""" |
| return self._managed |
| @property |
| def parent(self): |
| - """Immutable so no need to lock.""" |
| return self._parent |
| @property |
| + def root(self): |
| + """Returns the root node, a GClient object.""" |
| + if not self.parent: |
| + # This line is to signal pylint that it could be a GClient instance. |
| + return self or GClient(None, None) |
| + return self.parent.root |
| + |
| + @property |
| def safesync_url(self): |
| - """Immutable so no need to lock.""" |
| return self._safesync_url |
| @property |
| @@ -204,18 +208,31 @@ class DependencySettings(GClientKeywords): |
| @property |
| def custom_vars(self): |
| - """Immutable so no need to lock.""" |
| return self._custom_vars.copy() |
| @property |
| def custom_deps(self): |
| - """Immutable so no need to lock.""" |
| return self._custom_deps.copy() |
| @property |
| def url(self): |
| return self._url |
| + @property |
| + def recursion_limit(self): |
| + """Returns > 0 if this dependency is not too recursed to be processed. |
| + |
| + Immutable so no need to lock. |
|
Dirk Pranke
2011/10/03 21:10:04
Nit: if you're deleting the "immutable" comments f
M-A Ruel
2011/10/03 21:29:48
Thanks, copy-paste fail.
|
| + """ |
| + return max(self.parent.recursion_limit - 1, 0) |
| + |
| + def get_custom_deps(self, name, url): |
|
Dirk Pranke
2011/10/03 21:10:04
Should this be a property (i.e., @property def cus
M-A Ruel
2011/10/03 21:29:48
there's already a custom_deps property. This one i
|
| + """Returns a custom deps if applicable.""" |
| + if self.parent: |
| + url = self.parent.get_custom_deps(name, url) |
| + # None is a valid return value to disable a dependency. |
| + return self.custom_deps.get(name, url) |
| + |
| class Dependency(gclient_utils.WorkItem, DependencySettings): |
| """Object that represents a dependency checkout.""" |
| @@ -619,21 +636,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): |
| if j.should_process: |
| yield j |
| - def get_custom_deps(self, name, url): |
| - """Returns a custom deps if applicable.""" |
| - if self.parent: |
| - url = self.parent.get_custom_deps(name, url) |
| - # None is a valid return value to disable a dependency. |
| - return self.custom_deps.get(name, url) |
| - |
| - @property |
| - def recursion_limit(self): |
| - """Returns > 0 if this dependency is not too recursed to be processed. |
| - |
| - Immutable so no need to lock. |
| - """ |
| - return max(self.parent.recursion_limit - 1, 0) |
| - |
| @property |
| def dependencies(self): |
| return tuple(self._dependencies) |
| @@ -695,14 +697,6 @@ class Dependency(gclient_utils.WorkItem, DependencySettings): |
| i = i.parent |
| return out |
| - @property |
| - def root(self): |
| - """Returns the root node, a GClient object.""" |
| - if not self.parent: |
| - # This line is to signal pylint that it could be a GClient instance. |
| - return self or GClient(None, None) |
| - return self.parent.root |
| - |
| class GClient(Dependency): |
| """Object that represent a gclient checkout. A tree of Dependency(), one per |