Skip to content

Commit 4bd3f0e

Browse files
authored
Bootstrap: update logic to support pre-and post python 3.8 (#8446)
PR #8373 (commit ID: 0193d5f) updated a `shutil.copytree(...)` command to pass in the `dirs_exists_ok=True` argument. However, Python added support for the `dirs_exists_ok` argument to `shutil.copytree` in 3.8. Update the function call to inspect the python version, and only add the argument if the script is running in a Python version equal, or higher than 3.8. rdar://147297864
1 parent 79d64b3 commit 4bd3f0e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Utilities/bootstrap

+2-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,8 @@ def install_file(args, src, destination, destination_is_directory=True, ignored_
592592

593593
logging.info("Installing %s to %s", src, dest)
594594
if os.path.isdir(src):
595-
shutil.copytree(src, dest, ignore=shutil.ignore_patterns(*ignored_patterns), dirs_exist_ok=True)
595+
additional_kwargs = { "dirs_exist_ok": True } if sys.version_info.major >=3 and sys.version_info.minor >= 8 else {}
596+
shutil.copytree(src, dest, ignore=shutil.ignore_patterns(*ignored_patterns), **additional_kwargs)
596597
else:
597598
shutil.copy2(src, dest)
598599

0 commit comments

Comments
 (0)