mirror of
https://github.com/astral-sh/uv.git
synced 2025-11-25 05:33:43 +00:00
Preparing for #235, some refactoring to `puffin_interpreter`. * Added a dedicated error type instead of anyhow * `InterpreterInfo` -> `Interpreter` * `detect_virtual_env` now returns an option so it can be chained for #235
This commit is contained in:
parent
9d35128840
commit
1c0e03f807
19 changed files with 201 additions and 163 deletions
|
|
@ -15,7 +15,7 @@ use pep440_rs::Version;
|
|||
use pep508_rs::{Requirement, VersionOrUrl};
|
||||
use platform_tags::{TagPriority, Tags};
|
||||
use puffin_client::RegistryClient;
|
||||
use puffin_interpreter::InterpreterInfo;
|
||||
use puffin_interpreter::Interpreter;
|
||||
use puffin_normalize::PackageName;
|
||||
use pypi_types::{File, IndexUrl, SimpleJson};
|
||||
|
||||
|
|
@ -26,21 +26,17 @@ pub struct DistFinder<'a> {
|
|||
tags: &'a Tags,
|
||||
client: &'a RegistryClient,
|
||||
reporter: Option<Box<dyn Reporter>>,
|
||||
interpreter_info: &'a InterpreterInfo,
|
||||
interpreter: &'a Interpreter,
|
||||
}
|
||||
|
||||
impl<'a> DistFinder<'a> {
|
||||
/// Initialize a new distribution finder.
|
||||
pub fn new(
|
||||
tags: &'a Tags,
|
||||
client: &'a RegistryClient,
|
||||
interpreter_info: &'a InterpreterInfo,
|
||||
) -> Self {
|
||||
pub fn new(tags: &'a Tags, client: &'a RegistryClient, interpreter: &'a Interpreter) -> Self {
|
||||
Self {
|
||||
tags,
|
||||
client,
|
||||
reporter: None,
|
||||
interpreter_info,
|
||||
interpreter,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +153,7 @@ impl<'a> DistFinder<'a> {
|
|||
.requires_python
|
||||
.as_ref()
|
||||
.map_or(true, |requires_python| {
|
||||
requires_python.contains(self.interpreter_info.version())
|
||||
requires_python.contains(self.interpreter.version())
|
||||
})
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -552,7 +552,7 @@ impl<'a, Context: BuildContext + Send + Sync> Resolver<'a, Context> {
|
|||
metadata,
|
||||
&package_name,
|
||||
self.tags,
|
||||
self.build_context.interpreter_info().version(),
|
||||
self.build_context.interpreter().version(),
|
||||
self.exclude_newer.as_ref(),
|
||||
);
|
||||
self.index
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue