OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 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 """ Download the SKPs. """ | 6 """ Download the SKPs. """ |
7 | 7 |
8 from build_step import BuildStep | 8 from build_step import BuildStep |
9 from utils import gs_utils | 9 from utils import gs_utils |
10 from utils import sync_bucket_subdir | 10 from utils import sync_bucket_subdir |
11 import compare_and_upload_webpage_gms | 11 import compare_and_upload_webpage_gms |
12 import os | 12 import os |
13 import sys | 13 import sys |
14 | 14 |
15 | 15 |
16 class DownloadSKPs(BuildStep): | 16 class DownloadSKPs(BuildStep): |
17 def __init__(self, timeout=12800, no_output_timeout=9600, **kwargs): | 17 def __init__(self, timeout=12800, no_output_timeout=9600, **kwargs): |
18 super (DownloadSKPs, self).__init__(timeout=timeout, | 18 super (DownloadSKPs, self).__init__( |
19 no_output_timeout=no_output_timeout, | 19 timeout=timeout, |
20 **kwargs) | 20 no_output_timeout=no_output_timeout, |
| 21 **kwargs) |
21 | 22 |
22 def _CreateLocalStorageDirs(self): | 23 def _CreateLocalStorageDirs(self): |
23 """Creates required local storage directories for this script.""" | 24 """Creates required local storage directories for this script.""" |
24 if not os.path.exists(self._local_playback_dirs.PlaybackSkpDir()): | 25 if not os.path.exists(self._local_playback_dirs.PlaybackSkpDir()): |
25 os.makedirs(self._local_playback_dirs.PlaybackSkpDir()) | 26 os.makedirs(self._local_playback_dirs.PlaybackSkpDir()) |
26 | 27 |
27 if os.path.exists(self._local_playback_dirs.PlaybackGmActualDir()): | 28 if os.path.exists(self._local_playback_dirs.PlaybackGmActualDir()): |
28 # Delete everything except the timestamp and last comparison files. | 29 # Delete everything except the timestamp and last comparison files. |
29 for path, _dirs, files in os.walk( | 30 for path, _dirs, files in os.walk( |
30 self._local_playback_dirs.PlaybackGmActualDir()): | 31 self._local_playback_dirs.PlaybackGmActualDir()): |
(...skipping 18 matching lines...) Expand all Loading... |
49 | 50 |
50 def _Run(self): | 51 def _Run(self): |
51 # Create the required local storage directories. | 52 # Create the required local storage directories. |
52 self._CreateLocalStorageDirs() | 53 self._CreateLocalStorageDirs() |
53 | 54 |
54 # Locally copy skps generated by webpages_playback from GoogleStorage. | 55 # Locally copy skps generated by webpages_playback from GoogleStorage. |
55 self._DownloadSKPsFromStorage() | 56 self._DownloadSKPsFromStorage() |
56 | 57 |
57 | 58 |
58 if '__main__' == __name__: | 59 if '__main__' == __name__: |
59 sys.exit(BuildStep.RunBuildStep(DownloadSKPs)) | 60 sys.exit(BuildStep.RunBuildStep(DownloadSKPs)) |
OLD | NEW |