| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 while try_abbreviating(self._collapsing_sets_by_size.values()): | 287 while try_abbreviating(self._collapsing_sets_by_size.values()): |
| 288 pass | 288 pass |
| 289 | 289 |
| 290 # 4) Substitute specifier subsets that match macros within each set: | 290 # 4) Substitute specifier subsets that match macros within each set: |
| 291 # (win7, win10, release) -> (win, release) | 291 # (win7, win10, release) -> (win, release) |
| 292 self.collapse_macros(self._configuration_macros, specifiers_list) | 292 self.collapse_macros(self._configuration_macros, specifiers_list) |
| 293 | 293 |
| 294 macro_keys = set(self._configuration_macros.keys()) | 294 macro_keys = set(self._configuration_macros.keys()) |
| 295 | 295 |
| 296 # 5) Collapsing macros may have created combinations the can now be abbr
eviated. | 296 # 5) Collapsing macros may have created combinations the can now be abbr
eviated. |
| 297 # (win7, release), (linux, x86, release), (linux, x86_64, release) -->
(win7, release), (linux, release) --> (win7, linux, release) | 297 # (win7, release), (linux, x86, release), (linux, x86_64, release) |
| 298 # --> (win7, release), (linux, release) --> (win7, linux, release) |
| 298 while try_abbreviating([self._collapsing_sets_by_category['version'] | m
acro_keys]): | 299 while try_abbreviating([self._collapsing_sets_by_category['version'] | m
acro_keys]): |
| 299 pass | 300 pass |
| 300 | 301 |
| 301 # 6) Remove cases where we have collapsed but have all macros. | 302 # 6) Remove cases where we have collapsed but have all macros. |
| 302 # (android, win, mac, linux, release) --> (release) | 303 # (android, win, mac, linux, release) --> (release) |
| 303 specifiers_to_remove = [] | 304 specifiers_to_remove = [] |
| 304 for specifier_set in specifiers_list: | 305 for specifier_set in specifiers_list: |
| 305 if macro_keys <= specifier_set: | 306 if macro_keys <= specifier_set: |
| 306 specifiers_to_remove.append(specifier_set) | 307 specifiers_to_remove.append(specifier_set) |
| 307 | 308 |
| 308 for specifier_set in specifiers_to_remove: | 309 for specifier_set in specifiers_to_remove: |
| 309 specifiers_list.remove(specifier_set) | 310 specifiers_list.remove(specifier_set) |
| 310 specifiers_list.append(frozenset(specifier_set - macro_keys)) | 311 specifiers_list.append(frozenset(specifier_set - macro_keys)) |
| 311 | 312 |
| 312 return specifiers_list | 313 return specifiers_list |
| OLD | NEW |