Improve DirWithoutEntrypoint error message (#3690)
Ran into this and couldn't tell what the problem was without the path attached.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tokio::task::JoinError;
|
||||
use zip::result::ZipError;
|
||||
|
||||
@@ -7,6 +8,7 @@ use distribution_types::ParsedUrlError;
|
||||
use pep440_rs::Version;
|
||||
use pypi_types::HashDigest;
|
||||
use uv_client::BetterReqwestError;
|
||||
use uv_fs::Simplified;
|
||||
use uv_normalize::PackageName;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@@ -60,8 +62,8 @@ pub enum Error {
|
||||
DistInfo(#[from] install_wheel_rs::Error),
|
||||
#[error("Failed to read zip archive from built wheel")]
|
||||
Zip(#[from] ZipError),
|
||||
#[error("Source distribution directory contains neither readable pyproject.toml nor setup.py")]
|
||||
DirWithoutEntrypoint,
|
||||
#[error("Source distribution directory contains neither readable pyproject.toml nor setup.py: `{}`", _0.user_display())]
|
||||
DirWithoutEntrypoint(PathBuf),
|
||||
#[error("Failed to extract archive")]
|
||||
Extract(#[from] uv_extract::Error),
|
||||
#[error("Source distribution not found at: {0}")]
|
||||
|
||||
@@ -105,7 +105,7 @@ impl<'a> BuiltWheelIndex<'a> {
|
||||
let Some(modified) =
|
||||
ArchiveTimestamp::from_source_tree(&source_dist.path).map_err(Error::CacheRead)?
|
||||
else {
|
||||
return Err(Error::DirWithoutEntrypoint);
|
||||
return Err(Error::DirWithoutEntrypoint(source_dist.path.clone()));
|
||||
};
|
||||
|
||||
// If the distribution is stale, omit it from the index.
|
||||
|
||||
@@ -978,7 +978,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
||||
let Some(modified) =
|
||||
ArchiveTimestamp::from_source_tree(&resource.path).map_err(Error::CacheRead)?
|
||||
else {
|
||||
return Err(Error::DirWithoutEntrypoint);
|
||||
return Err(Error::DirWithoutEntrypoint(resource.path.to_path_buf()));
|
||||
};
|
||||
|
||||
// Read the existing metadata from the cache.
|
||||
|
||||
Reference in New Issue
Block a user