OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 """A helper script for setting up forwarding headers.""" | 6 """A helper script for setting up forwarding headers.""" |
7 | 7 |
8 import errno | 8 import errno |
9 import os | 9 import os |
10 import sys | 10 import sys |
11 | 11 |
12 | 12 |
13 def GetHeaderFilesInDir(dir_path): | 13 def GetHeaderFilesInDir(dir_path): |
14 """Return a list of all header files in dir_path.""" | 14 """Return a list of all header files in dir_path.""" |
15 all_files = [] | 15 all_files = [] |
16 for root, dirs, files in os.walk(dir_path): | 16 for root, dirs, files in os.walk(dir_path): |
17 all_files.extend([os.path.join(root, f) for f in files if f.endswith('.h')]) | 17 all_files.extend([os.path.join(root, f).replace(os.sep, '/') |
| 18 for f in files if f.endswith('.h')]) |
18 return all_files | 19 return all_files |
19 | 20 |
20 | 21 |
21 def Inputs(args): | 22 def Inputs(args): |
22 """List the files in the provided input dir. | 23 """List the files in the provided input dir. |
23 | 24 |
24 args: A list with 1 value, the input dir. | 25 args: A list with 1 value, the input dir. |
25 Returns: 0 on success, other value on error.""" | 26 Returns: 0 on success, other value on error.""" |
26 if len(args) != 1: | 27 if len(args) != 1: |
27 print "'inputs' expects only one input directory." | 28 print "'inputs' expects only one input directory." |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 'outputs': Outputs, | 120 'outputs': Outputs, |
120 'setup_headers': SetupHeaders, | 121 'setup_headers': SetupHeaders, |
121 } | 122 } |
122 command = argv[1] | 123 command = argv[1] |
123 args = argv[2:] | 124 args = argv[2:] |
124 return commands[command](args) | 125 return commands[command](args) |
125 | 126 |
126 | 127 |
127 if __name__ == '__main__': | 128 if __name__ == '__main__': |
128 sys.exit(Main(sys.argv)) | 129 sys.exit(Main(sys.argv)) |
OLD | NEW |