| 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 xml.etree.ElementTree | 10 import xml.etree.ElementTree |
| 11 | 11 |
| 12 import histograms_path |
| 13 |
| 12 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed." | 14 DUMMY_OWNER = "Please list the metric's owners. Add more owner tags as needed." |
| 13 | 15 |
| 14 def main(): | 16 def main(): |
| 15 tree = xml.etree.ElementTree.parse('histograms.xml') | 17 tree = xml.etree.ElementTree.parse(histograms_path.GetHistogramsFile()) |
| 16 root = tree.getroot() | 18 root = tree.getroot() |
| 17 assert root.tag == 'histogram-configuration' | 19 assert root.tag == 'histogram-configuration' |
| 18 | 20 |
| 19 root_children = root.getchildren() | 21 root_children = root.getchildren() |
| 20 histograms = None | 22 histograms = None |
| 21 for node in root_children: | 23 for node in root_children: |
| 22 if node.tag == 'histograms': | 24 if node.tag == 'histograms': |
| 23 histograms = node | 25 histograms = node |
| 24 break | 26 break |
| 25 assert histograms != None | 27 assert histograms != None |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 owners.append(node.text) | 45 owners.append(node.text) |
| 44 | 46 |
| 45 if not obsolete: | 47 if not obsolete: |
| 46 if owners: | 48 if owners: |
| 47 print name, ' '.join(owners) | 49 print name, ' '.join(owners) |
| 48 else: | 50 else: |
| 49 print name, 'NO_OWNER' | 51 print name, 'NO_OWNER' |
| 50 | 52 |
| 51 if __name__ == '__main__': | 53 if __name__ == '__main__': |
| 52 main() | 54 main() |
| OLD | NEW |