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

Side by Side Diff: prebuilt.py

Issue 4179002: Strip newlines from each line in make.conf. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Created 10 years, 1 month 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import datetime 6 import datetime
7 import multiprocessing 7 import multiprocessing
8 import optparse 8 import optparse
9 import os 9 import os
10 import re 10 import re
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 Args: 83 Args:
84 filename: Name of file to modify. 84 filename: Name of file to modify.
85 value: Value to write with the key. 85 value: Value to write with the key.
86 key: The variable key to update. (Default: PORTAGE_BINHOST) 86 key: The variable key to update. (Default: PORTAGE_BINHOST)
87 """ 87 """
88 file_fh = open(filename) 88 file_fh = open(filename)
89 file_lines = [] 89 file_lines = []
90 found = False 90 found = False
91 for line in file_fh: 91 for line in file_fh:
92 # Strip newlines from end of line. We already add newlines below.
93 line = line.rstrip("\n")
94
92 if '=' not in line: 95 if '=' not in line:
93 # Skip any line without an equal in it and just write it out 96 # Skip any line without an equal in it and just write it out.
94 file_lines.append(line) 97 file_lines.append(line)
95 continue 98 continue
96 99
97 file_var, file_val = line.split('=') 100 file_var, file_val = line.split('=')
98 keyval_str = '%(key)s=%(value)s' 101 keyval_str = '%(key)s=%(value)s'
99 if file_var == key: 102 if file_var == key:
100 found = True 103 found = True
101 print 'Updating %s=%s to %s="%s"' % (file_var, file_val, key, value) 104 print 'Updating %s=%s to %s="%s"' % (file_var, file_val, key, value)
102 value = '"%s"' % value 105 value = '"%s"' % value
103 file_lines.append(keyval_str % {'key': key, 'value': value}) 106 file_lines.append(keyval_str % {'key': key, 'value': value})
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 options.binhost_base_url, git_sync=options.git_sync) 486 options.binhost_base_url, git_sync=options.git_sync)
484 487
485 if options.board: 488 if options.board:
486 UploadPrebuilt(options.build_path, options.upload, version, 489 UploadPrebuilt(options.build_path, options.upload, version,
487 options.binhost_base_url, board=options.board, 490 options.binhost_base_url, board=options.board,
488 git_sync=options.git_sync) 491 git_sync=options.git_sync)
489 492
490 493
491 if __name__ == '__main__': 494 if __name__ == '__main__':
492 main() 495 main()
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