Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
5 changes: 3 additions & 2 deletions e2e/backend/test_pipx_uvx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cat >.mise.toml <<EOF
python = "3.12.3"
pipx = "1.5.0"
uv = "0.5.5"
"pipx:mkdocs" = "1.6.0"
"pipx:mkdocs" = { version = "1.6.0", uvx_args = "--with rich" }
EOF

# Install the tools
Expand All @@ -34,5 +34,6 @@ mise install
# (mkdocs conveniently returns its installation path in with --version)
assert_contains "mise x -- mkdocs --version" "/mise/installs/pipx-mkdocs/1.6.0/"

assert "mise up --bump python"
assert_succeed "mise up --bump python"
assert_succeed "'$MISE_DATA_DIR/installs/pipx-mkdocs/1.6.0/mkdocs/bin/python' -c 'import rich'"
assert_contains "mise x -- mkdocs --version" "mkdocs, version 1.6.0"
34 changes: 12 additions & 22 deletions src/backend/pipx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,34 +425,24 @@ impl PIPXBackend {
}

pub async fn reinstall_all(config: &Arc<Config>) -> Result<()> {
let ts = ToolsetBuilder::new().build(config).await?;
let ts = Arc::new(ToolsetBuilder::new().build(config).await?);
let pipx_tools = ts
.list_installed_versions(config)
.await?
.into_iter()
.filter(|(b, _tv)| b.ba().backend_type() == BackendType::Pipx)
.collect_vec();
if Settings::get().pipx.uvx != Some(false) {
let pr = MultiProgressReport::get().add("reinstalling pipx tools with uvx");
for (b, tv) in pipx_tools {
for (cmd, tool) in &[
("uninstall", tv.ba().tool_name.to_string()),
("install", format!("{}=={}", tv.ba().tool_name, tv.version)),
] {
let args = &["tool", cmd, tool];
Self::uvx_cmd(config, args, &*b, &tv, &ts, pr.as_ref())
.await?
.execute()?;
}
}
} else {
let pr = MultiProgressReport::get().add("reinstalling pipx tools");
for (b, tv) in pipx_tools {
let args = &["reinstall", &tv.ba().tool_name];
Self::pipx_cmd(config, args, &*b, &tv, &ts, pr.as_ref())
.await?
.execute()?;
}
for (b, tv) in pipx_tools {
let ctx = InstallContext {
config: config.clone(),
ts: ts.clone(),
pr: MultiProgressReport::get().add(&format!("reinstalling {}", tv.style())),
force: true,
dry_run: false,
locked: false,
before_date: None,
};
Comment thread
risu729 marked this conversation as resolved.
b.install_version(ctx, tv).await?;
}
Ok(())
}
Expand Down
Loading