| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC
-Extended-attribute-validation | 31 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler#TOC
-Extended-attribute-validation |
| 32 """ | 32 """ |
| 33 | 33 |
| 34 | 34 |
| 35 import os.path | 35 import os.path |
| 36 import re | 36 import re |
| 37 | 37 |
| 38 module_path = os.path.dirname(__file__) | 38 module_path = os.path.dirname(__file__) |
| 39 source_path = os.path.join(module_path, os.pardir, os.pardir) | 39 source_path = os.path.join(module_path, os.pardir, os.pardir) |
| 40 EXTENDED_ATTRIBUTES_RELATIVE_PATH = os.path.join('bindings', | 40 EXTENDED_ATTRIBUTES_RELATIVE_PATH = os.path.join('bindings2', |
| 41 'IDLExtendedAttributes.txt') | 41 'IDLExtendedAttributes.txt') |
| 42 EXTENDED_ATTRIBUTES_FILENAME = os.path.join(source_path, | 42 EXTENDED_ATTRIBUTES_FILENAME = os.path.join(source_path, |
| 43 EXTENDED_ATTRIBUTES_RELATIVE_PATH) | 43 EXTENDED_ATTRIBUTES_RELATIVE_PATH) |
| 44 | 44 |
| 45 class IDLInvalidExtendedAttributeError(Exception): | 45 class IDLInvalidExtendedAttributeError(Exception): |
| 46 pass | 46 pass |
| 47 | 47 |
| 48 | 48 |
| 49 class IDLExtendedAttributeValidator(object): | 49 class IDLExtendedAttributeValidator(object): |
| 50 def __init__(self): | 50 def __init__(self): |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 yield name, value_list | 101 yield name, value_list |
| 102 | 102 |
| 103 valid_extended_attributes = {} | 103 valid_extended_attributes = {} |
| 104 for name, value_list in extended_attribute_name_values(): | 104 for name, value_list in extended_attribute_name_values(): |
| 105 if not value_list: | 105 if not value_list: |
| 106 valid_extended_attributes[name] = set([None]) | 106 valid_extended_attributes[name] = set([None]) |
| 107 continue | 107 continue |
| 108 valid_extended_attributes[name] = set([value if value else None | 108 valid_extended_attributes[name] = set([value if value else None |
| 109 for value in value_list]) | 109 for value in value_list]) |
| 110 return valid_extended_attributes | 110 return valid_extended_attributes |
| OLD | NEW |