OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 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 import csv | |
7 import os | |
6 import sys | 8 import sys |
7 | 9 |
8 from core import path_util | 10 from core import path_util |
9 sys.path.insert(1, path_util.GetTelemetryDir()) # To resolve telemetry imports | 11 sys.path.insert(1, path_util.GetTelemetryDir()) # To resolve telemetry imports |
10 | 12 |
11 import page_sets | 13 import page_sets |
12 | 14 |
13 | 15 |
14 def IterAllSystemHealthStories(): | 16 def IterAllSystemHealthStories(): |
15 for s in page_sets.SystemHealthStorySet(platform='desktop'): | 17 for s in page_sets.SystemHealthStorySet(platform='desktop'): |
16 yield s | 18 yield s |
17 for s in page_sets.SystemHealthStorySet(platform='mobile'): | 19 for s in page_sets.SystemHealthStorySet(platform='mobile'): |
18 if len(s.SUPPORTED_PLATFORMS) < 2: | 20 if len(s.SUPPORTED_PLATFORMS) < 2: |
19 yield s | 21 yield s |
20 | 22 |
23 SYSTEM_HEALTH_CSV = os.path.join(os.path.dirname(__file__), | |
24 'system_health_stories.csv') | |
perezju
2017/05/18 09:52:35
Do we really want to check in the output file to t
nednguyen
2017/05/18 14:02:58
We can then do IMPORTDATA("https://cs.chromium.org
| |
25 | |
21 | 26 |
22 def main(): | 27 def main(): |
23 system_health_stories = list(IterAllSystemHealthStories()) | 28 system_health_stories = list(IterAllSystemHealthStories()) |
24 system_health_stories.sort(key=lambda s: s.name) | 29 system_health_stories.sort(key=lambda s: s.name) |
25 print '{0:60} {1}'.format('Story name', 'Supported platform') | 30 with open(SYSTEM_HEALTH_CSV, 'w') as f: |
26 print '-' * 79 | 31 csv_writer = csv.writer(f) |
27 for s in system_health_stories: | 32 csv_writer.writerow([ |
28 p = s.SUPPORTED_PLATFORMS | 33 'Story name', 'Platform', 'Description']) |
29 if len(p) == 2: | 34 for s in system_health_stories: |
30 p = 'all' | 35 p = s.SUPPORTED_PLATFORMS |
31 else: | 36 if len(p) == 2: |
32 p = list(p)[0] | 37 p = 'all' |
33 print '{0:60} {1}'.format(s.name, p) | 38 else: |
39 p = list(p)[0] | |
40 csv_writer.writerow([s.name, p, s.GetStoryDescription()]) | |
34 return 0 | 41 return 0 |
35 | 42 |
36 | 43 |
37 if __name__ == '__main__': | 44 if __name__ == '__main__': |
38 sys.exit(main()) | 45 sys.exit(main()) |
OLD | NEW |