Skip to content

Commit

Permalink
Ignore deps
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 10, 2024
1 parent b632b5e commit 021f040
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions crates/pypi-types/src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub enum MetadataError {
#[error("The following field was marked as dynamic: {0}")]
DynamicField(&'static str),
#[error("The project uses Poetry's syntax to declare its dependencies, despite including a `project` table in `pyproject.toml`")]
Poetry,
PoetrySyntax,
}

impl From<Pep508Error<VerbatimParsedUrl>> for MetadataError {
Expand Down Expand Up @@ -213,11 +213,12 @@ impl Metadata23 {
}

// If dependencies are declared with Poetry, and `project.dependencies` is omitted, treat
// the dependencies as dynamic.
// the dependencies as dynamic. The inclusion of a `project` table without defining
// `project.dependencies` is almost certainly an error.
if project.dependencies.is_none()
&& pyproject_toml.tool.and_then(|tool| tool.poetry).is_some()
{
return Err(MetadataError::Poetry);
return Err(MetadataError::PoetrySyntax);
}

let name = project.name;
Expand Down Expand Up @@ -306,7 +307,7 @@ struct Tool {

#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
struct ToolPoetry {}
struct ToolPoetry;

/// Python Package Metadata 1.0 and later as specified in
/// <https://peps.python.org/pep-0241/>.
Expand Down Expand Up @@ -390,11 +391,12 @@ impl RequiresDist {
}

// If dependencies are declared with Poetry, and `project.dependencies` is omitted, treat
// the dependencies as dynamic.
// the dependencies as dynamic. The inclusion of a `project` table without defining
// `project.dependencies` is almost certainly an error.
if project.dependencies.is_none()
&& pyproject_toml.tool.and_then(|tool| tool.poetry).is_some()
{
return Err(MetadataError::Poetry);
return Err(MetadataError::PoetrySyntax);
}

let name = project.name;
Expand Down
4 changes: 2 additions & 2 deletions crates/uv-distribution/src/source/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
| pypi_types::MetadataError::DynamicField(_)
| pypi_types::MetadataError::FieldNotFound(_)
| pypi_types::MetadataError::UnsupportedMetadataVersion(_)
| pypi_types::MetadataError::Poetry,
| pypi_types::MetadataError::PoetrySyntax,
)),
) => {
debug!("No static `PKG-INFO` available for: {source} ({err:?})");
Expand All @@ -1443,7 +1443,7 @@ impl<'a, T: BuildContext> SourceDistributionBuilder<'a, T> {
| pypi_types::MetadataError::DynamicField(_)
| pypi_types::MetadataError::FieldNotFound(_)
| pypi_types::MetadataError::UnsupportedMetadataVersion(_)
| pypi_types::MetadataError::Poetry,
| pypi_types::MetadataError::PoetrySyntax,
)),
) => {
debug!("No static `pyproject.toml` available for: {source} ({err:?})");
Expand Down

0 comments on commit 021f040

Please sign in to comment.