buildPython*: throw on empty format

This is the ratchet that disallows introducing new python packages that
do not define a package format.
This commit is contained in:
Martin Weinelt 2025-07-02 04:19:06 +02:00
parent ae4a1a485a
commit d2e9be2b07
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
2 changed files with 8 additions and 3 deletions

View File

@ -61,6 +61,10 @@
- `reaction` has been updated to version 2, which includes some breaking changes.
For more information, [check the release article](https://blog.ppom.me/en-reaction-v2).
- The `buildPythonPackage` and `buildPythonApplication` functions now require
an explicit `format` attribute. Previously the default format used setuptools
and called `setup.py` from the source tree, which is deprecated.
The modern alternative is to configure `pyproject = true` with `build-system = [ setuptools ]`.
### Deprecations {#sec-nixpkgs-release-25.11-lib-deprecations}

View File

@ -211,7 +211,7 @@ let
else if format != null then
format
else
"setuptools";
throw "${name} does not configure a `format`. To build with setuptools as before, set `pyproject = true` and `build-system = [ setuptools ]`.`";
withDistOutput = withDistOutput' format';
@ -268,11 +268,12 @@ let
isSetuptoolsDependency = isSetuptoolsDependency' (attrs.pname or null);
name = namePrefix + attrs.name or "${finalAttrs.pname}-${finalAttrs.version}";
in
(cleanAttrs attrs)
// {
name = namePrefix + attrs.name or "${finalAttrs.pname}-${finalAttrs.version}";
inherit name;
inherit catchConflicts;