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

Side by Side Diff: gclient_utils.py

Issue 11140019: Make gclient sync use cpu count for default jobs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: pylint disable Created 8 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 | « gclient.py ('k') | tests/gclient_utils_test.py » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 codecs 7 import codecs
8 import errno 8 import errno
9 import logging 9 import logging
10 import os 10 import os
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after
762 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l) 762 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l)
763 except ValueError: 763 except ValueError:
764 raise Error( 764 raise Error(
765 'Failed to process settings, please fix. Content:\n\n%s' % content) 765 'Failed to process settings, please fix. Content:\n\n%s' % content)
766 def fix_url(key): 766 def fix_url(key):
767 if keyvals.get(key): 767 if keyvals.get(key):
768 keyvals[key] = UpgradeToHttps(keyvals[key]) 768 keyvals[key] = UpgradeToHttps(keyvals[key])
769 fix_url('CODE_REVIEW_SERVER') 769 fix_url('CODE_REVIEW_SERVER')
770 fix_url('VIEW_VC') 770 fix_url('VIEW_VC')
771 return keyvals 771 return keyvals
772
773
774 def NumLocalCpus():
775 """Returns the number of processors.
776
777 Python on OSX 10.6 raises a NotImplementedError exception.
778 """
779 try:
780 import multiprocessing
781 return multiprocessing.cpu_count()
782 except: # pylint: disable=W0702
783 # Mac OS 10.6 only
784 # pylint: disable=E1101
785 return int(os.sysconf('SC_NPROCESSORS_ONLN'))
OLDNEW
« no previous file with comments | « gclient.py ('k') | tests/gclient_utils_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698