Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: mojo/public/tools/dart_list_mojoms.py

Issue 1164323002: Fixup Sky and Mojo dart pkg's exported mojoms (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This script scans a directory tree for any .mojom files and outputs a list. 6 # This script scans a directory tree for any .mojom files and outputs a list.
7 7
8 import argparse 8 import argparse
9 import os 9 import os
10 import sys 10 import sys
11 11
12 def main(args): 12 def main(args):
13 parser = argparse.ArgumentParser( 13 parser = argparse.ArgumentParser(
14 description='Prints list of generated dart binding source files.') 14 description='Prints list of generated dart binding source files.')
15 parser.add_argument('source_directory', 15 parser.add_argument('source_directory',
16 metavar='source_directory', 16 metavar='source_directory',
17 help='Path to source directory tree containing .mojom' 17 help='Path to source directory tree containing .mojom'
18 ' files') 18 ' files')
19 parser.add_argument('relative_directory_root', 19 parser.add_argument('relative_directory_root',
20 metavar='relative_directory_root', 20 metavar='relative_directory_root',
21 help='Path to directory which all outputted paths will' 21 help='Path to directory which all outputted paths will'
22 'be relative to.') 22 'be relative to.')
23 args = parser.parse_args() 23 args = parser.parse_args()
24 # Directory to start searching for .mojom files. 24 # Directory to start searching for .mojom files.
25 source_directory = args.source_directory 25 source_directory = args.source_directory
26 # Prefix to chop off output. 26 # Prefix to chop off output.
27 root_prefix = os.path.abspath(args.relative_directory_root) 27 root_prefix = os.path.abspath(args.relative_directory_root)
28 for dirname, _, filenames in os.walk(source_directory): 28 for dirname, dirnames, filenames in os.walk(source_directory):
29 # filter for .mojom files. 29 # filter for .mojom files.
30 filenames = [f for f in filenames if f.endswith('.mojom')] 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')]
31 for f in filenames: 33 for f in filenames:
32 path = os.path.abspath(os.path.join(dirname, f)) 34 path = os.path.abspath(os.path.join(dirname, f))
33 path = os.path.relpath(path, root_prefix) 35 path = os.path.relpath(path, root_prefix)
34 print(path) 36 print(path)
35 37
36 if __name__ == '__main__': 38 if __name__ == '__main__':
37 sys.exit(main(sys.argv[1:])) 39 sys.exit(main(sys.argv[1:]))
38 40
OLDNEW
« mojo/public/dart/BUILD.gn ('K') | « mojo/public/dart/BUILD.gn ('k') | sky/sdk/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698