Make it warn_user_once

This commit is contained in:
Charlie Marsh 2025-07-02 13:31:38 -04:00
parent 3c13709f62
commit f05a529969
9 changed files with 23 additions and 23 deletions

View file

@ -25,7 +25,7 @@ use tempfile::TempDir;
use tokio::io::AsyncBufReadExt;
use tokio::process::Command;
use tokio::sync::{Mutex, Semaphore};
use tracing::{Instrument, debug, info_span, instrument, warn};
use tracing::{Instrument, debug, info_span, instrument};
use uv_cache_key::cache_digest;
use uv_configuration::PreviewMode;
@ -459,7 +459,7 @@ impl SourceBuild {
source_tree_lock = LockedFile::acquire(lock_path, self.source_tree.to_string_lossy())
.await
.inspect_err(|err| {
warn!("Failed to acquire build lock: {err}");
warn_user_once!("Failed to acquire build lock: {err}");
})
.ok();
}

View file

@ -5,7 +5,7 @@ use std::path::PathBuf;
use anyhow::Context;
use itertools::Itertools;
use owo_colors::OwoColorize;
use tracing::{Level, debug, enabled, warn};
use tracing::{Level, debug, enabled};
use uv_cache::Cache;
use uv_client::{BaseClientBuilder, FlatIndexClient, RegistryClientBuilder};
@ -36,7 +36,7 @@ use uv_resolver::{
};
use uv_torch::{TorchMode, TorchStrategy};
use uv_types::{BuildIsolation, HashStrategy};
use uv_warnings::warn_user;
use uv_warnings::{warn_user, warn_user_once};
use uv_workspace::WorkspaceCache;
use crate::commands::pip::loggers::{DefaultInstallLogger, DefaultResolveLogger, InstallLogger};
@ -240,7 +240,7 @@ pub(crate) async fn pip_install(
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();

View file

@ -3,7 +3,7 @@ use std::fmt::Write;
use anyhow::{Context, Result};
use owo_colors::OwoColorize;
use tracing::{debug, warn};
use tracing::debug;
use uv_cache::Cache;
use uv_client::{BaseClientBuilder, FlatIndexClient, RegistryClientBuilder};
@ -30,7 +30,7 @@ use uv_resolver::{
};
use uv_torch::{TorchMode, TorchStrategy};
use uv_types::{BuildIsolation, HashStrategy};
use uv_warnings::warn_user;
use uv_warnings::{warn_user, warn_user_once};
use uv_workspace::WorkspaceCache;
use crate::commands::pip::loggers::{DefaultInstallLogger, DefaultResolveLogger};
@ -215,7 +215,7 @@ pub(crate) async fn pip_sync(
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();

View file

@ -3,7 +3,7 @@ use std::fmt::Write;
use anyhow::Result;
use itertools::{Either, Itertools};
use owo_colors::OwoColorize;
use tracing::{debug, warn};
use tracing::debug;
use uv_cache::Cache;
use uv_client::BaseClientBuilder;
@ -17,6 +17,7 @@ use uv_python::EnvironmentPreference;
use uv_python::PythonRequest;
use uv_python::{Prefix, PythonEnvironment, Target};
use uv_requirements::{RequirementsSource, RequirementsSpecification};
use uv_warnings::warn_user_once;
use crate::commands::pip::operations::report_target_environment;
use crate::commands::{ExitStatus, elapsed};
@ -104,7 +105,7 @@ pub(crate) async fn pip_uninstall(
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();

View file

@ -10,7 +10,7 @@ use anyhow::{Context, Result, bail};
use itertools::Itertools;
use owo_colors::OwoColorize;
use rustc_hash::{FxBuildHasher, FxHashMap};
use tracing::{debug, warn};
use tracing::debug;
use url::Url;
use uv_cache::Cache;
@ -323,7 +323,7 @@ pub(crate) async fn add(
.acquire_lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();

View file

@ -1247,7 +1247,7 @@ impl ProjectEnvironment {
let _lock = ProjectInterpreter::lock(workspace)
.await
.inspect_err(|err| {
warn!("Failed to acquire project environment lock: {err}");
warn_user_once!("Failed to acquire project environment lock: {err}");
})
.ok();
@ -1470,7 +1470,7 @@ impl ScriptEnvironment {
let _lock = ScriptInterpreter::lock(script)
.await
.inspect_err(|err| {
warn!("Failed to acquire script environment lock: {err}");
warn_user_once!("Failed to acquire script environment lock: {err}");
})
.ok();

View file

@ -5,7 +5,7 @@ use std::str::FromStr;
use anyhow::{Context, Result};
use owo_colors::OwoColorize;
use tracing::{debug, warn};
use tracing::debug;
use uv_cache::Cache;
use uv_configuration::{
@ -285,7 +285,7 @@ pub(crate) async fn remove(
.acquire_lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();

View file

@ -37,7 +37,7 @@ use uv_scripts::Pep723Item;
use uv_settings::PythonInstallMirrors;
use uv_shell::runnable::WindowsRunnable;
use uv_static::EnvVars;
use uv_warnings::warn_user;
use uv_warnings::{warn_user, warn_user_once};
use uv_workspace::{DiscoveryOptions, VirtualProject, Workspace, WorkspaceCache, WorkspaceError};
use crate::commands::pip::loggers::{
@ -244,7 +244,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();
@ -396,7 +396,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();
@ -715,7 +715,7 @@ hint: If you are running a script with `{}` in the shebang, you may need to incl
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();

View file

@ -6,7 +6,6 @@ use std::sync::Arc;
use anyhow::{Context, Result};
use itertools::Itertools;
use owo_colors::OwoColorize;
use tracing::warn;
use uv_cache::Cache;
use uv_client::{BaseClientBuilder, FlatIndexClient, RegistryClientBuilder};
@ -29,7 +28,7 @@ use uv_resolver::{FlatIndex, Installable, Lock};
use uv_scripts::{Pep723ItemRef, Pep723Script};
use uv_settings::PythonInstallMirrors;
use uv_types::{BuildIsolation, HashStrategy};
use uv_warnings::warn_user;
use uv_warnings::{warn_user, warn_user_once};
use uv_workspace::pyproject::Source;
use uv_workspace::{DiscoveryOptions, MemberDiscovery, VirtualProject, Workspace, WorkspaceCache};
@ -174,7 +173,7 @@ pub(crate) async fn sync(
.lock()
.await
.inspect_err(|err| {
warn!("Failed to acquire environment lock: {err}");
warn_user_once!("Failed to acquire environment lock: {err}");
})
.ok();