OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 """A simple tool to go through histograms.xml and print out the owners for | 6 """A simple tool to go through histograms.xml and print out the owners for |
7 histograms. | 7 histograms. |
8 """ | 8 """ |
9 | 9 |
| 10 import os |
| 11 import sys |
10 import xml.etree.ElementTree | 12 import xml.etree.ElementTree |
11 | 13 |
| 14 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # tools/metrics |
| 15 from common import path_util |
| 16 |
12 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed." | 17 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed." |
13 | 18 |
14 def main(): | 19 def main(): |
15 tree = xml.etree.ElementTree.parse('histograms.xml') | 20 tree = xml.etree.ElementTree.parse(path_util.GetHistogramsFile()) |
16 root = tree.getroot() | 21 root = tree.getroot() |
17 assert root.tag == 'histogram-configuration' | 22 assert root.tag == 'histogram-configuration' |
18 | 23 |
19 root_children = root.getchildren() | 24 root_children = root.getchildren() |
20 histograms = None | 25 histograms = None |
21 for node in root_children: | 26 for node in root_children: |
22 if node.tag == 'histograms': | 27 if node.tag == 'histograms': |
23 histograms = node | 28 histograms = node |
24 break | 29 break |
25 assert histograms != None | 30 assert histograms != None |
(...skipping 17 matching lines...) Expand all Loading... |
43 owners.append(node.text) | 48 owners.append(node.text) |
44 | 49 |
45 if not obsolete: | 50 if not obsolete: |
46 if owners: | 51 if owners: |
47 print name, ' '.join(owners) | 52 print name, ' '.join(owners) |
48 else: | 53 else: |
49 print name, 'NO_OWNER' | 54 print name, 'NO_OWNER' |
50 | 55 |
51 if __name__ == '__main__': | 56 if __name__ == '__main__': |
52 main() | 57 main() |
OLD | NEW |