| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client 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 import fnmatch | 6 import fnmatch |
| 7 import glob | 7 import glob |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import shutil | 10 import shutil |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 125 |
| 126 src_list = [] | 126 src_list = [] |
| 127 for src in srcs: | 127 for src in srcs: |
| 128 files = glob.glob(src) | 128 files = glob.glob(src) |
| 129 if len(files) == 0: | 129 if len(files) == 0: |
| 130 raise OSError('cp: no such file or directory: ' + src) | 130 raise OSError('cp: no such file or directory: ' + src) |
| 131 if files: | 131 if files: |
| 132 src_list.extend(files) | 132 src_list.extend(files) |
| 133 | 133 |
| 134 for src in src_list: | 134 for src in src_list: |
| 135 if options.verbose: | |
| 136 print 'cp %s %s' % (src, dst) | |
| 137 # If the destination is a directory, then append the basename of the src | 135 # If the destination is a directory, then append the basename of the src |
| 138 # to the destination. | 136 # to the destination. |
| 139 if os.path.isdir(dst): | 137 if os.path.isdir(dst): |
| 140 CopyPath(options, src, os.path.join(dst, os.path.basename(src))) | 138 CopyPath(options, src, os.path.join(dst, os.path.basename(src))) |
| 141 else: | 139 else: |
| 142 CopyPath(options, src, dst) | 140 CopyPath(options, src, dst) |
| 143 | 141 |
| 144 | 142 |
| 145 def Mkdir(args): | 143 def Mkdir(args): |
| 146 """A Unix style mkdir""" | 144 """A Unix style mkdir""" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 'rm': Remove, | 301 'rm': Remove, |
| 304 } | 302 } |
| 305 | 303 |
| 306 | 304 |
| 307 if __name__ == '__main__': | 305 if __name__ == '__main__': |
| 308 func = FuncMap.get(sys.argv[1]) | 306 func = FuncMap.get(sys.argv[1]) |
| 309 if not func: | 307 if not func: |
| 310 print 'Do not recognize: ' + sys.argv[1] | 308 print 'Do not recognize: ' + sys.argv[1] |
| 311 sys.exit(1) | 309 sys.exit(1) |
| 312 sys.exit(func(sys.argv[2:])) | 310 sys.exit(func(sys.argv[2:])) |
| OLD | NEW |