mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-29 03:02:55 +00:00
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:
parent
906f653062
commit
2c4088a518
3 changed files with 6 additions and 4 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use tokio::task::JoinError;
|
use tokio::task::JoinError;
|
||||||
use zip::result::ZipError;
|
use zip::result::ZipError;
|
||||||
|
|
||||||
|
|
@ -7,6 +8,7 @@ use distribution_types::ParsedUrlError;
|
||||||
use pep440_rs::Version;
|
use pep440_rs::Version;
|
||||||
use pypi_types::HashDigest;
|
use pypi_types::HashDigest;
|
||||||
use uv_client::BetterReqwestError;
|
use uv_client::BetterReqwestError;
|
||||||
|
use uv_fs::Simplified;
|
||||||
use uv_normalize::PackageName;
|
use uv_normalize::PackageName;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
|
@ -60,8 +62,8 @@ pub enum Error {
|
||||||
DistInfo(#[from] install_wheel_rs::Error),
|
DistInfo(#[from] install_wheel_rs::Error),
|
||||||
#[error("Failed to read zip archive from built wheel")]
|
#[error("Failed to read zip archive from built wheel")]
|
||||||
Zip(#[from] ZipError),
|
Zip(#[from] ZipError),
|
||||||
#[error("Source distribution directory contains neither readable pyproject.toml nor setup.py")]
|
#[error("Source distribution directory contains neither readable pyproject.toml nor setup.py: `{}`", _0.user_display())]
|
||||||
DirWithoutEntrypoint,
|
DirWithoutEntrypoint(PathBuf),
|
||||||
#[error("Failed to extract archive")]
|
#[error("Failed to extract archive")]
|
||||||
Extract(#[from] uv_extract::Error),
|
Extract(#[from] uv_extract::Error),
|
||||||
#[error("Source distribution not found at: {0}")]
|
#[error("Source distribution not found at: {0}")]
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ impl<'a> BuiltWheelIndex<'a> {
|
||||||
let Some(modified) =
|
let Some(modified) =
|
||||||
ArchiveTimestamp::from_source_tree(&source_dist.path).map_err(Error::CacheRead)?
|
ArchiveTimestamp::from_source_tree(&source_dist.path).map_err(Error::CacheRead)?
|
||||||
else {
|
else {
|
||||||
return Err(Error::DirWithoutEntrypoint);
|
return Err(Error::DirWithoutEntrypoint(source_dist.path.clone()));
|
||||||
};
|
};
|
||||||
|
|
||||||
// If the distribution is stale, omit it from the index.
|
// If the distribution is stale, omit it from the index.
|
||||||
|
|
|
||||||
|
|
@ -978,7 +978,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
|
||||||
let Some(modified) =
|
let Some(modified) =
|
||||||
ArchiveTimestamp::from_source_tree(&resource.path).map_err(Error::CacheRead)?
|
ArchiveTimestamp::from_source_tree(&resource.path).map_err(Error::CacheRead)?
|
||||||
else {
|
else {
|
||||||
return Err(Error::DirWithoutEntrypoint);
|
return Err(Error::DirWithoutEntrypoint(resource.path.to_path_buf()));
|
||||||
};
|
};
|
||||||
|
|
||||||
// Read the existing metadata from the cache.
|
// Read the existing metadata from the cache.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue