OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import argparse | 5 import argparse |
6 import os | 6 import os |
7 import shutil | 7 import shutil |
8 import sys | 8 import sys |
9 | 9 |
10 def touch(fname): | 10 def touch(fname): |
(...skipping 11 matching lines...) Expand all Loading... |
22 'hierarchy.') | 22 'hierarchy.') |
23 parser.add_argument('timestamp', help='The timetsamp file.') | 23 parser.add_argument('timestamp', help='The timetsamp file.') |
24 parser.add_argument('lib_dir', help='The directory containing the modules') | 24 parser.add_argument('lib_dir', help='The directory containing the modules') |
25 parser.add_argument('destination_dir', | 25 parser.add_argument('destination_dir', |
26 help='The destination directory of the module') | 26 help='The destination directory of the module') |
27 parser.add_argument('mappings', nargs='+', | 27 parser.add_argument('mappings', nargs='+', |
28 help='The mapping from module to library.') | 28 help='The mapping from module to library.') |
29 opts = parser.parse_args() | 29 opts = parser.parse_args() |
30 | 30 |
31 if not os.path.exists(opts.destination_dir): | 31 if not os.path.exists(opts.destination_dir): |
32 os.makedirs(opts.destination_dir) | 32 try: |
| 33 os.makedirs(opts.destination_dir) |
| 34 except: |
| 35 # Ignore errors on directory creation. |
| 36 pass |
33 | 37 |
34 for mapping in opts.mappings: | 38 for mapping in opts.mappings: |
35 [module, library] = mapping.split('=') | 39 [module, library] = mapping.split('=') |
36 shutil.copy(os.path.join(opts.lib_dir, library), | 40 shutil.copy(os.path.join(opts.lib_dir, library), |
37 os.path.join(opts.destination_dir, module)) | 41 os.path.join(opts.destination_dir, module)) |
38 | 42 |
39 touch(opts.timestamp) | 43 touch(opts.timestamp) |
40 | 44 |
41 if __name__ == '__main__': | 45 if __name__ == '__main__': |
42 main() | 46 main() |
OLD | NEW |