OLD | NEW |
---|---|
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 Args: | 63 Args: |
64 source: string, path to the source file | 64 source: string, path to the source file |
65 dest: string, path to the destination file | 65 dest: string, path to the destination file |
66 """ | 66 """ |
67 if os.path.isdir(source): | 67 if os.path.isdir(source): |
68 if os.path.exists(dest): | 68 if os.path.exists(dest): |
69 shutil.rmtree(dest) | 69 shutil.rmtree(dest) |
70 # Copy tree. | 70 # Copy tree. |
71 # TODO(thakis): This copies file attributes like mtime, while the | 71 # TODO(thakis): This copies file attributes like mtime, while the |
72 # single-file branch below doesn't. This should probably be changed to | 72 # single-file branch below doesn't. This should probably be changed to |
73 # be consistent with the single-file branch. | 73 # be consistent with the single-file branch. |
Nico
2016/06/09 14:20:53
it looks like this was copy-pasted from somewhere.
Robert Sesek
2016/06/09 14:22:35
It was a boog from before. We never included symli
| |
74 shutil.copytree(source, dest) | 74 shutil.copytree(source, dest, symlinks=True) |
75 return | 75 return |
76 | 76 |
77 if os.path.exists(dest): | 77 if os.path.exists(dest): |
78 os.unlink(dest) | 78 os.unlink(dest) |
79 | 79 |
80 _, extension = os.path.splitext(source) | 80 _, extension = os.path.splitext(source) |
81 if extension == '.strings': | 81 if extension == '.strings': |
82 copy_strings_file(source, dest) | 82 copy_strings_file(source, dest) |
83 return | 83 return |
84 | 84 |
85 shutil.copy(source, dest) | 85 shutil.copy(source, dest) |
86 | 86 |
87 | 87 |
88 def main(): | 88 def main(): |
89 parser = argparse.ArgumentParser( | 89 parser = argparse.ArgumentParser( |
90 description='copy source to destination for the creation of a bundle') | 90 description='copy source to destination for the creation of a bundle') |
91 parser.add_argument('source', help='path to source file or directory') | 91 parser.add_argument('source', help='path to source file or directory') |
92 parser.add_argument('dest', help='path to destination') | 92 parser.add_argument('dest', help='path to destination') |
93 args = parser.parse_args() | 93 args = parser.parse_args() |
94 | 94 |
95 copy_file(args.source, args.dest) | 95 copy_file(args.source, args.dest) |
96 | 96 |
97 if __name__ == '__main__': | 97 if __name__ == '__main__': |
98 main() | 98 main() |
OLD | NEW |