Merge pull request #663 from trepetti/build-systems-jsonschema

build-systems: optional build system objects with version information
This commit is contained in:
adisbladis 2022-06-17 04:47:34 +08:00 committed by GitHub
commit 8e53a7d0d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 3 deletions

View file

@ -591,6 +591,9 @@
"json-schema-for-humans": [
"poetry-core"
],
"jsonschema": [
{ "buildSystem": "hatchling", "from": "4.6.0" }
],
"jupyter-server": [
"jupyter-packaging"
],
@ -1690,7 +1693,8 @@
"pbr"
],
"traitlets": [
"flit-core"
{ "buildSystem": "flit-core", "until": "5.2.1" },
{ "buildSystem": "hatchling", "from": "5.2.1" }
],
"transmission-rpc": [
"poetry-core"

View file

@ -11,7 +11,28 @@ let
, extraAttrs ? [ ]
}:
let
buildSystem = if attr == "cython" then self.python.pythonForBuild.pkgs.cython else self.${attr};
buildSystem =
if builtins.isAttrs attr then
let
fromIsValid =
if builtins.hasAttr "from" attr then
lib.versionAtLeast drv.version attr.from
else
true;
untilIsValid =
if builtins.hasAttr "until" attr then
lib.versionOlder drv.version attr.until
else
true;
intendedBuildSystem =
if attr.buildSystem == "cython" then
self.python.pythonForBuild.cython
else
self.${attr.buildSystem};
in
if fromIsValid && untilIsValid then intendedBuildSystem else null
else
if attr == "cython" then self.python.pythonForBuild.pkgs.cython else self.${attr};
in
(
# Flit only works on Python3
@ -24,7 +45,10 @@ let
{ }
else
{
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.${attr} ] ++ map (a: self.${a}) extraAttrs;
nativeBuildInputs =
(old.nativeBuildInputs or [ ])
++ lib.optionals (!(builtins.isNull buildSystem)) [ buildSystem ]
++ map (a: self.${a}) extraAttrs;
}
)
);