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

Side by Side Diff: gclient_utils.py

Issue 10736011: Improve comment added in r145396. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 5 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) 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 output = '' 71 output = ''
72 for i in dir(self): 72 for i in dir(self):
73 if i.startswith('__'): 73 if i.startswith('__'):
74 continue 74 continue
75 output += '%s = %s\n' % (i, str(getattr(self, i, ''))) 75 output += '%s = %s\n' % (i, str(getattr(self, i, '')))
76 return output 76 return output
77 77
78 78
79 def FileRead(filename, mode='rU'): 79 def FileRead(filename, mode='rU'):
80 with open(filename, mode=mode) as f: 80 with open(filename, mode=mode) as f:
81 # codecs.open() has different behavior than open() on python 2.6. 81 # codecs.open() has different behavior than open() on python 2.6 so use
82 # open() and decode manually.
82 return f.read().decode('utf-8') 83 return f.read().decode('utf-8')
83 84
84 85
85 def FileWrite(filename, content, mode='w'): 86 def FileWrite(filename, content, mode='w'):
86 with codecs.open(filename, mode=mode, encoding='utf-8') as f: 87 with codecs.open(filename, mode=mode, encoding='utf-8') as f:
87 f.write(content) 88 f.write(content)
88 89
89 90
90 def rmtree(path): 91 def rmtree(path):
91 """shutil.rmtree() on steroids. 92 """shutil.rmtree() on steroids.
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l) 761 keyvals = dict([x.strip() for x in l.split(':', 1)] for l in lines if l)
761 except ValueError: 762 except ValueError:
762 raise Error( 763 raise Error(
763 'Failed to process settings, please fix. Content:\n\n%s' % content) 764 'Failed to process settings, please fix. Content:\n\n%s' % content)
764 def fix_url(key): 765 def fix_url(key):
765 if keyvals.get(key): 766 if keyvals.get(key):
766 keyvals[key] = UpgradeToHttps(keyvals[key]) 767 keyvals[key] = UpgradeToHttps(keyvals[key])
767 fix_url('CODE_REVIEW_SERVER') 768 fix_url('CODE_REVIEW_SERVER')
768 fix_url('VIEW_VC') 769 fix_url('VIEW_VC')
769 return keyvals 770 return keyvals
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