| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """Convert Android xml resources to API 14 compatible. | 7 """Convert Android xml resources to API 14 compatible. |
| 8 | 8 |
| 9 There are two reasons that we cannot just use API 17 attributes, | 9 There are two reasons that we cannot just use API 17 attributes, |
| 10 so we are generating another set of resources by this script. | 10 so we are generating another set of resources by this script. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if node.nodeType == node.ELEMENT_NODE: | 62 if node.nodeType == node.ELEMENT_NODE: |
| 63 yield node | 63 yield node |
| 64 for child_node in node.childNodes: | 64 for child_node in node.childNodes: |
| 65 for child_node_element in IterateXmlElements(child_node): | 65 for child_node_element in IterateXmlElements(child_node): |
| 66 yield child_node_element | 66 yield child_node_element |
| 67 | 67 |
| 68 | 68 |
| 69 def ParseAndReportErrors(filename): | 69 def ParseAndReportErrors(filename): |
| 70 try: | 70 try: |
| 71 return minidom.parse(filename) | 71 return minidom.parse(filename) |
| 72 except Exception: | 72 except Exception: # pylint: disable=broad-except |
| 73 import traceback | 73 import traceback |
| 74 traceback.print_exc() | 74 traceback.print_exc() |
| 75 sys.stderr.write('Failed to parse XML file: %s\n' % filename) | 75 sys.stderr.write('Failed to parse XML file: %s\n' % filename) |
| 76 sys.exit(1) | 76 sys.exit(1) |
| 77 | 77 |
| 78 | 78 |
| 79 def AssertNotDeprecatedAttribute(name, value, filename): | 79 def AssertNotDeprecatedAttribute(name, value, filename): |
| 80 """Raises an exception if the given attribute is deprecated.""" | 80 """Raises an exception if the given attribute is deprecated.""" |
| 81 msg = None | 81 msg = None |
| 82 if name in ATTRIBUTES_TO_MAP_REVERSED: | 82 if name in ATTRIBUTES_TO_MAP_REVERSED: |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 build_utils.MakeDirectory(res_v14_dir) | 315 build_utils.MakeDirectory(res_v14_dir) |
| 316 | 316 |
| 317 GenerateV14Resources(options.res_dir, res_v14_dir) | 317 GenerateV14Resources(options.res_dir, res_v14_dir) |
| 318 | 318 |
| 319 if options.stamp: | 319 if options.stamp: |
| 320 build_utils.Touch(options.stamp) | 320 build_utils.Touch(options.stamp) |
| 321 | 321 |
| 322 if __name__ == '__main__': | 322 if __name__ == '__main__': |
| 323 sys.exit(main()) | 323 sys.exit(main()) |
| 324 | 324 |
| OLD | NEW |