| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/python | |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 # This script scans a directory tree for any .mojom files and outputs a list. | |
| 7 | |
| 8 import argparse | |
| 9 import os | |
| 10 import sys | |
| 11 | |
| 12 def main(args): | |
| 13 parser = argparse.ArgumentParser( | |
| 14 description='Prints list of generated dart binding source files.') | |
| 15 parser.add_argument('source_directory', | |
| 16 metavar='source_directory', | |
| 17 help='Path to source directory tree containing .mojom' | |
| 18 ' files') | |
| 19 parser.add_argument('relative_directory_root', | |
| 20 metavar='relative_directory_root', | |
| 21 help='Path to directory which all outputted paths will' | |
| 22 'be relative to.') | |
| 23 args = parser.parse_args() | |
| 24 # Directory to start searching for .mojom files. | |
| 25 source_directory = args.source_directory | |
| 26 # Prefix to chop off output. | |
| 27 root_prefix = os.path.abspath(args.relative_directory_root) | |
| 28 for dirname, dirnames, filenames in os.walk(source_directory): | |
| 29 # filter for .mojom files. | |
| 30 filenames = [f for f in filenames if f.endswith('.mojom')] | |
| 31 # Skip any directories that start with 'test'. | |
| 32 dirnames[:] = [d for d in dirnames if not d.startswith('test')] | |
| 33 for f in filenames: | |
| 34 path = os.path.abspath(os.path.join(dirname, f)) | |
| 35 path = os.path.relpath(path, root_prefix) | |
| 36 print(path) | |
| 37 | |
| 38 if __name__ == '__main__': | |
| 39 sys.exit(main(sys.argv[1:])) | |
| 40 | |
| OLD | NEW |