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

Side by Side Diff: gclient_utils.py

Issue 8349001: gclient would crash when .gclient is not found. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 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 """Generic utils.""" 5 """Generic utils."""
6 6
7 import errno 7 import errno
8 import logging 8 import logging
9 import os 9 import os
10 import Queue 10 import Queue
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 return path 445 return path
446 (new_path, _) = os.path.split(path) 446 (new_path, _) = os.path.split(path)
447 if new_path == path: 447 if new_path == path:
448 return None 448 return None
449 path = new_path 449 path = new_path
450 450
451 451
452 def GetGClientRootAndEntries(path=None): 452 def GetGClientRootAndEntries(path=None):
453 """Returns the gclient root and the dict of entries.""" 453 """Returns the gclient root and the dict of entries."""
454 config_file = '.gclient_entries' 454 config_file = '.gclient_entries'
455 config_path = os.path.join(FindFileUpwards(config_file, path), config_file) 455 root = FindFileUpwards(config_file, path)
456 456 if not root:
457 if not config_path:
458 print "Can't find %s" % config_file 457 print "Can't find %s" % config_file
459 return None 458 return None
460 459 config_path = os.path.join(root, config_file)
461 env = {} 460 env = {}
462 execfile(config_path, env) 461 execfile(config_path, env)
463 config_dir = os.path.dirname(config_path) 462 config_dir = os.path.dirname(config_path)
464 return config_dir, env['entries'] 463 return config_dir, env['entries']
465 464
466 465
467 def lockedmethod(method): 466 def lockedmethod(method):
468 """Method decorator that holds self.lock for the duration of the call.""" 467 """Method decorator that holds self.lock for the duration of the call."""
469 def inner(self, *args, **kwargs): 468 def inner(self, *args, **kwargs):
470 try: 469 try:
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 logging.info('Caught exception in thread %s' % self.item.name) 667 logging.info('Caught exception in thread %s' % self.item.name)
669 logging.info(str(sys.exc_info())) 668 logging.info(str(sys.exc_info()))
670 work_queue.exceptions.put(sys.exc_info()) 669 work_queue.exceptions.put(sys.exc_info())
671 logging.info('_Worker.run(%s) done' % self.item.name) 670 logging.info('_Worker.run(%s) done' % self.item.name)
672 671
673 work_queue.ready_cond.acquire() 672 work_queue.ready_cond.acquire()
674 try: 673 try:
675 work_queue.ready_cond.notifyAll() 674 work_queue.ready_cond.notifyAll()
676 finally: 675 finally:
677 work_queue.ready_cond.release() 676 work_queue.ready_cond.release()
OLDNEW
« 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