mod build_backend

module build_backend

Build requirements a Python source states in its own pyproject.toml.

PEP 517 makes a project name what building it needs: [build-system] requires lists the backend and its helpers, and pip installs them before it builds. EasyBuild installs with --no-build-isolation and no index, so each of those has to be a module already, or the build stops at “Backend ‘maturin’ is not available”. A recipe written for one release says nothing about the next one’s backend: PuLP 3.3 built with setuptools and 4.2 builds a Rust extension with maturin. After a version bump the new sdist is the only evidence, so it is read here and each requirement is mapped onto the module that provides it.

Functions

fn adopt_cargo_build(bundle: &mut crate::package_workflow::PackageBundle, declared: &DeclaredBuild) -> Result<bool, crate::package_workflow::PackageWorkflowError>

Turn a PythonPackage recipe whose new release builds a locked Rust crate into a CargoPythonPackage with an empty crates list after sources. The crate-list rewrite then fills it, with checksums, from the release’s own Cargo.lock. Returns whether the text changed.

fn build_requirement_layer(request: &crate::package_workflow::BumpPackageRequest, recipe: &crate::eb_parse::ResolvedEasyconfig, declared: &DeclaredBuild) -> Result<(Option<crate::package_config::PackageConfigLayer>, Vec<BuildRequirement>), crate::package_workflow::PackageWorkflowError>

The package-config layer that adds every declared build requirement the recipe does not already have, mapped onto modules of the target hierarchy, and the full mapping for the record.

recipe is the bumped recipe, so its dependencies are the ones the new release will be built with.

fn declared_build(bytes: &[u8]) -> Option<DeclaredBuild>

The build system declared by the top-level pyproject.toml of a source archive, or None when the archive has none or it does not parse.

fn declared_build_in(files: &[(String, Vec<u8>)]) -> Option<DeclaredBuild>

As declared_build, over files already read out of an archive.

fn installs_one_python_project(recipe: &crate::eb_parse::ResolvedEasyconfig) -> bool

Whether this recipe installs one Python project from its sources with pip, so that project’s pyproject.toml decides what the build needs. A bundle’s backends belong to its extensions, not to the bundle source.

fn map_build_requirements(declared: &DeclaredBuild, recipe_dependencies: &[&Candidate], admitted: &[Candidate]) -> Vec<BuildRequirement>

Map each declared requirement onto the recipe’s dependencies or onto a module in admitted (the robot candidates of the target hierarchy).

recipe_dependencies are the candidates the recipe already depends on; their own name and every extension they bundle count as provided, which is how setuptools and wheel are answered by the Python module. A requirement nothing provides and no module is named after comes back with neither field set.

fn unmapped_residuals(mapped: &[BuildRequirement]) -> Vec<crate::package::Residual>

Residuals for requirements nothing in the target hierarchy answers.

Structs and Unions

struct BuildRequirement

A build requirement and what answers it.

requirement: String

The project the source names, or Rust for a locked crate graph.

module: Option<String>

The module to add as a build dependency, or None when one of the recipe’s dependencies already provides it.

provided_by: Option<String>

Which dependency provides it when no module is added.

struct DeclaredBuild

What a source archive declares about how it is built.

backend: Option<String>

[build-system] build-backend, when stated.

requires: Vec<String>

Project names from [build-system] requires, version specifiers stripped.

cargo_lock: bool

Whether the source carries a Cargo.lock outside vendored code.

Implementations

impl DeclaredBuild

Functions

fn builds_rust_crate(&self) -> bool

Whether the project builds a Rust extension with a locked crate graph.