mirror of https://github.com/astral-sh/uv
Resolve commits
This commit is contained in:
parent
ba8284379c
commit
203594d482
|
|
@ -10,7 +10,7 @@ use tempfile::TempDir;
|
|||
use tokio::io::{AsyncRead, AsyncSeekExt, ReadBuf};
|
||||
use tokio::sync::Semaphore;
|
||||
use tokio_util::compat::FuturesAsyncReadCompatExt;
|
||||
use tracing::{Instrument, info_span, instrument, warn};
|
||||
use tracing::{Instrument, info_span, instrument, warn, debug};
|
||||
use url::Url;
|
||||
|
||||
use uv_cache::{ArchiveId, CacheBucket, CacheEntry, WheelCache};
|
||||
|
|
@ -543,6 +543,9 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
source: &BuildableSource<'_>,
|
||||
hashes: HashPolicy<'_>,
|
||||
) -> Result<ArchiveMetadata, Error> {
|
||||
// Resolve the source distribution to a precise revision (i.e., a specific Git commit).
|
||||
self.builder.resolve_revision(source, &self.client).await?;
|
||||
|
||||
// If the metadata was provided by the user directly, prefer it.
|
||||
if let Some(dist) = source.as_dist() {
|
||||
if let Some(metadata) = self
|
||||
|
|
@ -550,10 +553,6 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
.dependency_metadata()
|
||||
.get(dist.name(), dist.version())
|
||||
{
|
||||
// If we skipped the build, we should still resolve any Git dependencies to precise
|
||||
// commits.
|
||||
self.builder.resolve_revision(source, &self.client).await?;
|
||||
|
||||
return Ok(ArchiveMetadata::from_metadata23(metadata.clone()));
|
||||
}
|
||||
}
|
||||
|
|
@ -606,11 +605,13 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
match compatible_dist {
|
||||
CompatibleDist::InstalledDist(..) => {}
|
||||
CompatibleDist::SourceDist { sdist, .. } => {
|
||||
debug!("Found cached remote source distribution for: {dist}");
|
||||
let dist = SourceDist::Registry(sdist.clone());
|
||||
return self.build_wheel_inner(&dist, tags, hashes).await.map(Some);
|
||||
}
|
||||
CompatibleDist::CompatibleWheel { wheel, .. }
|
||||
| CompatibleDist::IncompatibleWheel { wheel, .. } => {
|
||||
debug!("Found cached remote built distribution for: {dist}");
|
||||
let dist = BuiltDist::Registry(RegistryBuiltDist {
|
||||
wheels: vec![wheel.clone()],
|
||||
best_wheel_index: 0,
|
||||
|
|
@ -652,6 +653,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
match compatible_dist {
|
||||
CompatibleDist::InstalledDist(..) => {}
|
||||
CompatibleDist::SourceDist { sdist, .. } => {
|
||||
debug!("Found cached remote source distribution for: {dist}");
|
||||
let dist = SourceDist::Registry(sdist.clone());
|
||||
return self
|
||||
.build_wheel_metadata_inner(&BuildableSource::Dist(&dist), hashes)
|
||||
|
|
@ -660,6 +662,7 @@ impl<'a, Context: BuildContext> DistributionDatabase<'a, Context> {
|
|||
}
|
||||
CompatibleDist::CompatibleWheel { wheel, .. }
|
||||
| CompatibleDist::IncompatibleWheel { wheel, .. } => {
|
||||
debug!("Found cached remote built distribution for: {dist}");
|
||||
let dist = BuiltDist::Registry(RegistryBuiltDist {
|
||||
wheels: vec![wheel.clone()],
|
||||
best_wheel_index: 0,
|
||||
|
|
|
|||
|
|
@ -92,10 +92,14 @@ impl<'a, T: BuildContext> RemoteCacheResolver<'a, T> {
|
|||
return Ok(Vec::default());
|
||||
};
|
||||
|
||||
let Some(precise) = self.build_context.git().get_precise(&dist.git) else {
|
||||
return Ok(Vec::default());
|
||||
};
|
||||
|
||||
// Store the index entries in a cache, to avoid redundant fetches.
|
||||
let index = IndexUrl::from(
|
||||
VerbatimUrl::parse_url(format!(
|
||||
"http://localhost:8000/v1/git/{workspace}/{}/{}",
|
||||
"http://localhost:8000/v1/git/{workspace}/{}/{}/{precise}",
|
||||
repo.owner, repo.repo
|
||||
))
|
||||
.unwrap(),
|
||||
|
|
|
|||
|
|
@ -1690,19 +1690,6 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
|||
.await
|
||||
{
|
||||
Ok(Some(precise)) => {
|
||||
// STOPSHIP(charlie): Here, we should check if a pre-built wheel or source
|
||||
// distribution exists in pyx. If a wheel exists, we can always get the PEP 653
|
||||
// metadata.
|
||||
|
||||
// let result = self
|
||||
// .client
|
||||
// .managed(|client| {
|
||||
// client
|
||||
// .wheel_metadata(dist, self.build_context.capabilities())
|
||||
// .boxed_local()
|
||||
// })
|
||||
// .await;
|
||||
|
||||
// There's no need to check the cache, since we can't use cached metadata if there are
|
||||
// sources, and we can't know if there are sources without fetching the
|
||||
// `pyproject.toml`.
|
||||
|
|
|
|||
Loading…
Reference in New Issue