mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Support missing build_system
key (#213)
Reduces the number of failing projects out of the top 1000 pypi projects from 5 to 2.
This commit is contained in:
parent
8b83385763
commit
6cd4650c1f
1 changed files with 24 additions and 9 deletions
|
@ -12,7 +12,8 @@ use flate2::read::GzDecoder;
|
||||||
use fs_err as fs;
|
use fs_err as fs;
|
||||||
use fs_err::{DirEntry, File};
|
use fs_err::{DirEntry, File};
|
||||||
use indoc::formatdoc;
|
use indoc::formatdoc;
|
||||||
use pyproject_toml::PyProjectToml;
|
use pyproject_toml::{BuildSystem, Project};
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use tar::Archive;
|
use tar::Archive;
|
||||||
use tempfile::{tempdir, TempDir};
|
use tempfile::{tempdir, TempDir};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
@ -59,6 +60,16 @@ impl Error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A pyproject.toml as specified in PEP 517
|
||||||
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||||
|
#[serde(rename_all = "kebab-case")]
|
||||||
|
pub struct PyProjectToml {
|
||||||
|
/// Build-related data
|
||||||
|
pub build_system: Option<BuildSystem>,
|
||||||
|
/// Project metadata
|
||||||
|
pub project: Option<Project>,
|
||||||
|
}
|
||||||
|
|
||||||
/// `[build-backend]` from pyproject.toml
|
/// `[build-backend]` from pyproject.toml
|
||||||
struct Pep517Backend {
|
struct Pep517Backend {
|
||||||
/// The build backend string such as `setuptools.build_meta:__legacy__` or `maturin` from
|
/// The build backend string such as `setuptools.build_meta:__legacy__` or `maturin` from
|
||||||
|
@ -125,14 +136,18 @@ impl SourceDistributionBuilder {
|
||||||
// > source tree is not using this specification, and tools should revert to the legacy
|
// > source tree is not using this specification, and tools should revert to the legacy
|
||||||
// > behaviour of running setup.py (either directly, or by implicitly invoking the
|
// > behaviour of running setup.py (either directly, or by implicitly invoking the
|
||||||
// > setuptools.build_meta:__legacy__ backend).
|
// > setuptools.build_meta:__legacy__ backend).
|
||||||
if let Some(backend) = pyproject_toml.build_system.build_backend {
|
if let Some(build_system) = pyproject_toml.build_system {
|
||||||
pep517 = Some(Pep517Backend {
|
if let Some(backend) = build_system.build_backend {
|
||||||
backend,
|
pep517 = Some(Pep517Backend {
|
||||||
requirements: pyproject_toml.build_system.requires,
|
backend,
|
||||||
});
|
requirements: build_system.requires,
|
||||||
};
|
});
|
||||||
if pyproject_toml.build_system.backend_path.is_some() {
|
};
|
||||||
todo!("backend-path is not supported yet")
|
if build_system.backend_path.is_some() {
|
||||||
|
return Err(Error::InvalidSourceDistribution(
|
||||||
|
"backend-path is not supported yet".to_string(),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue