OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2012 the V8 project authors. All rights reserved. | 3 # Copyright 2012 the V8 project authors. All rights reserved. |
4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
6 # met: | 6 # met: |
7 # | 7 # |
8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 # Helper for getting directory pieces. | 172 # Helper for getting directory pieces. |
173 dirs = lambda f: dirname(f).split(os.sep) | 173 dirs = lambda f: dirname(f).split(os.sep) |
174 | 174 |
175 # Path offsets where to look (to be in sync with RunOnPath). | 175 # Path offsets where to look (to be in sync with RunOnPath). |
176 # Normalize '.' to check for it with str.startswith. | 176 # Normalize '.' to check for it with str.startswith. |
177 search_paths = [('' if p == '.' else p) for p in self.GetPathsToSearch()] | 177 search_paths = [('' if p == '.' else p) for p in self.GetPathsToSearch()] |
178 | 178 |
179 all_files = [ | 179 all_files = [ |
180 f.AbsoluteLocalPath() | 180 f.AbsoluteLocalPath() |
181 for f in files | 181 for f in files |
182 if (os.path.isfile(f.AbsoluteLocalPath()) and | 182 if (not self.IgnoreFile(f.LocalPath()) and |
183 not self.IgnoreFile(f.LocalPath()) and | |
184 self.IsRelevant(f.LocalPath()) and | 183 self.IsRelevant(f.LocalPath()) and |
185 all(not self.IgnoreDir(d) for d in dirs(f.LocalPath())) and | 184 all(not self.IgnoreDir(d) for d in dirs(f.LocalPath())) and |
186 any(map(f.LocalPath().startswith, search_paths))) | 185 any(map(f.LocalPath().startswith, search_paths))) |
187 ] | 186 ] |
188 | 187 |
189 return self.ProcessFiles(all_files) | 188 return self.ProcessFiles(all_files) |
190 | 189 |
191 def IgnoreDir(self, name): | 190 def IgnoreDir(self, name): |
192 return (name.startswith('.') or | 191 return (name.startswith('.') or |
193 name in ('buildtools', 'data', 'gmock', 'gtest', 'kraken', | 192 name in ('buildtools', 'data', 'gmock', 'gtest', 'kraken', |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 success &= SourceProcessor().RunOnPath(workspace) | 521 success &= SourceProcessor().RunOnPath(workspace) |
523 success &= CheckStatusFiles(workspace) | 522 success &= CheckStatusFiles(workspace) |
524 if success: | 523 if success: |
525 return 0 | 524 return 0 |
526 else: | 525 else: |
527 return 1 | 526 return 1 |
528 | 527 |
529 | 528 |
530 if __name__ == '__main__': | 529 if __name__ == '__main__': |
531 sys.exit(Main()) | 530 sys.exit(Main()) |
OLD | NEW |