OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 """Updates the Chrome reference builds. | 7 """Updates the Chrome reference builds. |
8 | 8 |
9 Before running this script, you should first verify that you are authenticated | 9 Before running this script, you should first verify that you are authenticated |
10 for SVN. You can do this by running: | 10 for SVN. You can do this by running: |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 os.makedirs(os.path.dirname(dest)) | 209 os.makedirs(os.path.dirname(dest)) |
210 with z.open(content) as unzipped_content: | 210 with z.open(content) as unzipped_content: |
211 logging.info('Extracting %s to %s (%s)', content, dest, dl_file) | 211 logging.info('Extracting %s to %s (%s)', content, dest, dl_file) |
212 with file(dest, 'wb') as dest_file: | 212 with file(dest, 'wb') as dest_file: |
213 dest_file.write(unzipped_content.read()) | 213 dest_file.write(unzipped_content.read()) |
214 permissions = z.getinfo(content).external_attr >> 16 | 214 permissions = z.getinfo(content).external_attr >> 16 |
215 if permissions: | 215 if permissions: |
216 os.chmod(dest, permissions) | 216 os.chmod(dest, permissions) |
217 return True | 217 return True |
218 | 218 |
219 def _ClearDir(self, dir): | 219 def _ClearDir(self, directory): |
220 """Clears all files in |dir| except for hidden files and folders.""" | 220 """Clears all files in |directory| except for hidden files and folders.""" |
221 for root, dirs, files in os.walk(dir): | 221 for root, dirs, files in os.walk(directory): |
222 # Skip hidden files and folders (like .svn and .git). | 222 # Skip hidden files and folders (like .svn and .git). |
223 files = [f for f in files if f[0] != '.'] | 223 files = [f for f in files if f[0] != '.'] |
224 dirs[:] = [d for d in dirs if d[0] != '.'] | 224 dirs[:] = [d for d in dirs if d[0] != '.'] |
225 | 225 |
226 for f in files: | 226 for f in files: |
227 os.remove(os.path.join(root, f)) | 227 os.remove(os.path.join(root, f)) |
228 | 228 |
229 def _ExtractBuilds(self): | 229 def _ExtractBuilds(self): |
230 for platform in self._platforms: | 230 for platform in self._platforms: |
231 if os.path.exists('tmp_unzip'): | 231 if os.path.exists('tmp_unzip'): |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 def main(argv): | 286 def main(argv): |
287 logging.getLogger().setLevel(logging.DEBUG) | 287 logging.getLogger().setLevel(logging.DEBUG) |
288 version, options = ParseOptions(argv) | 288 version, options = ParseOptions(argv) |
289 b = BuildUpdater(version, options) | 289 b = BuildUpdater(version, options) |
290 b.DownloadAndUpdateBuilds() | 290 b.DownloadAndUpdateBuilds() |
291 logging.info('Successfully updated reference builds. Move to ' | 291 logging.info('Successfully updated reference builds. Move to ' |
292 'reference_builds/reference_builds and make a change with gcl.') | 292 'reference_builds/reference_builds and make a change with gcl.') |
293 | 293 |
294 if __name__ == '__main__': | 294 if __name__ == '__main__': |
295 sys.exit(main(sys.argv)) | 295 sys.exit(main(sys.argv)) |
OLD | NEW |