OLD | NEW |
| (Empty) |
1 #!/usr/bin/python | |
2 | |
3 # Copyright 2016 The WebRTC project authors. All Rights Reserved. | |
4 # | |
5 # Use of this source code is governed by a BSD-style license | |
6 # that can be found in the LICENSE file in the root of the source | |
7 # tree. An additional intellectual property rights grant can be found | |
8 # in the file PATENTS. All contributing project authors may | |
9 # be found in the AUTHORS file in the root of the source tree. | |
10 | |
11 """Script for flattening iOS header structure.""" | |
12 | |
13 import optparse | |
14 import os | |
15 import shutil | |
16 import sys | |
17 | |
18 def FlattenHeaders(lib_base_dir, framework_base_dir): | |
19 """Flattens iOS header file directory structure.""" | |
20 include_dir = 'include' | |
21 unflattened_include_dir_path = os.path.join(lib_base_dir, include_dir) | |
22 flattened_include_dir_path = os.path.join(framework_base_dir, include_dir) | |
23 | |
24 # Create output directories. | |
25 if not os.path.exists(framework_base_dir): | |
26 os.mkdir(framework_base_dir) | |
27 if not os.path.exists(flattened_include_dir_path): | |
28 os.mkdir(flattened_include_dir_path) | |
29 | |
30 for dirpath, _, filenames in os.walk(unflattened_include_dir_path): | |
31 for filename in filenames: | |
32 current_path = os.path.join(dirpath, filename) | |
33 new_path = os.path.join(flattened_include_dir_path, filename) | |
34 shutil.copy(current_path, new_path) | |
35 | |
36 def Main(): | |
37 parser = optparse.OptionParser() | |
38 _, args = parser.parse_args() | |
39 if len(args) != 2: | |
40 parser.error('Error: Exactly 2 arguments required.') | |
41 lib_base_dir = args[0] | |
42 framework_base_dir = args[1] | |
43 FlattenHeaders(lib_base_dir, framework_base_dir) | |
44 | |
45 if __name__ == '__main__': | |
46 sys.exit(Main()) | |
OLD | NEW |