mk-python-derivation: Add build-system argument
Much like the previous commit that adds dependencies & optional-dependencies this aligns PEP-517 build systems with how they are defined in PEP-518/PEP-621. The naming `build-system` (singular) is aligned with upstream Python standards.
This commit is contained in:
parent
b9138b7c07
commit
4d0cca4654
@ -116,7 +116,7 @@ buildPythonPackage rec {
|
|||||||
rm testing/test_argcomplete.py
|
rm testing/test_argcomplete.py
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
setuptools-scm
|
setuptools-scm
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ following are specific to `buildPythonPackage`:
|
|||||||
variable in wrapped programs.
|
variable in wrapped programs.
|
||||||
* `pyproject`: Whether the pyproject format should be used. When set to `true`,
|
* `pyproject`: Whether the pyproject format should be used. When set to `true`,
|
||||||
`pypaBuildHook` will be used, and you can add the required build dependencies
|
`pypaBuildHook` will be used, and you can add the required build dependencies
|
||||||
from `build-system.requires` to `nativeBuildInputs`. Note that the pyproject
|
from `build-system.requires` to `build-system`. Note that the pyproject
|
||||||
format falls back to using `setuptools`, so you can use `pyproject = true`
|
format falls back to using `setuptools`, so you can use `pyproject = true`
|
||||||
even if the package only has a `setup.py`. When set to `false`, you can
|
even if the package only has a `setup.py`. When set to `false`, you can
|
||||||
use the existing [hooks](#setup-hooks0 or provide your own logic to build the
|
use the existing [hooks](#setup-hooks0 or provide your own logic to build the
|
||||||
@ -206,8 +206,8 @@ build inputs (see "Specifying dependencies"). The following are of special
|
|||||||
interest for Python packages, either because these are primarily used, or
|
interest for Python packages, either because these are primarily used, or
|
||||||
because their behaviour is different:
|
because their behaviour is different:
|
||||||
|
|
||||||
* `nativeBuildInputs ? []`: Build-time only dependencies. Typically executables
|
* `nativeBuildInputs ? []`: Build-time only dependencies. Typically executables.
|
||||||
as well as the items listed in `setup_requires`.
|
* `build-system ? []`: Build-time only Python dependencies. Items listed in `build-system.requires`/`setup_requires`.
|
||||||
* `buildInputs ? []`: Build and/or run-time dependencies that need to be
|
* `buildInputs ? []`: Build and/or run-time dependencies that need to be
|
||||||
compiled for the host machine. Typically non-Python libraries which are being
|
compiled for the host machine. Typically non-Python libraries which are being
|
||||||
linked.
|
linked.
|
||||||
@ -304,13 +304,14 @@ python3Packages.buildPythonApplication rec {
|
|||||||
hash = "sha256-Pe229rT0aHwA98s+nTHQMEFKZPo/yw6sot8MivFDvAw=";
|
hash = "sha256-Pe229rT0aHwA98s+nTHQMEFKZPo/yw6sot8MivFDvAw=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = with python3Packages; [
|
build-system = with python3Packages; [
|
||||||
setuptools
|
setuptools
|
||||||
|
wheel
|
||||||
];
|
];
|
||||||
|
|
||||||
dependencies = [
|
dependencies = with python3Packages; [
|
||||||
python3Packages.tornado
|
tornado
|
||||||
python3Packages.python-daemon
|
python-daemon
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
@ -467,11 +468,11 @@ are used in [`buildPythonPackage`](#buildpythonpackage-function).
|
|||||||
- `eggBuildHook` to skip building for eggs.
|
- `eggBuildHook` to skip building for eggs.
|
||||||
- `eggInstallHook` to install eggs.
|
- `eggInstallHook` to install eggs.
|
||||||
- `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system
|
- `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system
|
||||||
(e.g. `setuptools` or `flit`) should still be added as `nativeBuildInput`.
|
(e.g. `setuptools` or `flit`) should still be added as `build-system`.
|
||||||
- `pypaBuildHook` to build a wheel using
|
- `pypaBuildHook` to build a wheel using
|
||||||
[`pypa/build`](https://pypa-build.readthedocs.io/en/latest/index.html) and
|
[`pypa/build`](https://pypa-build.readthedocs.io/en/latest/index.html) and
|
||||||
PEP 517/518. Note a build system (e.g. `setuptools` or `flit`) should still
|
PEP 517/518. Note a build system (e.g. `setuptools` or `flit`) should still
|
||||||
be added as `nativeBuildInput`.
|
be added as `build-system`.
|
||||||
- `pipInstallHook` to install wheels.
|
- `pipInstallHook` to install wheels.
|
||||||
- `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook).
|
- `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook).
|
||||||
- `pythonCatchConflictsHook` to check whether a Python package is not already existing.
|
- `pythonCatchConflictsHook` to check whether a Python package is not already existing.
|
||||||
@ -886,7 +887,7 @@ buildPythonPackage rec {
|
|||||||
hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA=";
|
hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
@ -946,7 +947,7 @@ with import <nixpkgs> {};
|
|||||||
hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA=";
|
hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
python311.pkgs.setuptools
|
python311.pkgs.setuptools
|
||||||
python311.pkgs.wheel
|
python311.pkgs.wheel
|
||||||
];
|
];
|
||||||
@ -1020,7 +1021,7 @@ buildPythonPackage rec {
|
|||||||
hash = "sha256-FLLvdm1MllKrgTGC6Gb0k0deZeVYvtCCLji/B7uhong=";
|
hash = "sha256-FLLvdm1MllKrgTGC6Gb0k0deZeVYvtCCLji/B7uhong=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
@ -1075,7 +1076,7 @@ buildPythonPackage rec {
|
|||||||
hash = "sha256-s9NiusRxFydHzaNRMjjxFcvWxfi45jGb9ql6eJJyQJk=";
|
hash = "sha256-s9NiusRxFydHzaNRMjjxFcvWxfi45jGb9ql6eJJyQJk=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
@ -1132,7 +1133,7 @@ buildPythonPackage rec {
|
|||||||
hash = "sha256-9ru2r6kwhUCaskiFoaPNuJCfCVoUL01J40byvRt4kHQ=";
|
hash = "sha256-9ru2r6kwhUCaskiFoaPNuJCfCVoUL01J40byvRt4kHQ=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
@ -1526,7 +1527,7 @@ buildPythonPackage rec {
|
|||||||
hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA=";
|
hash = "sha256-CP3V73yWSArRHBLUct4hrNMjWZlvaaUlkpm1QP66RWA=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
build-system = [
|
||||||
setuptools
|
setuptools
|
||||||
wheel
|
wheel
|
||||||
];
|
];
|
||||||
|
@ -50,6 +50,9 @@
|
|||||||
, dependencies ? []
|
, dependencies ? []
|
||||||
, optional-dependencies ? {}
|
, optional-dependencies ? {}
|
||||||
|
|
||||||
|
# Python PEP-517 build systems.
|
||||||
|
, build-system ? []
|
||||||
|
|
||||||
# DEPRECATED: use propagatedBuildInputs
|
# DEPRECATED: use propagatedBuildInputs
|
||||||
, pythonPath ? []
|
, pythonPath ? []
|
||||||
|
|
||||||
@ -208,13 +211,16 @@ let
|
|||||||
}
|
}
|
||||||
// lib.optionalAttrs (optional-dependencies != {}) {
|
// lib.optionalAttrs (optional-dependencies != {}) {
|
||||||
inherit optional-dependencies;
|
inherit optional-dependencies;
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (build-system != []) {
|
||||||
|
inherit build-system;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
# Keep extra attributes from `attrs`, e.g., `patchPhase', etc.
|
||||||
self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [
|
self = toPythonModule (stdenv.mkDerivation ((builtins.removeAttrs attrs [
|
||||||
"disabled" "checkPhase" "checkInputs" "nativeCheckInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "pyproject" "format"
|
"disabled" "checkPhase" "checkInputs" "nativeCheckInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts" "pyproject" "format"
|
||||||
"disabledTestPaths" "outputs" "stdenv"
|
"disabledTestPaths" "outputs" "stdenv"
|
||||||
"dependencies" "optional-dependencies"
|
"dependencies" "optional-dependencies" "build-system"
|
||||||
]) // {
|
]) // {
|
||||||
|
|
||||||
name = namePrefix + name_;
|
name = namePrefix + name_;
|
||||||
@ -274,7 +280,7 @@ let
|
|||||||
pythonNamespacesHook
|
pythonNamespacesHook
|
||||||
] ++ lib.optionals withDistOutput [
|
] ++ lib.optionals withDistOutput [
|
||||||
pythonOutputDistHook
|
pythonOutputDistHook
|
||||||
] ++ nativeBuildInputs;
|
] ++ nativeBuildInputs ++ build-system;
|
||||||
|
|
||||||
buildInputs = validatePythonMatches "buildInputs" (buildInputs ++ pythonPath);
|
buildInputs = validatePythonMatches "buildInputs" (buildInputs ++ pythonPath);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user