treewide: format = "pyproject" -> pyproject = true

It's important to get the default in our PDM module fixed,
because upstream documentation recommends using pyproject = true;
and ships an assertion assertion '((pyproject != null) -> (format ==
null))' that fails with the current default in pdm.
This commit is contained in:
phaer 2024-06-26 20:01:15 +02:00
parent 26097d341a
commit 97d181ccd8
9 changed files with 23 additions and 24 deletions

View File

@ -6,7 +6,7 @@
}: let
pyproject = lib.importTOML ./subpkg1/pyproject.toml;
buildWithSetuptools = {
buildPythonPackage.format = "pyproject";
buildPythonPackage.pyproject = true;
mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools];
};
in {

View File

@ -9,10 +9,6 @@
dream2nix.modules.dream2nix.WIP-python-pdm
];
deps = {nixpkgs, ...}: {
python = nixpkgs.python3;
};
mkDerivation = {
src = lib.cleanSourceWith {
src = lib.cleanSource ./.;
@ -28,7 +24,6 @@
pdm.pyproject = ./pyproject.toml;
buildPythonPackage = {
format = lib.mkForce "pyproject";
pythonImportsCheck = [
"mytool"
];

View File

@ -30,7 +30,7 @@ in {
};
buildPythonPackage = {
format = lib.mkForce "pyproject";
pyproject = true;
pythonImportsCheck = [
"mytool"
];

View File

@ -105,7 +105,7 @@ in {
};
};
buildPythonPackage = {
format = lib.mkDefault "pyproject";
pyproject = lib.mkDefault true;
};
mkDerivation = {
buildInputs = map (name: config.deps.python.pkgs.${name}) buildSystemNames;
@ -187,13 +187,14 @@ in {
inherit name;
version = lib.mkDefault pkg.version;
sourceSelector = lib.mkOptionDefault config.pdm.sourceSelector;
buildPythonPackage = {
format = lib.mkDefault (
if lib.hasSuffix ".whl" source.file
then "wheel"
else "pyproject"
);
};
buildPythonPackage =
if lib.hasSuffix ".whl" source.file
then {
format = lib.mkDefault "wheel";
}
else {
pyproject = lib.mkDefault true;
};
mkDerivation = {
# TODO: handle sources outside pypi.org
src = lib.mkDefault (libpyproject-fetchers.fetchFromLegacy {

View File

@ -19,7 +19,7 @@ in {
};
buildPythonPackage = {
format = "pyproject";
pyproject = true;
};
name = pyproject.project.name;

View File

@ -56,11 +56,14 @@
# deps.python cannot be defined in commonModule as this would trigger an
# infinite recursion.
deps = {inherit python;};
buildPythonPackage.format = l.mkDefault (
if l.hasSuffix ".whl" cfg.mkDerivation.src
then "wheel"
else "pyproject"
);
buildPythonPackage =
if lib.hasSuffix ".whl" cfg.mkDerivation.src
then {
format = lib.mkDefault "wheel";
}
else {
pyproject = lib.mkDefault true;
};
mkDerivation.buildInputs =
lib.optionals
(! lib.hasSuffix ".whl" cfg.mkDerivation.src)

View File

@ -25,7 +25,7 @@ in {
};
buildPythonPackage = {
format = lib.mkForce "pyproject";
pyproject = true;
pythonImportsCheck = [
"my_tool"
];

View File

@ -25,7 +25,7 @@ in {
};
buildPythonPackage = {
format = lib.mkForce "pyproject";
pyproject = true;
pythonImportsCheck = [
"my_tool"
];

View File

@ -7,7 +7,7 @@
}: let
package = python3.pkgs.buildPythonPackage {
name = "fetch-pip-metadata";
format = "pyproject";
pyproject = true;
src = ./src;
nativeBuildInputs = [
gitMinimal