Skip to content

[None][fix] handle broken symlinks in build_wheel.py install_file#13027

Open
zhenhuaw-me wants to merge 1 commit intoNVIDIA:mainfrom
zhenhuaw-me:fix-build
Open

[None][fix] handle broken symlinks in build_wheel.py install_file#13027
zhenhuaw-me wants to merge 1 commit intoNVIDIA:mainfrom
zhenhuaw-me:fix-build

Conversation

@zhenhuaw-me
Copy link
Copy Markdown
Member

@zhenhuaw-me zhenhuaw-me commented Apr 14, 2026

shutil.copy fails with FileNotFoundError when the destination is a broken symlink (e.g., left by a previous pip install -e whose build/lib.* directory was later cleaned). Remove broken symlinks at the destination before copying, matching the existing behavior of the symlink_remove_dst path.

Summary by CodeRabbit

  • Bug Fixes
    • Improved package installation robustness by automatically handling broken symbolic link entries during the installation process, preventing potential failures and ensuring cleaner deployments.

Description

Test Coverage

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

To see a list of available CI bot commands, please comment /bot help.

shutil.copy fails with FileNotFoundError when the destination is a
broken symlink (e.g., left by a previous `pip install -e` whose
build/lib.* directory was later cleaned). Remove broken symlinks at
the destination before copying, matching the existing behavior of the
symlink_remove_dst path.

Signed-off-by: Zhenhua Wang <zhenhuaw@nvidia.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: af70690d-315a-47c5-894b-5b93c68a641d

📥 Commits

Reviewing files that changed from the base of the PR and between bdd5ec6 and 41897c7.

📒 Files selected for processing (1)
  • scripts/build_wheel.py

📝 Walkthrough

Walkthrough

The wheel building script's file copy operation is enhanced with a new wrapper function that explicitly handles broken symlinks by removing them before attempting to copy files. This improves the robustness of the installation process when symlink cleanup is necessary.

Changes

Cohort / File(s) Summary
Symlink-aware Copy Wrapper
scripts/build_wheel.py
Introduced copy_remove_broken_symlink(src, dst) wrapper function to normalize destination paths, optionally append source basename for directory destinations, detect and remove broken symlinks, and perform the copy operation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description explains the issue and solution well, but the description template sections (Description, Test Coverage, PR Checklist) are incomplete—only the issue explanation is provided above the template comments. Fill in the Description and Test Coverage sections with details about what was changed and which tests cover this fix. Complete the PR Checklist by verifying and checking off applicable items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and specifically describes the main change: handling broken symlinks in build_wheel.py's install_file functionality.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant