OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 # Copyright 2014 Google Inc. | 3 # Copyright 2014 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 import collections | 8 import collections |
9 import types | 9 import types |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 Number of items in the set. | 50 Number of items in the set. |
51 """ | 51 """ |
52 return len(self.__li) | 52 return len(self.__li) |
53 | 53 |
54 def __getitem__(self, index): | 54 def __getitem__(self, index): |
55 """ | 55 """ |
56 Return item at index. | 56 Return item at index. |
57 """ | 57 """ |
58 return self.__li[index] | 58 return self.__li[index] |
59 | 59 |
| 60 def reset(self): |
| 61 """ |
| 62 Reset to empty. |
| 63 """ |
| 64 self.__li = [] |
| 65 |
60 VAR_NAMES = ['LOCAL_CFLAGS', | 66 VAR_NAMES = ['LOCAL_CFLAGS', |
61 'LOCAL_CPPFLAGS', | 67 'LOCAL_CPPFLAGS', |
62 'LOCAL_SRC_FILES', | 68 'LOCAL_SRC_FILES', |
63 'LOCAL_SHARED_LIBRARIES', | 69 'LOCAL_SHARED_LIBRARIES', |
64 'LOCAL_STATIC_LIBRARIES', | 70 'LOCAL_STATIC_LIBRARIES', |
65 'LOCAL_C_INCLUDES', | 71 'LOCAL_C_INCLUDES', |
66 'LOCAL_EXPORT_C_INCLUDE_DIRS', | 72 'LOCAL_EXPORT_C_INCLUDE_DIRS', |
| 73 'DEFINES', |
67 'KNOWN_TARGETS'] | 74 'KNOWN_TARGETS'] |
68 | 75 |
69 class VarsDict(collections.namedtuple('VarsDict', VAR_NAMES)): | 76 class VarsDict(collections.namedtuple('VarsDict', VAR_NAMES)): |
70 """ | 77 """ |
71 Custom class for storing the arguments to Android.mk variables. Can be | 78 Custom class for storing the arguments to Android.mk variables. Can be |
72 treated as a dictionary with fixed keys. | 79 treated as a dictionary with fixed keys. |
73 """ | 80 """ |
74 | 81 |
75 __slots__ = () | 82 __slots__ = () |
76 | 83 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 for var_dict in other_var_dicts: | 131 for var_dict in other_var_dicts: |
125 if not item in var_dict[key]: | 132 if not item in var_dict[key]: |
126 in_all_lists = False | 133 in_all_lists = False |
127 break | 134 break |
128 if in_all_lists: | 135 if in_all_lists: |
129 intersection[key].add(item) | 136 intersection[key].add(item) |
130 for var_dict in var_dict_list: | 137 for var_dict in var_dict_list: |
131 var_dict[key].remove(item) | 138 var_dict[key].remove(item) |
132 return intersection | 139 return intersection |
133 | 140 |
OLD | NEW |