(src_root, dest_root, override=True, symlink=False)
| 18 | |
| 19 | |
| 20 | def copy_files(src_root, dest_root, override=True, symlink=False): |
| 21 | for root, dirnames, filenames in walk(src_root): |
| 22 | for filename in filenames: |
| 23 | subdir = normpath(root.replace(src_root, "")) |
| 24 | if subdir.startswith(sep): # ensure it is relative |
| 25 | subdir = subdir[1:] |
| 26 | dest_dir = join(dest_root, subdir) |
| 27 | if not os.path.exists(dest_dir): |
| 28 | os.makedirs(dest_dir) |
| 29 | src_file = join(root, filename) |
| 30 | dest_file = join(dest_dir, filename) |
| 31 | if os.path.isfile(src_file): |
| 32 | if override and os.path.exists(dest_file): |
| 33 | os.unlink(dest_file) |
| 34 | if not os.path.exists(dest_file): |
| 35 | if symlink: |
| 36 | os.symlink(src_file, dest_file) |
| 37 | else: |
| 38 | shutil.copy(src_file, dest_file) |
| 39 | else: |
| 40 | os.makedirs(dest_file) |
| 41 | |
| 42 | |
| 43 | default_recipe_priorities = [ |
no outgoing calls
no test coverage detected