mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Remove unnecessary prefixes (#10158)
This commit is contained in:
parent
3cb723220e
commit
bec8468183
31 changed files with 124 additions and 175 deletions
|
@ -237,7 +237,7 @@ impl Credentials {
|
|||
///
|
||||
/// Any existing credentials will be overridden.
|
||||
#[must_use]
|
||||
pub(crate) fn authenticate(&self, mut request: reqwest::Request) -> reqwest::Request {
|
||||
pub(crate) fn authenticate(&self, mut request: Request) -> Request {
|
||||
request
|
||||
.headers_mut()
|
||||
.insert(reqwest::header::AUTHORIZATION, Self::to_header_value(self));
|
||||
|
@ -296,7 +296,7 @@ mod tests {
|
|||
auth_url.set_password(Some("password")).unwrap();
|
||||
let credentials = Credentials::from_url(&auth_url).unwrap();
|
||||
|
||||
let mut request = reqwest::Request::new(reqwest::Method::GET, url);
|
||||
let mut request = Request::new(reqwest::Method::GET, url);
|
||||
request = credentials.authenticate(request);
|
||||
|
||||
let mut header = request
|
||||
|
@ -318,7 +318,7 @@ mod tests {
|
|||
auth_url.set_password(Some("password")).unwrap();
|
||||
let credentials = Credentials::from_url(&auth_url).unwrap();
|
||||
|
||||
let mut request = reqwest::Request::new(reqwest::Method::GET, url);
|
||||
let mut request = Request::new(reqwest::Method::GET, url);
|
||||
request = credentials.authenticate(request);
|
||||
|
||||
let mut header = request
|
||||
|
@ -340,7 +340,7 @@ mod tests {
|
|||
auth_url.set_password(Some("password==")).unwrap();
|
||||
let credentials = Credentials::from_url(&auth_url).unwrap();
|
||||
|
||||
let mut request = reqwest::Request::new(reqwest::Method::GET, url);
|
||||
let mut request = Request::new(reqwest::Method::GET, url);
|
||||
request = credentials.authenticate(request);
|
||||
|
||||
let mut header = request
|
||||
|
|
|
@ -45,7 +45,7 @@ pub trait Cacheable: Sized {
|
|||
/// Deserialize a value from bytes aligned to a 16-byte boundary.
|
||||
fn from_aligned_bytes(bytes: AlignedVec) -> Result<Self::Target, Error>;
|
||||
/// Serialize bytes to a possibly owned byte buffer.
|
||||
fn to_bytes(&self) -> Result<Cow<'_, [u8]>, crate::Error>;
|
||||
fn to_bytes(&self) -> Result<Cow<'_, [u8]>, Error>;
|
||||
/// Convert this type into its final form.
|
||||
fn into_target(self) -> Self::Target;
|
||||
}
|
||||
|
@ -814,7 +814,7 @@ impl DataWithCachePolicy {
|
|||
/// If the given byte buffer is not in a valid format or if the reader
|
||||
/// fails, then this returns an error.
|
||||
pub fn from_reader(mut rdr: impl std::io::Read) -> Result<Self, Error> {
|
||||
let mut aligned_bytes = rkyv::util::AlignedVec::new();
|
||||
let mut aligned_bytes = AlignedVec::new();
|
||||
aligned_bytes
|
||||
.extend_from_reader(&mut rdr)
|
||||
.map_err(ErrorKind::Io)?;
|
||||
|
|
|
@ -182,10 +182,7 @@ impl<'b, B: 'b + ?Sized + AsRef<[u8]>, I: Iterator<Item = &'b B>> CacheControlPa
|
|||
/// given iterator should yield elements that satisfy `AsRef<[u8]>`.
|
||||
fn new<II: IntoIterator<IntoIter = I>>(headers: II) -> CacheControlParser<'b, I> {
|
||||
let mut directives = headers.into_iter();
|
||||
let cur = directives
|
||||
.next()
|
||||
.map(std::convert::AsRef::as_ref)
|
||||
.unwrap_or(b"");
|
||||
let cur = directives.next().map(AsRef::as_ref).unwrap_or(b"");
|
||||
CacheControlParser {
|
||||
cur,
|
||||
directives,
|
||||
|
@ -265,7 +262,7 @@ impl<'b, B: 'b + ?Sized + AsRef<[u8]>, I: Iterator<Item = &'b B>> CacheControlPa
|
|||
self.cur = &self.cur[1..];
|
||||
self.parse_quoted_string()
|
||||
} else {
|
||||
self.parse_token().map(std::string::String::into_bytes)
|
||||
self.parse_token().map(String::into_bytes)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,7 +368,7 @@ impl<'b, B: 'b + ?Sized + AsRef<[u8]>, I: Iterator<Item = &'b B>> Iterator
|
|||
fn next(&mut self) -> Option<CacheControlDirective> {
|
||||
loop {
|
||||
if self.cur.is_empty() {
|
||||
self.cur = self.directives.next().map(std::convert::AsRef::as_ref)?;
|
||||
self.cur = self.directives.next().map(AsRef::as_ref)?;
|
||||
}
|
||||
while !self.cur.is_empty() {
|
||||
self.skip_whitespace();
|
||||
|
|
|
@ -1039,7 +1039,7 @@ mod tests {
|
|||
.iter()
|
||||
.map(|file| uv_pypi_types::base_url_join_relative(base.as_url().as_str(), &file.url))
|
||||
.collect::<Result<Vec<_>, JoinRelativeError>>()?;
|
||||
let urls = urls.iter().map(reqwest::Url::as_str).collect::<Vec<_>>();
|
||||
let urls = urls.iter().map(Url::as_str).collect::<Vec<_>>();
|
||||
insta::assert_debug_snapshot!(urls, @r###"
|
||||
[
|
||||
"https://account.d.codeartifact.us-west-2.amazonaws.com/pypi/shared-packages-pypi/simple/0.1/Flask-0.1.tar.gz#sha256=9da884457e910bf0847d396cb4b778ad9f3c3d17db1c5997cb861937bd284237",
|
||||
|
|
|
@ -77,11 +77,11 @@ where
|
|||
///
|
||||
/// If the bytes fail validation (e.g., contains unaligned pointers or
|
||||
/// strings aren't valid UTF-8), then this returns an error.
|
||||
pub fn new(raw: rkyv::util::AlignedVec) -> Result<Self, Error> {
|
||||
pub fn new(raw: AlignedVec) -> Result<Self, Error> {
|
||||
// We convert the error to a simple string because... the error type
|
||||
// does not implement Send. And I don't think we really need to keep
|
||||
// the error type around anyway.
|
||||
let _ = rkyv::access::<A::Archived, rkyv::rancor::Error>(&raw)
|
||||
let _ = rkyv::access::<A::Archived, rancor::Error>(&raw)
|
||||
.map_err(|e| ErrorKind::ArchiveRead(e.to_string()))?;
|
||||
Ok(Self {
|
||||
raw,
|
||||
|
@ -98,7 +98,7 @@ where
|
|||
/// If the bytes fail validation (e.g., contains unaligned pointers or
|
||||
/// strings aren't valid UTF-8), then this returns an error.
|
||||
pub fn from_reader<R: std::io::Read>(mut rdr: R) -> Result<Self, Error> {
|
||||
let mut buf = rkyv::util::AlignedVec::with_capacity(1024);
|
||||
let mut buf = AlignedVec::with_capacity(1024);
|
||||
buf.extend_from_reader(&mut rdr).map_err(ErrorKind::Io)?;
|
||||
Self::new(buf)
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ pub enum KeyringProviderType {
|
|||
// See <https://pip.pypa.io/en/stable/topics/authentication/#keyring-support> for details.
|
||||
|
||||
impl KeyringProviderType {
|
||||
pub fn to_provider(&self) -> Option<uv_auth::KeyringProvider> {
|
||||
pub fn to_provider(&self) -> Option<KeyringProvider> {
|
||||
match self {
|
||||
Self::Disabled => None,
|
||||
Self::Subprocess => Some(KeyringProvider::subprocess()),
|
||||
|
|
|
@ -81,7 +81,7 @@ pub enum TrustedHostError {
|
|||
InvalidPort(String),
|
||||
}
|
||||
|
||||
impl std::str::FromStr for TrustedHost {
|
||||
impl FromStr for TrustedHost {
|
||||
type Err = TrustedHostError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
|
|
|
@ -118,7 +118,7 @@ impl FileLocation {
|
|||
}
|
||||
|
||||
impl Display for FileLocation {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::RelativeUrl(_base, url) => Display::fmt(&url, f),
|
||||
Self::AbsoluteUrl(url) => Display::fmt(&url.0, f),
|
||||
|
|
|
@ -1341,20 +1341,12 @@ mod test {
|
|||
/// Ensure that we don't accidentally grow the `Dist` sizes.
|
||||
#[test]
|
||||
fn dist_size() {
|
||||
assert!(size_of::<Dist>() <= 336, "{}", size_of::<Dist>());
|
||||
assert!(size_of::<BuiltDist>() <= 336, "{}", size_of::<BuiltDist>());
|
||||
assert!(
|
||||
std::mem::size_of::<Dist>() <= 336,
|
||||
size_of::<SourceDist>() <= 264,
|
||||
"{}",
|
||||
std::mem::size_of::<Dist>()
|
||||
);
|
||||
assert!(
|
||||
std::mem::size_of::<BuiltDist>() <= 336,
|
||||
"{}",
|
||||
std::mem::size_of::<BuiltDist>()
|
||||
);
|
||||
assert!(
|
||||
std::mem::size_of::<SourceDist>() <= 264,
|
||||
"{}",
|
||||
std::mem::size_of::<SourceDist>()
|
||||
size_of::<SourceDist>()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ fn copy_wheel_files(
|
|||
let mut count = 0usize;
|
||||
|
||||
// Walk over the directory.
|
||||
for entry in walkdir::WalkDir::new(&wheel) {
|
||||
for entry in WalkDir::new(&wheel) {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
|
||||
|
@ -499,7 +499,7 @@ fn hardlink_wheel_files(
|
|||
let mut count = 0usize;
|
||||
|
||||
// Walk over the directory.
|
||||
for entry in walkdir::WalkDir::new(&wheel) {
|
||||
for entry in WalkDir::new(&wheel) {
|
||||
let entry = entry?;
|
||||
let path = entry.path();
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ pub(crate) fn derive_impl(input: DeriveInput) -> syn::Result<TokenStream> {
|
|||
/// For a field with type `Option<Foobar>` where `Foobar` itself is a struct
|
||||
/// deriving `ConfigurationOptions`, create code that calls retrieves options
|
||||
/// from that group: `Foobar::get_available_options()`
|
||||
fn handle_option_group(field: &Field) -> syn::Result<proc_macro2::TokenStream> {
|
||||
fn handle_option_group(field: &Field) -> syn::Result<TokenStream> {
|
||||
let ident = field
|
||||
.ident
|
||||
.as_ref()
|
||||
|
@ -145,7 +145,7 @@ fn handle_option_group(field: &Field) -> syn::Result<proc_macro2::TokenStream> {
|
|||
/// Parse a `doc` attribute into it a string literal.
|
||||
fn parse_doc(doc: &Attribute) -> syn::Result<String> {
|
||||
match &doc.meta {
|
||||
syn::Meta::NameValue(syn::MetaNameValue {
|
||||
Meta::NameValue(syn::MetaNameValue {
|
||||
value:
|
||||
syn::Expr::Lit(ExprLit {
|
||||
lit: Lit::Str(lit_str),
|
||||
|
@ -159,7 +159,7 @@ fn parse_doc(doc: &Attribute) -> syn::Result<String> {
|
|||
|
||||
/// Parse an `#[option(doc="...", default="...", value_type="...",
|
||||
/// example="...")]` attribute and return data in the form of an `OptionField`.
|
||||
fn handle_option(field: &Field, attr: &Attribute) -> syn::Result<proc_macro2::TokenStream> {
|
||||
fn handle_option(field: &Field, attr: &Attribute) -> syn::Result<TokenStream> {
|
||||
let docs: Vec<&Attribute> = field
|
||||
.attrs
|
||||
.iter()
|
||||
|
|
|
@ -95,7 +95,7 @@ fn is_normalized(name: impl AsRef<str>) -> Result<bool, InvalidNameError> {
|
|||
Ok(true)
|
||||
}
|
||||
|
||||
/// Invalid [`crate::PackageName`] or [`crate::ExtraName`].
|
||||
/// Invalid [`PackageName`] or [`ExtraName`].
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub struct InvalidNameError(String);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
//! Convert [`VersionSpecifiers`] to [`version_ranges::Ranges`].
|
||||
//! Convert [`VersionSpecifiers`] to [`Ranges`].
|
||||
|
||||
use version_ranges::Ranges;
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ impl VersionSpecifier {
|
|||
Operator::ExactEqual => {
|
||||
#[cfg(feature = "tracing")]
|
||||
{
|
||||
tracing::warn!("Using arbitrary equality (`===`) is discouraged");
|
||||
warn!("Using arbitrary equality (`===`) is discouraged");
|
||||
}
|
||||
self.version.to_string() == version.to_string()
|
||||
}
|
||||
|
|
|
@ -232,12 +232,12 @@ impl<T: Pep508Url> Requirement<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Type to parse URLs from `name @ <url>` into. Defaults to [`url::Url`].
|
||||
/// Type to parse URLs from `name @ <url>` into. Defaults to [`Url`].
|
||||
pub trait Pep508Url: Display + Debug + Sized {
|
||||
/// String to URL parsing error
|
||||
type Err: Error + Debug;
|
||||
|
||||
/// Parse a url from `name @ <url>`. Defaults to [`url::Url::parse_url`].
|
||||
/// Parse a url from `name @ <url>`. Defaults to [`Url::parse_url`].
|
||||
fn parse_url(url: &str, working_dir: Option<&Path>) -> Result<Self, Self::Err>;
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1069,7 @@ mod tests {
|
|||
marker: MarkerTree::expression(MarkerExpression::Version {
|
||||
key: MarkerValueVersion::PythonFullVersion,
|
||||
specifier: VersionSpecifier::from_pattern(
|
||||
uv_pep440::Operator::LessThan,
|
||||
Operator::LessThan,
|
||||
"2.7".parse().unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
|
@ -1333,11 +1333,8 @@ mod tests {
|
|||
|
||||
let mut a = MarkerTree::expression(MarkerExpression::Version {
|
||||
key: MarkerValueVersion::PythonVersion,
|
||||
specifier: VersionSpecifier::from_pattern(
|
||||
uv_pep440::Operator::Equal,
|
||||
"2.7".parse().unwrap(),
|
||||
)
|
||||
.unwrap(),
|
||||
specifier: VersionSpecifier::from_pattern(Operator::Equal, "2.7".parse().unwrap())
|
||||
.unwrap(),
|
||||
});
|
||||
let mut b = MarkerTree::expression(MarkerExpression::String {
|
||||
key: MarkerValueString::SysPlatform,
|
||||
|
|
|
@ -53,7 +53,7 @@ pub enum MarkerValueVersion {
|
|||
}
|
||||
|
||||
impl Display for MarkerValueVersion {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::ImplementationVersion => f.write_str("implementation_version"),
|
||||
Self::PythonFullVersion => f.write_str("python_full_version"),
|
||||
|
@ -97,7 +97,7 @@ pub enum MarkerValueString {
|
|||
|
||||
impl Display for MarkerValueString {
|
||||
/// Normalizes deprecated names to the proper ones
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::ImplementationName => f.write_str("implementation_name"),
|
||||
Self::OsName | Self::OsNameDeprecated => f.write_str("os_name"),
|
||||
|
@ -175,7 +175,7 @@ impl FromStr for MarkerValue {
|
|||
}
|
||||
|
||||
impl Display for MarkerValue {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::MarkerEnvVersion(marker_value_version) => marker_value_version.fmt(f),
|
||||
Self::MarkerEnvString(marker_value_string) => marker_value_string.fmt(f),
|
||||
|
@ -341,7 +341,7 @@ impl FromStr for MarkerOperator {
|
|||
}
|
||||
|
||||
impl Display for MarkerOperator {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(match self {
|
||||
Self::Equal => "==",
|
||||
Self::NotEqual => "!=",
|
||||
|
@ -386,7 +386,7 @@ impl FromStr for StringVersion {
|
|||
}
|
||||
|
||||
impl Display for StringVersion {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
self.string.fmt(f)
|
||||
}
|
||||
}
|
||||
|
@ -446,7 +446,7 @@ impl MarkerValueExtra {
|
|||
}
|
||||
|
||||
impl Display for MarkerValueExtra {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Extra(extra) => extra.fmt(f),
|
||||
Self::Arbitrary(string) => string.fmt(f),
|
||||
|
@ -538,7 +538,7 @@ impl ExtraOperator {
|
|||
}
|
||||
|
||||
impl Display for ExtraOperator {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
f.write_str(match self {
|
||||
Self::Equal => "==",
|
||||
Self::NotEqual => "!=",
|
||||
|
@ -590,7 +590,7 @@ impl MarkerExpression {
|
|||
}
|
||||
|
||||
impl Display for MarkerExpression {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
MarkerExpression::Version { key, specifier } => {
|
||||
let (op, version) = (specifier.operator(), specifier.version());
|
||||
|
@ -1198,7 +1198,7 @@ impl MarkerTree {
|
|||
MarkerTreeDebugRaw { marker: self }
|
||||
}
|
||||
|
||||
fn fmt_graph(self, f: &mut fmt::Formatter<'_>, level: usize) -> fmt::Result {
|
||||
fn fmt_graph(self, f: &mut Formatter<'_>, level: usize) -> fmt::Result {
|
||||
match self.kind() {
|
||||
MarkerTreeKind::True => return write!(f, "true"),
|
||||
MarkerTreeKind::False => return write!(f, "false"),
|
||||
|
@ -1296,7 +1296,7 @@ pub struct MarkerTreeDebugGraph<'a> {
|
|||
}
|
||||
|
||||
impl fmt::Debug for MarkerTreeDebugGraph<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
self.marker.fmt_graph(f, 0)
|
||||
}
|
||||
}
|
||||
|
@ -1313,7 +1313,7 @@ pub struct MarkerTreeDebugRaw<'a> {
|
|||
}
|
||||
|
||||
impl fmt::Debug for MarkerTreeDebugRaw<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
let node = INTERNER.shared.node(self.marker.0);
|
||||
f.debug_tuple("MarkerTreeDebugRaw").field(node).finish()
|
||||
}
|
||||
|
|
|
@ -246,7 +246,7 @@ pub enum Error {
|
|||
/// Notably, "system" environments are excluded. See [`python_executables_from_installed`].
|
||||
fn python_executables_from_virtual_environments<'a>(
|
||||
) -> impl Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a {
|
||||
let from_active_environment = std::iter::once_with(|| {
|
||||
let from_active_environment = iter::once_with(|| {
|
||||
virtualenv_from_env()
|
||||
.into_iter()
|
||||
.map(virtualenv_python_executable)
|
||||
|
@ -255,7 +255,7 @@ fn python_executables_from_virtual_environments<'a>(
|
|||
.flatten();
|
||||
|
||||
// N.B. we prefer the conda environment over discovered virtual environments
|
||||
let from_conda_environment = std::iter::once_with(|| {
|
||||
let from_conda_environment = iter::once_with(|| {
|
||||
conda_environment_from_env(CondaEnvironmentKind::Child)
|
||||
.into_iter()
|
||||
.map(virtualenv_python_executable)
|
||||
|
@ -263,7 +263,7 @@ fn python_executables_from_virtual_environments<'a>(
|
|||
})
|
||||
.flatten();
|
||||
|
||||
let from_discovered_environment = std::iter::once_with(|| {
|
||||
let from_discovered_environment = iter::once_with(|| {
|
||||
virtualenv_from_working_dir()
|
||||
.map(|path| {
|
||||
path.map(virtualenv_python_executable)
|
||||
|
@ -302,7 +302,7 @@ fn python_executables_from_installed<'a>(
|
|||
implementation: Option<&'a ImplementationName>,
|
||||
preference: PythonPreference,
|
||||
) -> Box<dyn Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a> {
|
||||
let from_managed_installations = std::iter::once_with(move || {
|
||||
let from_managed_installations = iter::once_with(move || {
|
||||
ManagedPythonInstallations::from_settings(None)
|
||||
.map_err(Error::from)
|
||||
.and_then(|installed_installations| {
|
||||
|
@ -328,13 +328,13 @@ fn python_executables_from_installed<'a>(
|
|||
})
|
||||
.flatten_ok();
|
||||
|
||||
let from_search_path = std::iter::once_with(move || {
|
||||
let from_search_path = iter::once_with(move || {
|
||||
python_executables_from_search_path(version, implementation)
|
||||
.map(|path| Ok((PythonSource::SearchPath, path)))
|
||||
})
|
||||
.flatten();
|
||||
|
||||
let from_windows_registry = std::iter::once_with(move || {
|
||||
let from_windows_registry = iter::once_with(move || {
|
||||
#[cfg(windows)]
|
||||
{
|
||||
// Skip interpreter probing if we already know the version doesn't match.
|
||||
|
@ -407,15 +407,15 @@ fn python_executables<'a>(
|
|||
preference: PythonPreference,
|
||||
) -> Box<dyn Iterator<Item = Result<(PythonSource, PathBuf), Error>> + 'a> {
|
||||
// Always read from `UV_INTERNAL__PARENT_INTERPRETER` — it could be a system interpreter
|
||||
let from_parent_interpreter = std::iter::once_with(|| {
|
||||
std::env::var_os(EnvVars::UV_INTERNAL__PARENT_INTERPRETER)
|
||||
let from_parent_interpreter = iter::once_with(|| {
|
||||
env::var_os(EnvVars::UV_INTERNAL__PARENT_INTERPRETER)
|
||||
.into_iter()
|
||||
.map(|path| Ok((PythonSource::ParentInterpreter, PathBuf::from(path))))
|
||||
})
|
||||
.flatten();
|
||||
|
||||
// Check if the the base conda environment is active
|
||||
let from_base_conda_environment = std::iter::once_with(|| {
|
||||
let from_base_conda_environment = iter::once_with(|| {
|
||||
conda_environment_from_env(CondaEnvironmentKind::Base)
|
||||
.into_iter()
|
||||
.map(virtualenv_python_executable)
|
||||
|
@ -803,18 +803,16 @@ pub fn find_python_installations<'a>(
|
|||
.sources(request);
|
||||
|
||||
match request {
|
||||
PythonRequest::File(path) => Box::new(std::iter::once({
|
||||
PythonRequest::File(path) => Box::new(iter::once({
|
||||
if preference.allows(PythonSource::ProvidedPath) {
|
||||
debug!("Checking for Python interpreter at {request}");
|
||||
match python_installation_from_executable(path, cache) {
|
||||
Ok(installation) => Ok(FindPythonResult::Ok(installation)),
|
||||
Err(InterpreterError::NotFound(_)) => {
|
||||
Ok(FindPythonResult::Err(PythonNotFound {
|
||||
request: request.clone(),
|
||||
python_preference: preference,
|
||||
environment_preference: environments,
|
||||
}))
|
||||
}
|
||||
Ok(installation) => Ok(Ok(installation)),
|
||||
Err(InterpreterError::NotFound(_)) => Ok(Err(PythonNotFound {
|
||||
request: request.clone(),
|
||||
python_preference: preference,
|
||||
environment_preference: environments,
|
||||
})),
|
||||
Err(err) => Err(Error::Query(
|
||||
Box::new(err),
|
||||
path.clone(),
|
||||
|
@ -829,18 +827,16 @@ pub fn find_python_installations<'a>(
|
|||
))
|
||||
}
|
||||
})),
|
||||
PythonRequest::Directory(path) => Box::new(std::iter::once({
|
||||
PythonRequest::Directory(path) => Box::new(iter::once({
|
||||
if preference.allows(PythonSource::ProvidedPath) {
|
||||
debug!("Checking for Python interpreter in {request}");
|
||||
match python_installation_from_directory(path, cache) {
|
||||
Ok(installation) => Ok(FindPythonResult::Ok(installation)),
|
||||
Err(InterpreterError::NotFound(_)) => {
|
||||
Ok(FindPythonResult::Err(PythonNotFound {
|
||||
request: request.clone(),
|
||||
python_preference: preference,
|
||||
environment_preference: environments,
|
||||
}))
|
||||
}
|
||||
Ok(installation) => Ok(Ok(installation)),
|
||||
Err(InterpreterError::NotFound(_)) => Ok(Err(PythonNotFound {
|
||||
request: request.clone(),
|
||||
python_preference: preference,
|
||||
environment_preference: environments,
|
||||
})),
|
||||
Err(err) => Err(Error::Query(
|
||||
Box::new(err),
|
||||
path.clone(),
|
||||
|
@ -863,14 +859,10 @@ pub fn find_python_installations<'a>(
|
|||
.filter(move |result| {
|
||||
result_satisfies_environment_preference(result, environments)
|
||||
})
|
||||
.map(|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
}),
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok)),
|
||||
)
|
||||
} else {
|
||||
Box::new(std::iter::once(Err(Error::SourceNotAllowed(
|
||||
Box::new(iter::once(Err(Error::SourceNotAllowed(
|
||||
request.clone(),
|
||||
PythonSource::SearchPath,
|
||||
preference,
|
||||
|
@ -879,13 +871,8 @@ pub fn find_python_installations<'a>(
|
|||
}
|
||||
PythonRequest::Any => Box::new({
|
||||
debug!("Searching for any Python interpreter in {sources}");
|
||||
python_interpreters(&VersionRequest::Any, None, environments, preference, cache).map(
|
||||
|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
},
|
||||
)
|
||||
python_interpreters(&VersionRequest::Any, None, environments, preference, cache)
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok))
|
||||
}),
|
||||
PythonRequest::Default => Box::new({
|
||||
debug!("Searching for default Python interpreter in {sources}");
|
||||
|
@ -896,23 +883,16 @@ pub fn find_python_installations<'a>(
|
|||
preference,
|
||||
cache,
|
||||
)
|
||||
.map(|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
})
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok))
|
||||
}),
|
||||
PythonRequest::Version(version) => {
|
||||
if let Err(err) = version.check_supported() {
|
||||
return Box::new(std::iter::once(Err(Error::InvalidVersionRequest(err))));
|
||||
return Box::new(iter::once(Err(Error::InvalidVersionRequest(err))));
|
||||
};
|
||||
Box::new({
|
||||
debug!("Searching for {request} in {sources}");
|
||||
python_interpreters(version, None, environments, preference, cache).map(|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
})
|
||||
python_interpreters(version, None, environments, preference, cache)
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok))
|
||||
})
|
||||
}
|
||||
PythonRequest::Implementation(implementation) => Box::new({
|
||||
|
@ -930,15 +910,11 @@ pub fn find_python_installations<'a>(
|
|||
.implementation_name()
|
||||
.eq_ignore_ascii_case(implementation.into()),
|
||||
})
|
||||
.map(|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
})
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok))
|
||||
}),
|
||||
PythonRequest::ImplementationVersion(implementation, version) => {
|
||||
if let Err(err) = version.check_supported() {
|
||||
return Box::new(std::iter::once(Err(Error::InvalidVersionRequest(err))));
|
||||
return Box::new(iter::once(Err(Error::InvalidVersionRequest(err))));
|
||||
};
|
||||
Box::new({
|
||||
debug!("Searching for {request} in {sources}");
|
||||
|
@ -955,17 +931,13 @@ pub fn find_python_installations<'a>(
|
|||
.implementation_name()
|
||||
.eq_ignore_ascii_case(implementation.into()),
|
||||
})
|
||||
.map(|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
})
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok))
|
||||
})
|
||||
}
|
||||
PythonRequest::Key(request) => {
|
||||
if let Some(version) = request.version() {
|
||||
if let Err(err) = version.check_supported() {
|
||||
return Box::new(std::iter::once(Err(Error::InvalidVersionRequest(err))));
|
||||
return Box::new(iter::once(Err(Error::InvalidVersionRequest(err))));
|
||||
};
|
||||
};
|
||||
Box::new({
|
||||
|
@ -981,11 +953,7 @@ pub fn find_python_installations<'a>(
|
|||
Err(_) => true,
|
||||
Ok((_source, interpreter)) => request.satisfied_by_interpreter(interpreter),
|
||||
})
|
||||
.map(|result| {
|
||||
result
|
||||
.map(PythonInstallation::from_tuple)
|
||||
.map(FindPythonResult::Ok)
|
||||
})
|
||||
.map(|result| result.map(PythonInstallation::from_tuple).map(Ok))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1058,7 +1026,7 @@ pub(crate) fn find_python_installation(
|
|||
return Ok(Ok(installation));
|
||||
}
|
||||
|
||||
Ok(FindPythonResult::Err(PythonNotFound {
|
||||
Ok(Err(PythonNotFound {
|
||||
request: request.clone(),
|
||||
environment_preference: environments,
|
||||
python_preference: preference,
|
||||
|
@ -1768,8 +1736,8 @@ impl ExecutableName {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for ExecutableName {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl fmt::Display for ExecutableName {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
if let Some(implementation) = self.implementation {
|
||||
write!(f, "{implementation}")?;
|
||||
} else {
|
||||
|
@ -1788,7 +1756,7 @@ impl std::fmt::Display for ExecutableName {
|
|||
write!(f, "{prerelease}")?;
|
||||
}
|
||||
f.write_str(self.variant.suffix())?;
|
||||
f.write_str(std::env::consts::EXE_SUFFIX)?;
|
||||
f.write_str(EXE_SUFFIX)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -2307,7 +2275,7 @@ impl FromStr for PythonVariant {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PythonVariant {
|
||||
impl fmt::Display for PythonVariant {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Default => f.write_str("default"),
|
||||
|
|
|
@ -111,8 +111,8 @@ impl fmt::Display for EnvironmentNotFound {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for InvalidEnvironment {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl fmt::Display for InvalidEnvironment {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"Invalid environment at `{}`: {}",
|
||||
|
@ -122,8 +122,8 @@ impl std::fmt::Display for InvalidEnvironment {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for InvalidEnvironmentKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
impl fmt::Display for InvalidEnvironmentKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::NotDirectory => write!(f, "expected directory but found a file"),
|
||||
Self::MissingExecutable(path) => {
|
||||
|
|
|
@ -83,7 +83,7 @@ pub enum Error {
|
|||
#[error("Failed to read managed Python directory name: {0}")]
|
||||
NameError(String),
|
||||
#[error("Failed to construct absolute path to managed Python directory: {}", _0.user_display())]
|
||||
AbsolutePath(PathBuf, #[source] std::io::Error),
|
||||
AbsolutePath(PathBuf, #[source] io::Error),
|
||||
#[error(transparent)]
|
||||
NameParseError(#[from] installation::PythonInstallationKeyError),
|
||||
#[error(transparent)]
|
||||
|
@ -443,7 +443,7 @@ impl ManagedPythonInstallation {
|
|||
continue;
|
||||
}
|
||||
|
||||
match uv_fs::symlink_or_copy_file(&python, &executable) {
|
||||
match symlink_or_copy_file(&python, &executable) {
|
||||
Ok(()) => {
|
||||
debug!(
|
||||
"Created link {} -> {}",
|
||||
|
|
|
@ -2432,7 +2432,7 @@ impl PackageId {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PackageId {
|
||||
impl Display for PackageId {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "{}=={} @ {}", self.name, self.version, self.source)
|
||||
}
|
||||
|
@ -2736,7 +2736,7 @@ impl Source {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Source {
|
||||
impl Display for Source {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
Source::Registry(RegistrySource::Url(url))
|
||||
|
@ -2866,7 +2866,7 @@ enum RegistrySource {
|
|||
Path(PathBuf),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for RegistrySource {
|
||||
impl Display for RegistrySource {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
match self {
|
||||
RegistrySource::Url(url) => write!(f, "{url}"),
|
||||
|
@ -3765,7 +3765,7 @@ impl Dependency {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Dependency {
|
||||
impl Display for Dependency {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
if self.extra.is_empty() {
|
||||
write!(
|
||||
|
@ -3826,7 +3826,7 @@ impl From<HashDigest> for Hash {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for Hash {
|
||||
impl FromStr for Hash {
|
||||
type Err = HashParseError;
|
||||
|
||||
fn from_str(s: &str) -> Result<Hash, HashParseError> {
|
||||
|
@ -3843,7 +3843,7 @@ impl std::str::FromStr for Hash {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Hash {
|
||||
impl Display for Hash {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
write!(f, "{}:{}", self.0.algorithm, self.0.digest)
|
||||
}
|
||||
|
@ -4249,21 +4249,21 @@ enum LockErrorKind {
|
|||
DistributionRelativePath(
|
||||
/// The inner error we forward.
|
||||
#[source]
|
||||
std::io::Error,
|
||||
io::Error,
|
||||
),
|
||||
/// An error that occurs when converting an index URL to a relative path
|
||||
#[error("Could not compute relative path between workspace and index")]
|
||||
IndexRelativePath(
|
||||
/// The inner error we forward.
|
||||
#[source]
|
||||
std::io::Error,
|
||||
io::Error,
|
||||
),
|
||||
/// An error that occurs when converting a lockfile path from relative to absolute.
|
||||
#[error("Could not compute absolute path from workspace root and lockfile path")]
|
||||
AbsolutePath(
|
||||
/// The inner error we forward.
|
||||
#[source]
|
||||
std::io::Error,
|
||||
io::Error,
|
||||
),
|
||||
/// An error that occurs when an ambiguous `package.dependency` is
|
||||
/// missing a `version` field.
|
||||
|
@ -4290,7 +4290,7 @@ enum LockErrorKind {
|
|||
RequirementRelativePath(
|
||||
/// The inner error we forward.
|
||||
#[source]
|
||||
std::io::Error,
|
||||
io::Error,
|
||||
),
|
||||
/// An error that occurs when parsing an existing requirement.
|
||||
#[error("Could not convert between URL and path")]
|
||||
|
@ -4368,7 +4368,7 @@ struct HashParseError(&'static str);
|
|||
|
||||
impl std::error::Error for HashParseError {}
|
||||
|
||||
impl std::fmt::Display for HashParseError {
|
||||
impl Display for HashParseError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
||||
Display::fmt(self.0, f)
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ pub(crate) enum PubGrubPriority {
|
|||
///
|
||||
/// N.B.: URLs need to have priority over registry distributions for correctly matching registry
|
||||
/// distributions to URLs, see [`PubGrubPackage::from_package`] an
|
||||
/// [`crate::fork_urls::ForkUrls`].
|
||||
/// [`ForkUrls`].
|
||||
DirectUrl(Reverse<usize>),
|
||||
|
||||
/// The package is the root package.
|
||||
|
|
|
@ -1908,7 +1908,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
|||
}
|
||||
if !requirement.evaluate_markers(
|
||||
env.marker_environment(),
|
||||
std::slice::from_ref(source_extra),
|
||||
slice::from_ref(source_extra),
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
|
@ -2016,7 +2016,7 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
|||
Some(source_extra) => {
|
||||
if !constraint.evaluate_markers(
|
||||
env.marker_environment(),
|
||||
std::slice::from_ref(source_extra),
|
||||
slice::from_ref(source_extra),
|
||||
) {
|
||||
return None;
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ impl PyProjectTomlMut {
|
|||
if index.default {
|
||||
if !table
|
||||
.get("default")
|
||||
.and_then(toml_edit::Item::as_bool)
|
||||
.and_then(Item::as_bool)
|
||||
.is_some_and(|default| default)
|
||||
{
|
||||
let mut formatted = Formatted::new(true);
|
||||
|
@ -371,7 +371,7 @@ impl PyProjectTomlMut {
|
|||
});
|
||||
|
||||
// Set the position to the minimum, if it's not already the first element.
|
||||
if let Some(min) = existing.iter().filter_map(toml_edit::Table::position).min() {
|
||||
if let Some(min) = existing.iter().filter_map(Table::position).min() {
|
||||
table.set_position(min);
|
||||
|
||||
// Increment the position of all existing elements.
|
||||
|
|
|
@ -1092,8 +1092,8 @@ impl<'a> From<Source<'a>> for AnnotatedSource<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for AnnotatedSource<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl fmt::Display for AnnotatedSource<'_> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
if let Some(package) = &self.package {
|
||||
write!(f, "{} @ {}", package, self.path().simplified_display())
|
||||
} else {
|
||||
|
|
|
@ -140,7 +140,7 @@ impl PagerKind {
|
|||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for PagerKind {
|
||||
impl Display for PagerKind {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Less => write!(f, "less"),
|
||||
|
|
|
@ -66,7 +66,7 @@ pub(crate) async fn list(
|
|||
|
||||
let downloads = download_request
|
||||
.as_ref()
|
||||
.map(uv_python::downloads::PythonDownloadRequest::iter_downloads)
|
||||
.map(PythonDownloadRequest::iter_downloads)
|
||||
.into_iter()
|
||||
.flatten();
|
||||
|
||||
|
|
|
@ -790,7 +790,7 @@ impl PythonInstallSettings {
|
|||
/// Resolve the [`PythonInstallSettings`] from the CLI and filesystem configuration.
|
||||
#[allow(clippy::needless_pass_by_value)]
|
||||
pub(crate) fn resolve(args: PythonInstallArgs, filesystem: Option<FilesystemOptions>) -> Self {
|
||||
let options = filesystem.map(uv_settings::FilesystemOptions::into_options);
|
||||
let options = filesystem.map(FilesystemOptions::into_options);
|
||||
let (python_mirror, pypy_mirror) = match options {
|
||||
Some(options) => (
|
||||
options.install_mirrors.python_install_mirror,
|
||||
|
|
|
@ -291,7 +291,7 @@ impl TestContext {
|
|||
|
||||
// The workspace root directory is not available without walking up the tree
|
||||
// https://github.com/rust-lang/cargo/issues/3946
|
||||
let workspace_root = Path::new(&std::env::var(EnvVars::CARGO_MANIFEST_DIR).unwrap())
|
||||
let workspace_root = Path::new(&env::var(EnvVars::CARGO_MANIFEST_DIR).unwrap())
|
||||
.parent()
|
||||
.expect("CARGO_MANIFEST_DIR should be nested in workspace")
|
||||
.parent()
|
||||
|
@ -672,7 +672,7 @@ impl TestContext {
|
|||
.env(EnvVars::UV_PYTHON_BIN_DIR, bin.as_os_str())
|
||||
.env(
|
||||
EnvVars::PATH,
|
||||
std::env::join_paths(std::iter::once(bin).chain(std::env::split_paths(
|
||||
env::join_paths(std::iter::once(bin).chain(env::split_paths(
|
||||
&env::var(EnvVars::PATH).unwrap_or_default(),
|
||||
)))
|
||||
.unwrap(),
|
||||
|
@ -892,7 +892,7 @@ impl TestContext {
|
|||
pub fn python_path(&self) -> OsString {
|
||||
if cfg!(unix) {
|
||||
// On Unix, we needed to normalize the Python executable names to `python3` for the tests
|
||||
std::env::join_paths(
|
||||
env::join_paths(
|
||||
self.python_versions
|
||||
.iter()
|
||||
.map(|(version, _)| self.python_dir.join(version.to_string())),
|
||||
|
@ -900,7 +900,7 @@ impl TestContext {
|
|||
.unwrap()
|
||||
} else {
|
||||
// On Windows, just join the parent directories of the executables
|
||||
std::env::join_paths(
|
||||
env::join_paths(
|
||||
self.python_versions
|
||||
.iter()
|
||||
.map(|(_, executable)| executable.parent().unwrap().to_path_buf()),
|
||||
|
@ -988,7 +988,7 @@ impl TestContext {
|
|||
change(self),
|
||||
self.filters(),
|
||||
"diff_lock",
|
||||
Some(crate::common::WindowsFilters::Platform),
|
||||
Some(WindowsFilters::Platform),
|
||||
);
|
||||
assert!(status.success(), "{snapshot}");
|
||||
let new_lock = fs_err::read_to_string(&lock_path).unwrap();
|
||||
|
@ -1097,11 +1097,7 @@ pub fn get_python(version: &PythonVersion) -> PathBuf {
|
|||
}
|
||||
|
||||
/// Create a virtual environment at the given path.
|
||||
pub fn create_venv_from_executable<P: AsRef<std::path::Path>>(
|
||||
path: P,
|
||||
cache_dir: &ChildPath,
|
||||
python: &Path,
|
||||
) {
|
||||
pub fn create_venv_from_executable<P: AsRef<Path>>(path: P, cache_dir: &ChildPath, python: &Path) {
|
||||
assert_cmd::Command::new(get_bin())
|
||||
.arg("venv")
|
||||
.arg(path.as_ref().as_os_str())
|
||||
|
@ -1129,7 +1125,7 @@ pub fn python_path_with_versions(
|
|||
temp_dir: &ChildPath,
|
||||
python_versions: &[&str],
|
||||
) -> anyhow::Result<OsString> {
|
||||
Ok(std::env::join_paths(
|
||||
Ok(env::join_paths(
|
||||
python_installations_for_versions(temp_dir, python_versions)?
|
||||
.into_iter()
|
||||
.map(|path| path.parent().unwrap().to_path_buf()),
|
||||
|
@ -1371,7 +1367,7 @@ pub fn decode_token(content: &[&str]) -> String {
|
|||
/// certificate verification, passing through the `BaseClient`
|
||||
#[tokio::main(flavor = "current_thread")]
|
||||
pub async fn download_to_disk(url: &str, path: &Path) {
|
||||
let trusted_hosts: Vec<_> = std::env::var(EnvVars::UV_INSECURE_HOST)
|
||||
let trusted_hosts: Vec<_> = env::var(EnvVars::UV_INSECURE_HOST)
|
||||
.unwrap_or_default()
|
||||
.split(' ')
|
||||
.map(|h| uv_configuration::TrustedHost::from_str(h).unwrap())
|
||||
|
|
|
@ -12686,7 +12686,7 @@ fn tool_uv_sources() -> Result<()> {
|
|||
poetry_editable = { path = "../poetry_editable", editable = true }
|
||||
"#})?;
|
||||
|
||||
let project_root = fs_err::canonicalize(std::env::current_dir()?.join("../.."))?;
|
||||
let project_root = fs_err::canonicalize(current_dir()?.join("../.."))?;
|
||||
fs_err::create_dir_all(context.temp_dir.join("poetry_editable/poetry_editable"))?;
|
||||
fs_err::copy(
|
||||
project_root.join("scripts/packages/poetry_editable/pyproject.toml"),
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use assert_fs::prelude::PathChild;
|
||||
use assert_fs::{fixture::FileWriteStr, prelude::PathCreateDir};
|
||||
use fs_err::remove_dir_all;
|
||||
use indoc::indoc;
|
||||
|
||||
use uv_python::platform::{Arch, Os};
|
||||
|
@ -450,7 +449,7 @@ fn python_find_venv() {
|
|||
"###);
|
||||
|
||||
// But if we delete the parent virtual environment
|
||||
remove_dir_all(context.temp_dir.child(".venv")).unwrap();
|
||||
fs_err::remove_dir_all(context.temp_dir.child(".venv")).unwrap();
|
||||
|
||||
// And query from there... we should not find the child virtual environment
|
||||
uv_snapshot!(context.filters(), context.python_find(), @r###"
|
||||
|
|
|
@ -217,7 +217,7 @@ fn python_pin_no_python() {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn python_pin_compatible_with_requires_python() -> anyhow::Result<()> {
|
||||
fn python_pin_compatible_with_requires_python() -> Result<()> {
|
||||
let context: TestContext =
|
||||
TestContext::new_with_versions(&["3.10", "3.11"]).with_filtered_python_sources();
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
|
@ -388,7 +388,7 @@ fn python_pin_compatible_with_requires_python() -> anyhow::Result<()> {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn warning_pinned_python_version_not_installed() -> anyhow::Result<()> {
|
||||
fn warning_pinned_python_version_not_installed() -> Result<()> {
|
||||
let context: TestContext = TestContext::new_with_versions(&["3.10", "3.11"]);
|
||||
let pyproject_toml = context.temp_dir.child("pyproject.toml");
|
||||
pyproject_toml.write_str(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue