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

Side by Side Diff: gsd_generate_index/gsd_generate_index.py

Issue 6711018: Fixing push -> append in indexing script. (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/
Patch Set: Created 9 years, 9 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2008-2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2008-2010 The Chromium 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 """Generate index.html files for a Google Storage for Developers directory. 6 """Generate index.html files for a Google Storage for Developers directory.
7 7
8 Google Storage for Developers provides only a raw set of objects. 8 Google Storage for Developers provides only a raw set of objects.
9 For some buckets we would like to be able to support browsing of the directory 9 For some buckets we would like to be able to support browsing of the directory
10 tree. This utility will generate the needed index and upload/update it. 10 tree. This utility will generate the needed index and upload/update it.
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 return 149 return
150 d = index_list.pop(0) 150 d = index_list.pop(0)
151 mutex.release() 151 mutex.release()
152 # Find just this directories children. 152 # Find just this directories children.
153 children = [o for o in objects if posixpath.dirname(o) == d] 153 children = [o for o in objects if posixpath.dirname(o) == d]
154 # Generate it. 154 # Generate it.
155 try: 155 try:
156 GenerateIndex(d, children, directories, options) 156 GenerateIndex(d, children, directories, options)
157 except Exception, e: 157 except Exception, e:
158 mutex.acquire() 158 mutex.acquire()
159 errors.push(e) 159 errors.append(e)
160 print str(e) 160 print str(e)
161 mutex.release() 161 mutex.release()
162 162
163 163
164 def GenerateIndexes(path, options): 164 def GenerateIndexes(path, options):
165 """Generate all relevant indexes for a given gsd path.""" 165 """Generate all relevant indexes for a given gsd path."""
166 # Get a list of objects under this prefix. 166 # Get a list of objects under this prefix.
167 cmd = [options.gsutil, 'ls', posixpath.join(path, '*')] 167 cmd = [options.gsutil, 'ls', posixpath.join(path, '*')]
168 p = subprocess.Popen(cmd, stdout=subprocess.PIPE) 168 p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
169 p_stdout, _ = p.communicate() 169 p_stdout, _ = p.communicate()
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 dest='gsutil', help='path to gsutil') 210 dest='gsutil', help='path to gsutil')
211 options, args = parser.parse_args(argv) 211 options, args = parser.parse_args(argv)
212 if len(args) != 2 or not args[1].startswith('gs://'): 212 if len(args) != 2 or not args[1].startswith('gs://'):
213 parser.print_help() 213 parser.print_help()
214 return 1 214 return 1
215 return GenerateIndexes(args[1], options) 215 return GenerateIndexes(args[1], options)
216 216
217 217
218 if __name__ == '__main__': 218 if __name__ == '__main__':
219 sys.exit(main(sys.argv)) 219 sys.exit(main(sys.argv))
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