buildPython*: add updateScript to passthru
All Python packages now have an updateScript. The script calls `update-python-libraries` and passes it the position of the derivation expression obtained using `meta.position`. This works fine in case a Nix expression represents only a single derivation. If there are more in it, `update-python-libraries` will fail.
This commit is contained in:
committed by
Frederik Rietdijk
parent
82579f80a5
commit
74d0b82f29
@@ -10,6 +10,8 @@
|
||||
# Whether the derivation provides a Python module or not.
|
||||
, toPythonModule
|
||||
, namePrefix
|
||||
, writeScript
|
||||
, update-python-libraries
|
||||
}:
|
||||
|
||||
{ name ? "${attrs.pname}-${attrs.version}"
|
||||
@@ -64,7 +66,7 @@ if disabled
|
||||
then throw "${name} not supported for interpreter ${python.executable}"
|
||||
else
|
||||
|
||||
toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
|
||||
let self = toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
|
||||
"disabled" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts"
|
||||
] // {
|
||||
|
||||
@@ -106,4 +108,14 @@ toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
|
||||
platforms = python.meta.platforms;
|
||||
isBuildPythonPackage = python.meta.platforms;
|
||||
} // meta;
|
||||
}))
|
||||
}));
|
||||
|
||||
passthru = {
|
||||
updateScript = let
|
||||
filename = builtins.head (lib.splitString ":" self.meta.position);
|
||||
in writeScript "update-python" ''
|
||||
#!${python.stdenv.shell}
|
||||
${update-python-libraries} ${filename}
|
||||
'';
|
||||
};
|
||||
in lib.extendDerivation true passthru self
|
||||
|
||||
Reference in New Issue
Block a user