Allow sync and update environment methods to take modifications (#11346)
## Summary I have a use-case for an inexact sync here, so putting this up separately.
This commit is contained in:
@@ -11,6 +11,7 @@ use uv_python::{Interpreter, PythonEnvironment};
|
||||
use uv_resolver::Installable;
|
||||
|
||||
use crate::commands::pip::loggers::{InstallLogger, ResolveLogger};
|
||||
use crate::commands::pip::operations::Modifications;
|
||||
use crate::commands::project::install_target::InstallTarget;
|
||||
use crate::commands::project::{
|
||||
resolve_environment, sync_environment, EnvironmentSpecification, PlatformState, ProjectError,
|
||||
@@ -193,6 +194,7 @@ impl CachedEnvironment {
|
||||
sync_environment(
|
||||
venv,
|
||||
&resolution,
|
||||
Modifications::Exact,
|
||||
settings.as_ref().into(),
|
||||
state,
|
||||
install,
|
||||
|
||||
@@ -1438,6 +1438,7 @@ pub(crate) async fn resolve_environment(
|
||||
pub(crate) async fn sync_environment(
|
||||
venv: PythonEnvironment,
|
||||
resolution: &Resolution,
|
||||
modifications: Modifications,
|
||||
settings: InstallerSettingsRef<'_>,
|
||||
state: &PlatformState,
|
||||
logger: Box<dyn InstallLogger>,
|
||||
@@ -1546,7 +1547,7 @@ pub(crate) async fn sync_environment(
|
||||
pip::operations::install(
|
||||
resolution,
|
||||
site_packages,
|
||||
Modifications::Exact,
|
||||
modifications,
|
||||
reinstall,
|
||||
build_options,
|
||||
link_mode,
|
||||
@@ -1594,6 +1595,7 @@ impl EnvironmentUpdate {
|
||||
pub(crate) async fn update_environment(
|
||||
venv: PythonEnvironment,
|
||||
spec: RequirementsSpecification,
|
||||
modifications: Modifications,
|
||||
settings: &ResolverInstallerSettings,
|
||||
state: &SharedState,
|
||||
resolve: Box<dyn ResolveLogger>,
|
||||
@@ -1794,7 +1796,7 @@ pub(crate) async fn update_environment(
|
||||
let changelog = pip::operations::install(
|
||||
&resolution,
|
||||
site_packages,
|
||||
Modifications::Exact,
|
||||
modifications,
|
||||
reinstall,
|
||||
build_options,
|
||||
*link_mode,
|
||||
|
||||
@@ -24,6 +24,7 @@ use uv_warnings::warn_user;
|
||||
|
||||
use crate::commands::pip::loggers::{DefaultInstallLogger, DefaultResolveLogger};
|
||||
|
||||
use crate::commands::pip::operations::Modifications;
|
||||
use crate::commands::project::{
|
||||
resolve_environment, resolve_names, sync_environment, update_environment,
|
||||
EnvironmentSpecification, PlatformState, ProjectError,
|
||||
@@ -422,6 +423,7 @@ pub(crate) async fn install(
|
||||
let environment = match update_environment(
|
||||
environment,
|
||||
spec,
|
||||
Modifications::Exact,
|
||||
&settings,
|
||||
&state,
|
||||
Box::new(DefaultResolveLogger),
|
||||
@@ -551,6 +553,7 @@ pub(crate) async fn install(
|
||||
match sync_environment(
|
||||
environment,
|
||||
&resolution.into(),
|
||||
Modifications::Exact,
|
||||
settings.as_ref().into(),
|
||||
&state,
|
||||
Box::new(DefaultInstallLogger),
|
||||
|
||||
@@ -22,6 +22,7 @@ use uv_tool::InstalledTools;
|
||||
use crate::commands::pip::loggers::{
|
||||
DefaultInstallLogger, SummaryResolveLogger, UpgradeInstallLogger,
|
||||
};
|
||||
use crate::commands::pip::operations::Modifications;
|
||||
use crate::commands::project::{
|
||||
resolve_environment, sync_environment, update_environment, EnvironmentUpdate, PlatformState,
|
||||
};
|
||||
@@ -314,6 +315,7 @@ async fn upgrade_tool(
|
||||
let environment = sync_environment(
|
||||
environment,
|
||||
&resolution.into(),
|
||||
Modifications::Exact,
|
||||
settings.as_ref().into(),
|
||||
&state,
|
||||
Box::new(DefaultInstallLogger),
|
||||
@@ -339,6 +341,7 @@ async fn upgrade_tool(
|
||||
} = update_environment(
|
||||
environment,
|
||||
spec,
|
||||
Modifications::Exact,
|
||||
&settings,
|
||||
&state,
|
||||
Box::new(SummaryResolveLogger),
|
||||
|
||||
Reference in New Issue
Block a user