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
4 # found in the LICENSE file.
6 """A simple tool to go through histograms.xml and print out the owners for
10 import xml.etree.ElementTree
12 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed."
15 tree = xml.etree.ElementTree.parse('histograms.xml')
17 assert root.tag == 'histogram-configuration'
19 root_children = root.getchildren()
21 for node in root_children:
22 if node.tag == 'histograms':
25 assert histograms != None
27 for histogram in histograms.getchildren():
28 if histogram.tag != 'histogram':
31 name = histogram.attrib['name']
34 for node in histogram.getchildren():
35 if node.tag == 'obsolete':
38 if node.tag != 'owner':
40 if node.text == DUMMY_OWNER:
42 assert '@' in node.text
43 owners.append(node.text)
47 print name, ' '.join(owners)
49 print name, 'NO_OWNER'
51 if __name__ == '__main__':