about summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/mk-python-derivation.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2017-05-28 09:20:47 +0200
committerFrederik Rietdijk <fridh@fridh.nl>2017-11-23 15:11:02 +0100
commit40851a4d26daabf1613c9a79e638aaf9f94b476c (patch)
treedcc1ea11ed1207e4e3de91e8a4bd7eb929c57c50 /pkgs/development/interpreters/python/mk-python-derivation.nix
parenta30fa6d9a255288a4f8a1ca77a058bf650ed75ee (diff)
Python: the pythonModule attribute
Python libraries or modules now have an attribute `pythonModule = interpreter;` to indicate
they provide Python modules for the specified `interpreter`.

The package set provides the following helper functions:

- hasPythonModule: Check whether a derivation provides a Python module.
- requiredPythonModules: Recurse into a list of Python modules, returning all Python modules that are required.
- makePythonPath: Create a PYTHONPATH from a list of Python modules.

Also included in this commit is:
- disabledIf: Helper function for disabling non-buildPythonPackage functions.
Diffstat (limited to 'pkgs/development/interpreters/python/mk-python-derivation.nix')
-rw-r--r--pkgs/development/interpreters/python/mk-python-derivation.nix9
1 files changed, 5 insertions, 4 deletions
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix
index 098ab0b1719f8..386875a0ab4ff 100644
--- a/pkgs/development/interpreters/python/mk-python-derivation.nix
+++ b/pkgs/development/interpreters/python/mk-python-derivation.nix
@@ -6,13 +6,13 @@
 , setuptools
 , unzip
 , ensureNewerSourcesHook
+# Whether the derivation provides a Python module or not.
+, pythonModule
+, namePrefix
 }:
 
 { name ? "${attrs.pname}-${attrs.version}"
 
-# by default prefix `name` e.g. "python3.3-${name}"
-, namePrefix ? python.libPrefix + "-"
-
 # Dependencies for building the package
 , buildInputs ? []
 
@@ -54,7 +54,7 @@ if disabled
 then throw "${name} not supported for interpreter ${python.executable}"
 else
 
-python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"] // {
+python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs" "pythonModule"] // {
 
   name = namePrefix + name;
 
@@ -83,6 +83,7 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"
 
   passthru = {
     inherit python; # The python interpreter
+    inherit pythonModule;
   } // passthru;
 
   meta = with lib.maintainers; {