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

Unified Diff: gclient.py

Issue 3126003: Fix the type of 2 exceptions. (Closed)
Patch Set: Add more logging while at it Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gclient.py
diff --git a/gclient.py b/gclient.py
index 9a654c752d74801c83d3c1fb6127977ebfb4b59d..63c919acd78d3e45139ed3fcd0f218e25f36794e 100644
--- a/gclient.py
+++ b/gclient.py
@@ -161,17 +161,14 @@ class Dependency(GClientKeywords):
# solution. A indirect one is one that was loaded with From() or that
# exceeded recursion limit.
self.direct_reference = False
+ # This dependency has been processed, i.e. checked out
+ self.processed = False
+ # This dependency had its hook run
+ self.hooks_ran = False
# Sanity checks
if not self.name and self.parent:
raise gclient_utils.Error('Dependency without name')
- # TODO(maruel): http://crbug.com/50015 Reenable this check once
- # self.tree(False) is corrected.
- # tree = dict((d.name, d) for d in self.tree(False))
- #if self.name in tree:
- # raise gclient_utils.Error(
- # 'Dependency %s specified more than once:\n %s\nvs\n %s' %
- # (self.name, tree[self.name].hierarchy(), self.hierarchy()))
if not isinstance(self.url,
(basestring, self.FromImpl, self.FileImpl, None.__class__)):
raise gclient_utils.Error('dependency url must be either a string, None, '
@@ -189,9 +186,10 @@ class Dependency(GClientKeywords):
self.parsed_url))
elif isinstance(url, self.FromImpl):
ref = [dep for dep in self.tree(True) if url.module_name == dep.name]
- if not len(ref) == 1:
- raise Exception('Failed to find one reference to %s. %s' % (
- url.module_name, ref))
+ if not ref:
+ raise gclient_utils.Error('Failed to find one reference to %s. %s' % (
+ url.module_name, ref))
+ # It may happen that len(ref) > 1 but it's no big deal.
ref = ref[0]
sub_target = url.sub_target_name or self.name
# Make sure the referenced dependency DEPS file is loaded and file the
@@ -203,7 +201,8 @@ class Dependency(GClientKeywords):
found_dep = d
break
if not found_dep:
- raise Exception('Couldn\'t find %s in %s, referenced by %s' % (
+ raise gclient_utils.Error(
+ 'Couldn\'t find %s in %s, referenced by %s' % (
sub_target, ref.name, self.name))
# Call LateOverride() again.
self.parsed_url = found_dep.LateOverride(found_dep.url)
@@ -331,6 +330,7 @@ class Dependency(GClientKeywords):
self._file_list = [os.path.join(self.name, f.strip())
for f in self._file_list]
options.revision = None
+ self.processed = True
if pm:
# The + 1 comes from the fact that .gclient is considered a step in
# itself, .i.e. this code is called one time for the .gclient. This is not
@@ -396,6 +396,7 @@ class Dependency(GClientKeywords):
def _RunHookAction(self, hook_dict, matching_file_list):
"""Runs the action from a single hook."""
+ self.hooks_ran = True
logging.info(hook_dict)
logging.info(matching_file_list)
command = hook_dict['action'][:]
@@ -452,7 +453,8 @@ class Dependency(GClientKeywords):
def __str__(self):
out = []
for i in ('name', 'url', 'safesync_url', 'custom_deps', 'custom_vars',
- 'deps_hooks', '_file_list'):
+ 'deps_hooks', '_file_list', 'processed',
+ 'hooks_ran'):
# 'deps_file'
if self.__dict__[i]:
out.append('%s: %s' % (i, self.__dict__[i]))
@@ -760,6 +762,7 @@ solutions = [
if not entry is entries[-1]:
line += ';'
print line
+ logging.debug(str(self))
def ParseDepsFile(self, direct_reference):
"""No DEPS to parse for a .gclient file."""
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698