MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / safe_copytree

Function safe_copytree

tools/system_libs.py:2498–2514  ·  view source on GitHub ↗
(src, dst, excludes=None)

Source from the content-addressed store, hash-verified

2496
2497
2498def 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
2517def install_system_headers(stamp):

Callers 1

install_system_headersFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected