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 11 matching lines...) Expand all Loading... |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 """This file returns a list of all the IDL files that contain a partial interfac
e.""" | 29 """This file returns a list of all the IDL files that contain a partial interfac
e.""" |
30 | 30 |
31 import re | 31 import re |
32 import sys | |
33 | 32 |
34 partial_interface_regex = re.compile(r'partial\s+interface\s+(\w+).+\]', re.M |
re.S) | 33 PARTIAL_INTERFACE_RE = re.compile(r'partial\s+interface\s+(\w+)\s[^{]*\{', |
| 34 re.MULTILINE) |
| 35 |
| 36 |
| 37 def contains_partial_interface(filename): |
| 38 with open(filename) as f: |
| 39 return bool(re.search(PARTIAL_INTERFACE_RE, f.read())) |
35 | 40 |
36 | 41 |
37 def DoMain(filenames): | 42 def DoMain(filenames): |
38 partial_files = set() | 43 partial_interface_filenames = [filename for filename in filenames |
39 for filename in filenames: | 44 if contains_partial_interface(filename)] |
40 with open(filename) as f: | 45 return '\n'.join(partial_interface_filenames) |
41 match = re.search(partial_interface_regex, f.read()) | |
42 if match: | |
43 partial_files.add(filename) | |
44 return '\n'.join(partial_files) | |
OLD | NEW |