Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace executables with broken symlinks during uv python install #9706

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

zanieb
Copy link
Member

@zanieb zanieb commented Dec 7, 2024

I somehow got in a state where we'd fail to install with

error: Failed to install cpython-3.13.0-macos-aarch64-none
  Caused by: Executable already exists at `/Users/zb/.local/bin/python3` but is not managed by uv; use `--force` to replace it
error: Failed to install cpython-3.13.0-macos-aarch64-none
  Caused by: Executable already exists at `/Users/zb/.local/bin/python` but is not managed by uv; use `--force` to replace it

but python / python3 were managed by uv, they just were linked to an installation that was deleted.

This updates the logic to replace broken executables that are broken symlinks. We apply this to broken links regardless of whether or not we think the target is managed by uv.

@zanieb zanieb added the preview Experimental behavior label Dec 7, 2024
@zanieb zanieb marked this pull request as ready for review December 10, 2024 20:27
@zanieb zanieb force-pushed the zb/link-invalid-install branch from 0a43d5a to 8c363e3 Compare December 10, 2024 20:33
debug!(
"Replacing existing executable at `{}` due to `--force`",
target.simplified_display()
);
Copy link
Member

Choose a reason for hiding this comment

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

This logic only runs on Linux, right? It doesn't look like it's gated, but I assume the error it's handling only runs on Linux?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this technically would run on Windows too (which is valid, you could have a broken symlink it's just rare).

@zanieb zanieb force-pushed the zb/link-invalid-install branch 5 times, most recently from 56415e1 to a26d6c8 Compare December 10, 2024 22:29
@zanieb zanieb force-pushed the zb/link-invalid-install branch from a26d6c8 to 62b4535 Compare December 10, 2024 22:29
@zanieb zanieb enabled auto-merge (squash) December 10, 2024 22:29
@zanieb zanieb merged commit 5894161 into main Dec 10, 2024
64 checks passed
@zanieb zanieb deleted the zb/link-invalid-install branch December 10, 2024 22:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants