mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 10:58:28 +00:00
Add source distribution support to the DistributionFinder
(#322)
## Summary This just enables the `DistributionFinder` (previously known as the `WheelFinder`) to select source distributions when there are no matching wheels for a given platform. As a reminder, the `DistributionFinder` is a simple resolver that doesn't look at any dependencies: it just takes a set of pinned packages, and finds a distribution to install to satisfy each requirement.
This commit is contained in:
parent
d785ffdbff
commit
1637f1c216
5 changed files with 56 additions and 64 deletions
|
@ -16,7 +16,7 @@ use puffin_installer::PartitionedRequirements;
|
|||
use puffin_interpreter::Virtualenv;
|
||||
|
||||
use crate::commands::reporters::{
|
||||
DownloadReporter, InstallReporter, UnzipReporter, WheelFinderReporter,
|
||||
DownloadReporter, FinderReporter, InstallReporter, UnzipReporter,
|
||||
};
|
||||
use crate::commands::{elapsed, ExitStatus};
|
||||
use crate::index_urls::IndexUrls;
|
||||
|
@ -118,8 +118,8 @@ pub(crate) async fn sync_requirements(
|
|||
} else {
|
||||
let start = std::time::Instant::now();
|
||||
|
||||
let wheel_finder = puffin_resolver::WheelFinder::new(&tags, &client)
|
||||
.with_reporter(WheelFinderReporter::from(printer).with_length(remote.len() as u64));
|
||||
let wheel_finder = puffin_resolver::DistributionFinder::new(&tags, &client)
|
||||
.with_reporter(FinderReporter::from(printer).with_length(remote.len() as u64));
|
||||
let resolution = wheel_finder.resolve(&remote).await?;
|
||||
|
||||
let s = if resolution.len() == 1 { "" } else { "s" };
|
||||
|
|
|
@ -9,11 +9,11 @@ use puffin_normalize::PackageName;
|
|||
use crate::printer::Printer;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct WheelFinderReporter {
|
||||
pub(crate) struct FinderReporter {
|
||||
progress: ProgressBar,
|
||||
}
|
||||
|
||||
impl From<Printer> for WheelFinderReporter {
|
||||
impl From<Printer> for FinderReporter {
|
||||
fn from(printer: Printer) -> Self {
|
||||
let progress = ProgressBar::with_draw_target(None, printer.target());
|
||||
progress.set_style(
|
||||
|
@ -24,7 +24,7 @@ impl From<Printer> for WheelFinderReporter {
|
|||
}
|
||||
}
|
||||
|
||||
impl WheelFinderReporter {
|
||||
impl FinderReporter {
|
||||
#[must_use]
|
||||
pub(crate) fn with_length(self, length: u64) -> Self {
|
||||
self.progress.set_length(length);
|
||||
|
@ -32,7 +32,7 @@ impl WheelFinderReporter {
|
|||
}
|
||||
}
|
||||
|
||||
impl puffin_resolver::WheelFinderReporter for WheelFinderReporter {
|
||||
impl puffin_resolver::FinderReporter for FinderReporter {
|
||||
fn on_progress(&self, wheel: &RemoteDistribution) {
|
||||
self.progress.set_message(format!("{wheel}"));
|
||||
self.progress.inc(1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue