mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Avoid resetting dispatch and in-flight state with reinstalls (#4771)
## Summary
This used to be necessary because we purged the cache in the
`InstallPlan` if the user passed `--reinstall`. _However_, we later
changed the cache to be append-only.
## Test Plan
I ran through the test plan in https://github.com/astral-sh/uv/pull/933,
which includes an integration test and running `uv pip install
--reinstall` with:
```text
setuptools
devpi @ e334eb4dc9/devpi-2.2.0.tar.gz
```
This commit is contained in:
parent
dcdf26eead
commit
b6575fe487
3 changed files with 11 additions and 98 deletions
|
@ -291,8 +291,8 @@ pub(crate) async fn pip_install(
|
||||||
// Track in-flight downloads, builds, etc., across resolutions.
|
// Track in-flight downloads, builds, etc., across resolutions.
|
||||||
let in_flight = InFlight::default();
|
let in_flight = InFlight::default();
|
||||||
|
|
||||||
// Create a build dispatch for resolution.
|
// Create a build dispatch.
|
||||||
let resolve_dispatch = BuildDispatch::new(
|
let build_dispatch = BuildDispatch::new(
|
||||||
&client,
|
&client,
|
||||||
&cache,
|
&cache,
|
||||||
interpreter,
|
interpreter,
|
||||||
|
@ -340,7 +340,7 @@ pub(crate) async fn pip_install(
|
||||||
&client,
|
&client,
|
||||||
&flat_index,
|
&flat_index,
|
||||||
&index,
|
&index,
|
||||||
&resolve_dispatch,
|
&build_dispatch,
|
||||||
concurrency,
|
concurrency,
|
||||||
options,
|
options,
|
||||||
printer,
|
printer,
|
||||||
|
@ -358,35 +358,6 @@ pub(crate) async fn pip_install(
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Re-initialize the in-flight map.
|
|
||||||
let in_flight = InFlight::default();
|
|
||||||
|
|
||||||
// If we're running with `--reinstall`, initialize a separate `BuildDispatch`, since we may
|
|
||||||
// end up removing some distributions from the environment.
|
|
||||||
let install_dispatch = if reinstall.is_none() {
|
|
||||||
resolve_dispatch
|
|
||||||
} else {
|
|
||||||
BuildDispatch::new(
|
|
||||||
&client,
|
|
||||||
&cache,
|
|
||||||
interpreter,
|
|
||||||
&index_locations,
|
|
||||||
&flat_index,
|
|
||||||
&index,
|
|
||||||
&git,
|
|
||||||
&in_flight,
|
|
||||||
index_strategy,
|
|
||||||
setup_py,
|
|
||||||
config_settings,
|
|
||||||
build_isolation,
|
|
||||||
link_mode,
|
|
||||||
&build_options,
|
|
||||||
exclude_newer,
|
|
||||||
concurrency,
|
|
||||||
preview,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sync the environment.
|
// Sync the environment.
|
||||||
operations::install(
|
operations::install(
|
||||||
&resolution,
|
&resolution,
|
||||||
|
@ -402,7 +373,7 @@ pub(crate) async fn pip_install(
|
||||||
&client,
|
&client,
|
||||||
&in_flight,
|
&in_flight,
|
||||||
concurrency,
|
concurrency,
|
||||||
&install_dispatch,
|
&build_dispatch,
|
||||||
&cache,
|
&cache,
|
||||||
&environment,
|
&environment,
|
||||||
dry_run,
|
dry_run,
|
||||||
|
|
|
@ -244,8 +244,8 @@ pub(crate) async fn pip_sync(
|
||||||
// Ignore development dependencies.
|
// Ignore development dependencies.
|
||||||
let dev = Vec::default();
|
let dev = Vec::default();
|
||||||
|
|
||||||
// Create a build dispatch for resolution.
|
// Create a build dispatch.
|
||||||
let resolve_dispatch = BuildDispatch::new(
|
let build_dispatch = BuildDispatch::new(
|
||||||
&client,
|
&client,
|
||||||
&cache,
|
&cache,
|
||||||
interpreter,
|
interpreter,
|
||||||
|
@ -295,7 +295,7 @@ pub(crate) async fn pip_sync(
|
||||||
&client,
|
&client,
|
||||||
&flat_index,
|
&flat_index,
|
||||||
&index,
|
&index,
|
||||||
&resolve_dispatch,
|
&build_dispatch,
|
||||||
concurrency,
|
concurrency,
|
||||||
options,
|
options,
|
||||||
printer,
|
printer,
|
||||||
|
@ -313,35 +313,6 @@ pub(crate) async fn pip_sync(
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Re-initialize the in-flight map.
|
|
||||||
let in_flight = InFlight::default();
|
|
||||||
|
|
||||||
// If we're running with `--reinstall`, initialize a separate `BuildDispatch`, since we may
|
|
||||||
// end up removing some distributions from the environment.
|
|
||||||
let install_dispatch = if reinstall.is_none() {
|
|
||||||
resolve_dispatch
|
|
||||||
} else {
|
|
||||||
BuildDispatch::new(
|
|
||||||
&client,
|
|
||||||
&cache,
|
|
||||||
interpreter,
|
|
||||||
&index_locations,
|
|
||||||
&flat_index,
|
|
||||||
&index,
|
|
||||||
&git,
|
|
||||||
&in_flight,
|
|
||||||
index_strategy,
|
|
||||||
setup_py,
|
|
||||||
config_settings,
|
|
||||||
build_isolation,
|
|
||||||
link_mode,
|
|
||||||
&build_options,
|
|
||||||
exclude_newer,
|
|
||||||
concurrency,
|
|
||||||
preview,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sync the environment.
|
// Sync the environment.
|
||||||
operations::install(
|
operations::install(
|
||||||
&resolution,
|
&resolution,
|
||||||
|
@ -357,7 +328,7 @@ pub(crate) async fn pip_sync(
|
||||||
&client,
|
&client,
|
||||||
&in_flight,
|
&in_flight,
|
||||||
concurrency,
|
concurrency,
|
||||||
&install_dispatch,
|
&build_dispatch,
|
||||||
&cache,
|
&cache,
|
||||||
&environment,
|
&environment,
|
||||||
dry_run,
|
dry_run,
|
||||||
|
|
|
@ -469,7 +469,7 @@ pub(crate) async fn update_environment(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create a build dispatch.
|
// Create a build dispatch.
|
||||||
let resolve_dispatch = BuildDispatch::new(
|
let build_dispatch = BuildDispatch::new(
|
||||||
&client,
|
&client,
|
||||||
cache,
|
cache,
|
||||||
interpreter,
|
interpreter,
|
||||||
|
@ -509,7 +509,7 @@ pub(crate) async fn update_environment(
|
||||||
&client,
|
&client,
|
||||||
&flat_index,
|
&flat_index,
|
||||||
&state.index,
|
&state.index,
|
||||||
&resolve_dispatch,
|
&build_dispatch,
|
||||||
concurrency,
|
concurrency,
|
||||||
options,
|
options,
|
||||||
printer,
|
printer,
|
||||||
|
@ -521,35 +521,6 @@ pub(crate) async fn update_environment(
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Re-initialize the in-flight map.
|
|
||||||
let in_flight = InFlight::default();
|
|
||||||
|
|
||||||
// If we're running with `--reinstall`, initialize a separate `BuildDispatch`, since we may
|
|
||||||
// end up removing some distributions from the environment.
|
|
||||||
let install_dispatch = if reinstall.is_none() {
|
|
||||||
resolve_dispatch
|
|
||||||
} else {
|
|
||||||
BuildDispatch::new(
|
|
||||||
&client,
|
|
||||||
cache,
|
|
||||||
interpreter,
|
|
||||||
index_locations,
|
|
||||||
&flat_index,
|
|
||||||
&state.index,
|
|
||||||
&state.git,
|
|
||||||
&in_flight,
|
|
||||||
*index_strategy,
|
|
||||||
setup_py,
|
|
||||||
config_setting,
|
|
||||||
build_isolation,
|
|
||||||
*link_mode,
|
|
||||||
build_options,
|
|
||||||
*exclude_newer,
|
|
||||||
concurrency,
|
|
||||||
preview,
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Sync the environment.
|
// Sync the environment.
|
||||||
pip::operations::install(
|
pip::operations::install(
|
||||||
&resolution,
|
&resolution,
|
||||||
|
@ -565,7 +536,7 @@ pub(crate) async fn update_environment(
|
||||||
&client,
|
&client,
|
||||||
&in_flight,
|
&in_flight,
|
||||||
concurrency,
|
concurrency,
|
||||||
&install_dispatch,
|
&build_dispatch,
|
||||||
cache,
|
cache,
|
||||||
&venv,
|
&venv,
|
||||||
dry_run,
|
dry_run,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue