mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Reinstall entrypoints with --force
(#4697)
## Summary I think this may have just been a typo. Closes https://github.com/astral-sh/uv/issues/4692. ## Test Plan Run `cargo run tool install flask --force --reinstall` repeatedly.
This commit is contained in:
parent
977a5c8835
commit
65cd676da7
2 changed files with 67 additions and 1 deletions
|
@ -80,7 +80,7 @@ pub(crate) async fn install(
|
||||||
let reinstall_entry_points = if existing_tool_receipt.is_some() {
|
let reinstall_entry_points = if existing_tool_receipt.is_some() {
|
||||||
if force {
|
if force {
|
||||||
debug!("Replacing existing tool due to `--force` flag.");
|
debug!("Replacing existing tool due to `--force` flag.");
|
||||||
false
|
true
|
||||||
} else {
|
} else {
|
||||||
match settings.reinstall {
|
match settings.reinstall {
|
||||||
Reinstall::All => {
|
Reinstall::All => {
|
||||||
|
|
|
@ -629,6 +629,72 @@ fn tool_install_entry_point_exists() {
|
||||||
|
|
||||||
tool_dir.child("black").assert(predicate::path::is_dir());
|
tool_dir.child("black").assert(predicate::path::is_dir());
|
||||||
|
|
||||||
|
// Re-install `black` with `--force`
|
||||||
|
uv_snapshot!(context.filters(), context.tool_install()
|
||||||
|
.arg("black")
|
||||||
|
.arg("--force")
|
||||||
|
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||||
|
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||||
|
success: true
|
||||||
|
exit_code: 0
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
warning: `uv tool install` is experimental and may change without warning.
|
||||||
|
Resolved [N] packages in [TIME]
|
||||||
|
Installed [N] packages in [TIME]
|
||||||
|
+ black==24.3.0
|
||||||
|
+ click==8.1.7
|
||||||
|
+ mypy-extensions==1.0.0
|
||||||
|
+ packaging==24.0
|
||||||
|
+ pathspec==0.12.1
|
||||||
|
+ platformdirs==4.2.0
|
||||||
|
Installed: black, blackd
|
||||||
|
"###);
|
||||||
|
|
||||||
|
tool_dir.child("black").assert(predicate::path::is_dir());
|
||||||
|
|
||||||
|
// Re-install `black` without `--force`
|
||||||
|
uv_snapshot!(context.filters(), context.tool_install()
|
||||||
|
.arg("black")
|
||||||
|
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||||
|
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||||
|
success: false
|
||||||
|
exit_code: 1
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
warning: `uv tool install` is experimental and may change without warning.
|
||||||
|
Tool `black` is already installed
|
||||||
|
"###);
|
||||||
|
|
||||||
|
tool_dir.child("black").assert(predicate::path::is_dir());
|
||||||
|
|
||||||
|
// Re-install `black` with `--reinstall`
|
||||||
|
uv_snapshot!(context.filters(), context.tool_install()
|
||||||
|
.arg("black")
|
||||||
|
.arg("--reinstall")
|
||||||
|
.env("UV_TOOL_DIR", tool_dir.as_os_str())
|
||||||
|
.env("XDG_BIN_HOME", bin_dir.as_os_str()), @r###"
|
||||||
|
success: true
|
||||||
|
exit_code: 0
|
||||||
|
----- stdout -----
|
||||||
|
|
||||||
|
----- stderr -----
|
||||||
|
warning: `uv tool install` is experimental and may change without warning.
|
||||||
|
Resolved [N] packages in [TIME]
|
||||||
|
Installed [N] packages in [TIME]
|
||||||
|
+ black==24.3.0
|
||||||
|
+ click==8.1.7
|
||||||
|
+ mypy-extensions==1.0.0
|
||||||
|
+ packaging==24.0
|
||||||
|
+ pathspec==0.12.1
|
||||||
|
+ platformdirs==4.2.0
|
||||||
|
Installed: black, blackd
|
||||||
|
"###);
|
||||||
|
|
||||||
|
tool_dir.child("black").assert(predicate::path::is_dir());
|
||||||
|
|
||||||
insta::with_settings!({
|
insta::with_settings!({
|
||||||
filters => context.filters(),
|
filters => context.filters(),
|
||||||
}, {
|
}, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue