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

Side by Side Diff: prebuilt.py

Issue 4566001: Fix for bug 8764 that breaks prebuilts for files with more than just keyword pairs. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Remove unnecessary check of = in string 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 | prebuilt_unittest.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 #!/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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. 92 # Strip newlines from end of line. We already add newlines below.
93 line = line.rstrip("\n") 93 line = line.rstrip("\n")
94 94
95 if '=' not in line: 95 if len(line.split('=')) != 2:
96 # Skip any line without an equal in it and just write it out. 96 # Skip any line that doesn't fit key=val.
97 file_lines.append(line) 97 file_lines.append(line)
98 continue 98 continue
99 99
100 file_var, file_val = line.split('=') 100 file_var, file_val = line.split('=')
101 keyval_str = '%(key)s=%(value)s' 101 keyval_str = '%(key)s=%(value)s'
102 if file_var == key: 102 if file_var == key:
103 found = True 103 found = True
104 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)
105 value = '"%s"' % value 105 value = '"%s"' % value
106 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
486 options.binhost_base_url, git_sync=options.git_sync) 486 options.binhost_base_url, git_sync=options.git_sync)
487 487
488 if options.board: 488 if options.board:
489 UploadPrebuilt(options.build_path, options.upload, version, 489 UploadPrebuilt(options.build_path, options.upload, version,
490 options.binhost_base_url, board=options.board, 490 options.binhost_base_url, board=options.board,
491 git_sync=options.git_sync) 491 git_sync=options.git_sync)
492 492
493 493
494 if __name__ == '__main__': 494 if __name__ == '__main__':
495 main() 495 main()
OLDNEW
« no previous file with comments | « no previous file | prebuilt_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698