Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/build_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,16 @@ def main(*,
if cache_dir.exists():
clear_folder(cache_dir)

install_file = copy
def copy_remove_broken_symlink(src, dst):
"""copy() that handles broken symlinks at the destination."""
dst = os.fspath(dst)
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
if os.path.islink(dst) and not os.path.exists(dst):
os.remove(dst)
copy(src, dst)

install_file = copy_remove_broken_symlink

# Wrapper for copytree that checks if source and destination are the same
def safe_copytree(src, dst, dirs_exist_ok=True):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this safe_copytree handle the use case you mentioned correctly?

Expand Down
Loading