| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import copy | 6 import copy |
| 7 import database | 7 import database |
| 8 import idlparser | 8 import idlparser |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 for condition in conditional.split('&'): | 521 for condition in conditional.split('&'): |
| 522 if not enabled(condition): | 522 if not enabled(condition): |
| 523 return False | 523 return False |
| 524 return True | 524 return True |
| 525 | 525 |
| 526 for condition in conditional.split('|'): | 526 for condition in conditional.split('|'): |
| 527 if enabled(condition): | 527 if enabled(condition): |
| 528 return True | 528 return True |
| 529 return False | 529 return False |
| 530 | 530 |
| 531 def import_idl_directory(self, directory_path, | |
| 532 import_options=DatabaseBuilderOptions()): | |
| 533 """Parses, loads into memory and cleans up all IDL files in a given | |
| 534 directory""" | |
| 535 if not os.path.exists(directory_path): | |
| 536 raise RuntimeError('directory not found: %s' % directory_path) | |
| 537 | |
| 538 def visitor(arg, dir_name, names): | |
| 539 module = dir_name[len(directory_path) + 1:] | |
| 540 for name in names: | |
| 541 file_name = os.path.join(dir_name, name) | |
| 542 (interface, ext) = os.path.splitext(file_name) | |
| 543 if ext == '.idl' and not name.startswith('._'): | |
| 544 self.import_idl_file(file_name, import_options) | |
| 545 os.path.walk(directory_path, visitor, None) | |
| 546 | |
| 547 def fix_displacements(self, source): | 531 def fix_displacements(self, source): |
| 548 """E.g. In W3C, something is declared on HTMLDocument but in WebKit | 532 """E.g. In W3C, something is declared on HTMLDocument but in WebKit |
| 549 its on Document, so we need to mark that something in HTMLDocument | 533 its on Document, so we need to mark that something in HTMLDocument |
| 550 with @WebKit(via=Document). The 'via' attribute specifies the | 534 with @WebKit(via=Document). The 'via' attribute specifies the |
| 551 parent interface that has the declaration.""" | 535 parent interface that has the declaration.""" |
| 552 | 536 |
| 553 for interface in self._database.GetInterfaces(): | 537 for interface in self._database.GetInterfaces(): |
| 554 changed = False | 538 changed = False |
| 555 | 539 |
| 556 _logger.info('fixing displacements in %s' % interface.id) | 540 _logger.info('fixing displacements in %s' % interface.id) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 annotation = idl_node.annotations[source] | 590 annotation = idl_node.annotations[source] |
| 607 for name, value in annotation.items(): | 591 for name, value in annotation.items(): |
| 608 if (name in top_level_annotation | 592 if (name in top_level_annotation |
| 609 and value == top_level_annotation[name]): | 593 and value == top_level_annotation[name]): |
| 610 del annotation[name] | 594 del annotation[name] |
| 611 | 595 |
| 612 map(normalize, interface.parents) | 596 map(normalize, interface.parents) |
| 613 map(normalize, interface.constants) | 597 map(normalize, interface.constants) |
| 614 map(normalize, interface.attributes) | 598 map(normalize, interface.attributes) |
| 615 map(normalize, interface.operations) | 599 map(normalize, interface.operations) |
| OLD | NEW |