Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright 2015 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. | |
| 5 | |
| 6 import sys | |
| 7 import xml.sax | |
| 8 | |
| 9 | |
| 10 class PathsExtractor(xml.sax.ContentHandler): | |
| 11 | |
|
Dan Beam
2015/03/17 18:37:54
nit: not sure if it's typical to put a \n here
dzhioev (left Google)
2015/03/18 16:38:06
"One blank line between method definitions and bet
| |
| 12 def __init__(self): | |
| 13 self.paths = [] | |
| 14 | |
| 15 def startElement(self, name, attrs): | |
| 16 if name != 'structure': | |
| 17 return | |
| 18 path = attrs['file'] | |
| 19 if path.startswith('../../../third_party/web-animations-js'): | |
| 20 return | |
| 21 prefix = '../../../third_party/polymer/components-chromium/' | |
| 22 if not path.startswith(prefix): | |
| 23 raise Exception("Unexpected path %s." % path) | |
| 24 self.paths.append(path[len(prefix):]) | |
| 25 | |
| 26 | |
| 27 def main(argv): | |
| 28 xml_handler = PathsExtractor() | |
| 29 xml.sax.parse(argv[1], xml_handler) | |
| 30 print '\n'.join(sorted(xml_handler.paths)) | |
| 31 | |
| 32 | |
| 33 if __name__ == '__main__': | |
| 34 sys.exit(main(sys.argv)) | |
| OLD | NEW |