(src, dst, excludes=None)
| 2496 | |
| 2497 | |
| 2498 | def safe_copytree(src, dst, excludes=None): |
| 2499 | # We cannot use `shutil.copytree` there because we need to ensure the |
| 2500 | # output tree is writable, and in some cases the emscripten tree |
| 2501 | # itself is readonly (e.g. NixOS). |
| 2502 | # Even if we pass copy_function=safe_copy python's `shutil.copytree` |
| 2503 | # will use its internal logic for copying directories and it will |
| 2504 | # unconditionally copy the source directory's mode bits. |
| 2505 | os.makedirs(dst, exist_ok=True) |
| 2506 | for entry in os.scandir(src): |
| 2507 | if excludes and entry.name in excludes: |
| 2508 | continue |
| 2509 | srcname = os.path.join(src, entry.name) |
| 2510 | dstname = os.path.join(dst, entry.name) |
| 2511 | if entry.is_dir(): |
| 2512 | safe_copytree(srcname, dstname, excludes) |
| 2513 | else: |
| 2514 | utils.safe_copy(srcname, dstname) |
| 2515 | |
| 2516 | |
| 2517 | def install_system_headers(stamp): |
no test coverage detected