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 sys |
| 14 |
| 15 import argparse |
| 16 import os |
| 17 import shutil |
| 18 |
| 19 |
| 20 def FlattenHeaders(input_dir, output_dir): |
| 21 """Flattens iOS header file directory structure.""" |
| 22 # Create output directories. |
| 23 if not os.path.exists(output_dir): |
| 24 os.mkdir(output_dir) |
| 25 |
| 26 for dirpath, _, filenames in os.walk(input_dir): |
| 27 for filename in filenames: |
| 28 current_path = os.path.join(dirpath, filename) |
| 29 new_path = os.path.join(output_dir, filename) |
| 30 shutil.copy(current_path, new_path) |
| 31 |
| 32 |
| 33 def Main(): |
| 34 parser_description = 'Flatten WebRTC ObjC API headers.' |
| 35 parser = argparse.ArgumentParser(description=parser_description) |
| 36 parser.add_argument('input_dir', |
| 37 help='Output directory to write headers to.', |
| 38 type=str) |
| 39 parser.add_argument('output_dir', |
| 40 help='Input directory to read headers from.', |
| 41 type=str) |
| 42 args = parser.parse_args() |
| 43 input_dir = args.input_dir |
| 44 output_dir = args.output_dir |
| 45 FlattenHeaders(input_dir, output_dir) |
| 46 |
| 47 |
| 48 if __name__ == '__main__': |
| 49 sys.exit(Main()) |
OLD | NEW |