diff options
author | Frederik Rietdijk <fridh@fridh.nl> | 2018-11-24 12:56:24 +0100 |
---|---|---|
committer | Frederik Rietdijk <freddyrietdijk@fridh.nl> | 2018-12-07 15:48:54 +0100 |
commit | 74d0b82f29cbc82e2a35e5a684a947f067851f70 (patch) | |
tree | f2cc202ca9fc6d18b8f1a0b6bac7ea463a4bb72c /pkgs/development/interpreters/python/mk-python-derivation.nix | |
parent | 82579f80a5e28e2395b0d55ca8385d08dfedc5ea (diff) |
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.
Diffstat (limited to 'pkgs/development/interpreters/python/mk-python-derivation.nix')
-rw-r--r-- | pkgs/development/interpreters/python/mk-python-derivation.nix | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix index 63ffdbb8c0ac4..eb913e1a37527 100644 --- a/pkgs/development/interpreters/python/mk-python-derivation.nix +++ b/pkgs/development/interpreters/python/mk-python-derivation.nix @@ -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 |