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

Treat missing top_level.txt as non-fatal #6881

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion crates/uv/src/commands/pip/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,15 @@ pub(crate) async fn install(
install_wheel_rs::Error::MissingRecord(_),
)) => {
warn_user!(
"Failed to uninstall package at {} due to missing RECORD file. Installation may result in an incomplete environment.",
"Failed to uninstall package at {} due to missing `RECORD` file. Installation may result in an incomplete environment.",
dist_info.path().user_display().cyan(),
);
}
Err(uv_installer::UninstallError::Uninstall(
install_wheel_rs::Error::MissingTopLevel(_),
)) => {
warn_user!(
"Failed to uninstall package at {} due to missing `top-level.txt` file. Installation may result in an incomplete environment.",
dist_info.path().user_display().cyan(),
);
}
Expand Down
39 changes: 38 additions & 1 deletion crates/uv/tests/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ fn reinstall_incomplete() -> Result<()> {
----- stderr -----
Resolved 3 packages in [TIME]
Prepared 1 package in [TIME]
warning: Failed to uninstall package at [SITE_PACKAGES]/anyio-3.7.0.dist-info due to missing RECORD file. Installation may result in an incomplete environment.
warning: Failed to uninstall package at [SITE_PACKAGES]/anyio-3.7.0.dist-info due to missing `RECORD` file. Installation may result in an incomplete environment.
Uninstalled 1 package in [TIME]
Installed 1 package in [TIME]
- anyio==3.7.0
Expand Down Expand Up @@ -6455,3 +6455,40 @@ fn stale_egg_info() -> Result<()> {

Ok(())
}

/// `suds-community` has an incorrect layout whereby the wheel includes `suds_community.egg-info` at
/// the top-level. We're then under the impression that `suds` is installed twice, but when we go to
/// uninstall the second "version", we can't find the `egg-info` directory.
#[test]
fn missing_top_level() {
let context = TestContext::new("3.12");

uv_snapshot!(context.filters(), context.pip_install()
.arg("suds-community==0.8.5"), @r###"
success: true
exit_code: 0
----- stdout -----

----- stderr -----
Resolved 1 package in [TIME]
Prepared 1 package in [TIME]
Installed 1 package in [TIME]
+ suds-community==0.8.5
"###
);

uv_snapshot!(context.filters(), context.pip_install()
.arg("suds-community==0.8.5"), @r###"
success: true
exit_code: 0
----- stdout -----

----- stderr -----
Resolved 1 package in [TIME]
warning: Failed to uninstall package at [SITE_PACKAGES]/suds_community.egg-info due to missing `top-level.txt` file. Installation may result in an incomplete environment.
Uninstalled 2 packages in [TIME]
Installed 1 package in [TIME]
~ suds-community==0.8.5
"###
);
}
Loading