mirror of https://github.com/astral-sh/uv
Avoid ANSI codes in debug! messages (#15843)
## Summary I spent time trying to figure out how to support this but came up empty. It _seems_ like maybe the `DefaultFields` implementation in `tracing-subscriber` uses debug formatting for fields...? So if you have a string with ANSI codes, they end up printing as unformatted values? I even reverted all our custom formatting in `logging.rs` and saw the same thing. Closes https://github.com/astral-sh/uv/issues/15840.
This commit is contained in:
parent
48f507680c
commit
dea1700945
|
|
@ -2235,7 +2235,7 @@ mod tests {
|
|||
assert!(matches!(
|
||||
client.get(server.uri()).send().await,
|
||||
Err(reqwest_middleware::Error::Middleware(_))
|
||||
),);
|
||||
));
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1469,7 +1469,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
}
|
||||
Ok(None) => {}
|
||||
Err(err) => {
|
||||
debug!("Failed to deserialize cached revision for: {source} ({err})",);
|
||||
debug!("Failed to deserialize cached revision for: {source} ({err})");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::Debug;
|
||||
|
||||
use owo_colors::OwoColorize;
|
||||
use same_file::is_same_file;
|
||||
use tracing::{debug, trace};
|
||||
use url::Url;
|
||||
|
|
@ -399,18 +398,18 @@ fn generate_dist_compatibility_hint(wheel_tags: &ExpandedTags, tags: &Tags) -> O
|
|||
|
||||
if let Some(current) = current_tag {
|
||||
let message = if let Some(pretty) = current.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), current.cyan())
|
||||
format!("{pretty} (`{current}`)")
|
||||
} else {
|
||||
format!("`{}`", current.cyan())
|
||||
format!("`{current}`")
|
||||
};
|
||||
|
||||
Some(format!(
|
||||
"The distribution is compatible with {}, but you're using {}",
|
||||
wheel_tags
|
||||
.map(|tag| if let Some(pretty) = tag.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), tag.cyan())
|
||||
format!("{pretty} (`{tag}`)")
|
||||
} else {
|
||||
format!("`{}`", tag.cyan())
|
||||
format!("`{tag}`")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
|
|
@ -421,9 +420,9 @@ fn generate_dist_compatibility_hint(wheel_tags: &ExpandedTags, tags: &Tags) -> O
|
|||
"The distribution requires {}",
|
||||
wheel_tags
|
||||
.map(|tag| if let Some(pretty) = tag.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), tag.cyan())
|
||||
format!("{pretty} (`{tag}`)")
|
||||
} else {
|
||||
format!("`{}`", tag.cyan())
|
||||
format!("`{tag}`")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
|
|
@ -436,17 +435,17 @@ fn generate_dist_compatibility_hint(wheel_tags: &ExpandedTags, tags: &Tags) -> O
|
|||
|
||||
if let Some(current) = current_tag {
|
||||
let message = if let Some(pretty) = current.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), current.cyan())
|
||||
format!("{pretty} (`{current}`)")
|
||||
} else {
|
||||
format!("`{}`", current.cyan())
|
||||
format!("`{current}`")
|
||||
};
|
||||
Some(format!(
|
||||
"The distribution is compatible with {}, but you're using {}",
|
||||
wheel_tags
|
||||
.map(|tag| if let Some(pretty) = tag.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), tag.cyan())
|
||||
format!("{pretty} (`{tag}`)")
|
||||
} else {
|
||||
format!("`{}`", tag.cyan())
|
||||
format!("`{tag}`")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
|
|
@ -457,9 +456,9 @@ fn generate_dist_compatibility_hint(wheel_tags: &ExpandedTags, tags: &Tags) -> O
|
|||
"The distribution requires {}",
|
||||
wheel_tags
|
||||
.map(|tag| if let Some(pretty) = tag.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), tag.cyan())
|
||||
format!("{pretty} (`{tag}`)")
|
||||
} else {
|
||||
format!("`{}`", tag.cyan())
|
||||
format!("`{tag}`")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
|
|
@ -472,17 +471,17 @@ fn generate_dist_compatibility_hint(wheel_tags: &ExpandedTags, tags: &Tags) -> O
|
|||
|
||||
if let Some(current) = current_tag {
|
||||
let message = if let Some(pretty) = current.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), current.cyan())
|
||||
format!("{pretty} (`{current}`)")
|
||||
} else {
|
||||
format!("`{}`", current.cyan())
|
||||
format!("`{current}`")
|
||||
};
|
||||
Some(format!(
|
||||
"The distribution is compatible with {}, but you're on {}",
|
||||
wheel_tags
|
||||
.map(|tag| if let Some(pretty) = tag.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), tag.cyan())
|
||||
format!("{pretty} (`{tag}`)")
|
||||
} else {
|
||||
format!("`{}`", tag.cyan())
|
||||
format!("`{tag}`")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", "),
|
||||
|
|
@ -493,9 +492,9 @@ fn generate_dist_compatibility_hint(wheel_tags: &ExpandedTags, tags: &Tags) -> O
|
|||
"The distribution requires {}",
|
||||
wheel_tags
|
||||
.map(|tag| if let Some(pretty) = tag.pretty() {
|
||||
format!("{} (`{}`)", pretty.cyan(), tag.cyan())
|
||||
format!("{pretty} (`{tag}`)")
|
||||
} else {
|
||||
format!("`{}`", tag.cyan())
|
||||
format!("`{tag}`")
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ")
|
||||
|
|
|
|||
|
|
@ -1728,8 +1728,8 @@ mod tests {
|
|||
request.version,
|
||||
Some(VersionRequest::from_str("3.13.0rc1").unwrap())
|
||||
);
|
||||
assert_eq!(request.os, None,);
|
||||
assert_eq!(request.arch, None,);
|
||||
assert_eq!(request.os, None);
|
||||
assert_eq!(request.arch, None);
|
||||
assert_eq!(request.libc, None);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ pub(crate) async fn install(
|
|||
.peekable();
|
||||
|
||||
if matching_installations.peek().is_none() {
|
||||
debug!("No installation found for request `{}`", request.cyan());
|
||||
debug!("No installation found for request `{}`", request);
|
||||
unsatisfied.push(Cow::Borrowed(request));
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +325,7 @@ pub(crate) async fn install(
|
|||
python_downloads_json_url.as_deref(),
|
||||
) {
|
||||
Ok(request) => {
|
||||
debug!("Will reinstall `{}`", installation.key().green());
|
||||
debug!("Will reinstall `{}`", installation.key());
|
||||
unsatisfied.push(Cow::Owned(request));
|
||||
}
|
||||
Err(err) => {
|
||||
|
|
@ -344,8 +344,8 @@ pub(crate) async fn install(
|
|||
// If we have real requests, just ignore the existing installation
|
||||
debug!(
|
||||
"Ignoring match `{}` for request `{}` due to `--reinstall` flag",
|
||||
installation.key().green(),
|
||||
request.cyan()
|
||||
installation.key(),
|
||||
request
|
||||
);
|
||||
unsatisfied.push(Cow::Borrowed(request));
|
||||
break;
|
||||
|
|
@ -366,14 +366,10 @@ pub(crate) async fn install(
|
|||
request.matches_installation(installation)
|
||||
}
|
||||
}) {
|
||||
debug!(
|
||||
"Found `{}` for request `{}`",
|
||||
installation.key().green(),
|
||||
request.cyan(),
|
||||
);
|
||||
debug!("Found `{}` for request `{}`", installation.key(), request);
|
||||
Either::Left(installation)
|
||||
} else {
|
||||
debug!("No installation found for request `{}`", request.cyan());
|
||||
debug!("No installation found for request `{}`", request);
|
||||
Either::Right(Cow::Borrowed(request))
|
||||
}
|
||||
})
|
||||
|
|
@ -394,8 +390,7 @@ pub(crate) async fn install(
|
|||
.inspect(|request| {
|
||||
debug!(
|
||||
"Found download `{}` for request `{}`",
|
||||
request.download,
|
||||
request.cyan(),
|
||||
request.download, request,
|
||||
);
|
||||
})
|
||||
.map(|request| request.download)
|
||||
|
|
|
|||
Loading…
Reference in New Issue