pythonPackages: use mkPythonDerivation

Changed files
+56 -65
doc
languages-frameworks
pkgs
development
interpreters
python-modules
dbus
pycairo
pygobject
pygtksourceview
pyqt
pyside
pyxml
sip
top-level
+1
doc/languages-frameworks/python.md
··· 536 536 * `installFlags`: A list of strings. Arguments to be passed to `pip install`. To pass options to `python setup.py install`, use `--install-option`. E.g., `installFlags=["--install-option='--cpp_implementation'"]. 537 537 * `format`: Format of the source. Options are `setup` for when the source has a `setup.py` and `setuptools` is used to build a wheel, and `wheel` in case the source is already a binary wheel. The default value is `setup`. 538 538 * `catchConflicts` If `true`, abort package build if a package name appears more than once in dependency tree. Default is `true`. 539 + * `checkInputs` Dependencies needed for running the `checkPhase`. These are added to `buildInputs` when `doCheck = true`. 539 540 540 541 #### `buildPythonApplication` function 541 542
+7 -1
pkgs/development/interpreters/python/mk-python-derivation.nix
··· 13 13 # by default prefix `name` e.g. "python3.3-${name}" 14 14 , namePrefix ? python.libPrefix + "-" 15 15 16 + # Dependencies for building the package 16 17 , buildInputs ? [] 18 + 19 + # Dependencies needed for running the checkPhase. 20 + # These are added to buildInputs when doCheck = true. 21 + , checkInputs ? [] 17 22 18 23 # propagate build dependencies so in case we have A -> B -> C, 19 24 # C can import package A propagated by B ··· 52 57 53 58 buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath 54 59 ++ [ (ensureNewerSourcesHook { year = "1980"; }) ] 55 - ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip); 60 + ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip) 61 + ++ lib.optionals attrs.doCheck checkInputs; 56 62 57 63 # propagate python/setuptools to active setup-hook in nix-shell 58 64 propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];
+6 -10
pkgs/development/python-modules/dbus/default.nix
··· 1 - { stdenv, fetchurl, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy 1 + { lib, fetchurl, mkPythonDerivation, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy 2 2 , ncurses, pygobject3 }: 3 3 4 - if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec { 4 + if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else mkPythonDerivation rec { 5 5 name = "dbus-python-1.2.4"; 6 6 7 7 src = fetchurl { ··· 11 11 12 12 postPatch = "patchShebangs ."; 13 13 14 - buildInputs = [ python pkgconfig dbus dbus_glib ] 15 - ++ stdenv.lib.optionals doCheck [ dbus_tools pygobject3 ] 14 + buildInputs = [ pkgconfig dbus dbus_glib ] 15 + ++ lib.optionals doCheck [ dbus_tools pygobject3 ] 16 16 # My guess why it's sometimes trying to -lncurses. 17 17 # It seems not to retain the dependency anyway. 18 - ++ stdenv.lib.optional (! python ? modules) ncurses; 18 + ++ lib.optional (! python ? modules) ncurses; 19 19 20 20 doCheck = true; 21 21 22 - # Set empty pythonPath, so that the package is recognized as a python package 23 - # for python.buildEnv 24 - pythonPath = []; 25 - 26 22 meta = { 27 23 description = "Python DBus bindings"; 28 - license = stdenv.lib.licenses.mit; 24 + license = lib.licenses.mit; 29 25 platforms = dbus.meta.platforms; 30 26 }; 31 27 }
+4 -4
pkgs/development/python-modules/pycairo/default.nix
··· 1 - { stdenv, fetchurl, fetchpatch, python, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35 }: 1 + { lib, fetchurl, fetchpatch, python, mkPythonDerivation, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35 }: 2 2 3 - if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec { 3 + if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else mkPythonDerivation rec { 4 4 version = "1.10.0"; 5 5 name = "${python.libPrefix}-pycairo-${version}"; 6 6 src = if python.is_py3k or false ··· 32 32 cd $(${python.executable} waf unpack) 33 33 pwd 34 34 patch -p1 < ${patch_waf} 35 - ${stdenv.lib.optionalString isPy35 "patch -p1 < ${patch_waf-py3_5}"} 35 + ${lib.optionalString isPy35 "patch -p1 < ${patch_waf-py3_5}"} 36 36 ) 37 37 38 38 ${python.executable} waf configure --prefix=$out ··· 40 40 buildPhase = "${python.executable} waf"; 41 41 installPhase = "${python.executable} waf install"; 42 42 43 - meta.platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin; 43 + meta.platforms = lib.platforms.linux ++ lib.platforms.darwin; 44 44 }
+4 -6
pkgs/development/python-modules/pygobject/3.nix
··· 1 - { stdenv, fetchurl, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo }: 1 + { lib, fetchurl, mkPythonDerivation, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo }: 2 2 3 - stdenv.mkDerivation rec { 3 + mkPythonDerivation rec { 4 4 major = "3.20"; 5 5 minor = "0"; 6 6 name = "pygobject-${major}.${minor}"; ··· 10 10 sha256 = "0ikzh3l7g1gjh8jj8vg6mdvrb25svp63gxcam4m0i404yh0lgari"; 11 11 }; 12 12 13 - buildInputs = [ python pkgconfig glib gobjectIntrospection ]; 13 + buildInputs = [ pkgconfig glib gobjectIntrospection ]; 14 14 propagatedBuildInputs = [ pycairo cairo ]; 15 - 16 - passthru.pythonPath = []; 17 15 18 16 meta = { 19 17 homepage = http://live.gnome.org/PyGObject; 20 18 description = "Python bindings for Glib"; 21 - platforms = stdenv.lib.platforms.unix; 19 + platforms = lib.platforms.unix; 22 20 }; 23 21 }
+3 -5
pkgs/development/python-modules/pygobject/default.nix
··· 1 - { stdenv, fetchurl, python, pkgconfig, glib }: 1 + { stdenv, fetchurl, python, mkPythonDerivation, pkgconfig, glib }: 2 2 3 - stdenv.mkDerivation rec { 3 + mkPythonDerivation rec { 4 4 name = "pygobject-2.28.6"; 5 5 6 6 src = fetchurl { ··· 18 18 19 19 configureFlags = "--disable-introspection"; 20 20 21 - buildInputs = [ python pkgconfig glib ]; 22 - 23 - passthru.pythonPath = []; 21 + buildInputs = [ pkgconfig glib ]; 24 22 25 23 # in a "normal" setup, pygobject and pygtk are installed into the 26 24 # same site-packages: we need a pth file for both. pygtk.py would be
+3 -3
pkgs/development/python-modules/pygtksourceview/default.nix
··· 1 - { stdenv, fetchurl, python, pkgconfig, pygobject, glib, pygtk, gnome2 }: 1 + { lib, fetchurl, python, mkPythonDerivation, pkgconfig, pygobject, glib, pygtk, gnome2 }: 2 2 3 3 let version = "2.10.1"; in 4 4 5 - stdenv.mkDerivation { 5 + mkPythonDerivation { 6 6 name = "pygtksourceview-${version}"; 7 7 8 8 src = fetchurl { ··· 15 15 buildInputs = [ python pkgconfig pygobject glib pygtk gnome2.gtksourceview ]; 16 16 17 17 meta = { 18 - platforms = stdenv.lib.platforms.unix; 18 + platforms = lib.platforms.unix; 19 19 }; 20 20 }
+7 -8
pkgs/development/python-modules/pyqt/4.x.nix
··· 1 - { stdenv, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }: 1 + { lib, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }: 2 2 3 3 let 4 4 version = "4.11.3"; 5 - inherit (pythonPackages) python dbus-python sip; 6 - in stdenv.mkDerivation { 7 - name = "${python.libPrefix}-PyQt-x11-gpl-${version}"; 5 + inherit (pythonPackages) mkPythonDerivation python dbus-python sip; 6 + in mkPythonDerivation { 7 + name = "$PyQt-x11-gpl-${version}"; 8 8 9 9 src = fetchurl { 10 10 url = "mirror://sourceforge/pyqt/PyQt4/PyQt-${version}/PyQt-x11-gpl-${version}.tar.gz"; ··· 31 31 32 32 buildInputs = [ pkgconfig makeWrapper qt4 lndir dbus_libs ]; 33 33 34 - propagatedBuildInputs = [ sip python ]; 34 + propagatedBuildInputs = [ sip ]; 35 35 36 36 postInstall = '' 37 37 for i in $out/bin/*; do ··· 42 42 enableParallelBuilding = true; 43 43 44 44 passthru = { 45 - pythonPath = []; 46 45 qt = qt4; 47 46 }; 48 47 ··· 50 49 description = "Python bindings for Qt"; 51 50 license = "GPL"; 52 51 homepage = http://www.riverbankcomputing.co.uk; 53 - maintainers = [ stdenv.lib.maintainers.sander ]; 54 - platforms = stdenv.lib.platforms.mesaPlatforms; 52 + maintainers = [ lib.maintainers.sander ]; 53 + platforms = lib.platforms.mesaPlatforms; 55 54 }; 56 55 }
+6 -8
pkgs/development/python-modules/pyqt/5.x.nix
··· 1 - { stdenv, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs 1 + { lib, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs 2 2 , lndir, makeWrapper, qmakeHook }: 3 3 4 4 let 5 5 version = "5.6"; 6 - inherit (pythonPackages) python dbus-python sip; 7 - in stdenv.mkDerivation { 8 - name = "${python.libPrefix}-PyQt-${version}"; 6 + inherit (pythonPackages) mkPythonDerivation python dbus-python sip; 7 + in mkPythonDerivation { 8 + name = "PyQt-${version}"; 9 9 10 - meta = with stdenv.lib; { 10 + meta = with lib; { 11 11 description = "Python bindings for Qt5"; 12 12 homepage = http://www.riverbankcomputing.co.uk; 13 13 license = licenses.gpl3; ··· 25 25 qtbase qtsvg qtwebkit dbus_libs qmakeHook 26 26 ]; 27 27 28 - propagatedBuildInputs = [ sip python ]; 28 + propagatedBuildInputs = [ sip ]; 29 29 30 30 configurePhase = '' 31 31 runHook preConfigure ··· 60 60 ''; 61 61 62 62 enableParallelBuilding = true; 63 - 64 - passthru.pythonPath = []; 65 63 }
+1 -1
pkgs/development/python-modules/pyside/default.nix
··· 1 1 { stdenv, fetchurl, cmake, python, pysideGeneratorrunner, pysideShiboken, qt4 }: 2 2 3 - stdenv.mkDerivation rec { 3 + stdenv.mkPythonDerivation rec { 4 4 name = "${python.libPrefix}-pyside-${version}"; 5 5 version = "1.2.4"; 6 6
+6 -7
pkgs/development/python-modules/pyxml/default.nix
··· 1 - {stdenv, fetchurl, python, makeWrapper}: 1 + {lib, fetchurl, python, mkPythonDerivation, makeWrapper}: 2 2 3 - stdenv.mkDerivation rec { 3 + mkPythonDerivation rec { 4 4 name = "PyXML-0.8.4"; 5 5 src = fetchurl { 6 6 url = "mirror://sourceforge/pyxml/${name}.tar.gz"; 7 7 sha256 = "04wc8i7cdkibhrldy6j65qp5l75zjxf5lx6qxdxfdf2gb3wndawz"; 8 8 }; 9 9 10 - buildInputs = [python makeWrapper]; 11 - buildPhase = "python ./setup.py build"; 10 + buildInputs = [ makeWrapper ]; 11 + buildPhase = "${python.interpreter} ./setup.py build"; 12 12 installPhase = '' 13 - python ./setup.py install --prefix="$out" || exit 1 13 + ${python.interpreter} ./setup.py install --prefix="$out" || exit 1 14 14 15 15 for i in "$out/bin/"* 16 16 do 17 - # FIXME: We're assuming Python 2.4. 18 17 wrapProgram "$i" --prefix PYTHONPATH : \ 19 - "$out/lib/python2.4/site-packages" || \ 18 + "$out/${python.sitePackages}" || \ 20 19 exit 2 21 20 done 22 21 '';
+3 -7
pkgs/development/python-modules/sip/default.nix
··· 1 - { stdenv, fetchurl, python, isPyPy }: 1 + { lib, fetchurl, mkPythonDerivation, python, isPyPy }: 2 2 3 - if isPyPy then throw "sip not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec { 3 + if isPyPy then throw "sip not supported for interpreter ${python.executable}" else mkPythonDerivation rec { 4 4 name = "sip-4.18.1"; 5 5 6 6 src = fetchurl { ··· 14 14 -b $out/bin -e $out/include 15 15 ''; 16 16 17 - buildInputs = [ python ]; 18 - 19 - passthru.pythonPath = []; 20 - 21 - meta = with stdenv.lib; { 17 + meta = with lib; { 22 18 description = "Creates C++ bindings for Python modules"; 23 19 homepage = "http://www.riverbankcomputing.co.uk/"; 24 20 license = licenses.gpl2Plus;
+5 -5
pkgs/top-level/python-packages.nix
··· 20192 20192 }); 20193 20193 20194 20194 20195 - pysvn = pkgs.stdenv.mkDerivation rec { 20195 + pysvn = mkPythonDerivation rec { 20196 20196 name = "pysvn-1.8.0"; 20197 20197 20198 20198 src = pkgs.fetchurl { ··· 20200 20200 sha256 = "0srjr2qgxfs69p65d9vvdib2lc142x10w8afbbdrqs7dhi46yn9r"; 20201 20201 }; 20202 20202 20203 - buildInputs = with self; [ python pkgs.subversion pkgs.apr pkgs.aprutil pkgs.expat pkgs.neon pkgs.openssl ] 20203 + buildInputs = with self; [ pkgs.subversion pkgs.apr pkgs.aprutil pkgs.expat pkgs.neon pkgs.openssl ] 20204 20204 ++ (if stdenv.isLinux then [pkgs.e2fsprogs] else []); 20205 20205 20206 20206 # There seems to be no way to pass that path to configure. ··· 20346 20346 }); 20347 20347 20348 20348 20349 - pywebkitgtk = stdenv.mkDerivation rec { 20349 + pywebkitgtk = mkPythonDerivation rec { 20350 20350 name = "pywebkitgtk-${version}"; 20351 20351 version = "1.1.8"; 20352 20352 ··· 20677 20677 20678 20678 qscintilla = if isPy3k || isPyPy 20679 20679 then throw "qscintilla-${pkgs.qscintilla.version} not supported for interpreter ${python.executable}" 20680 - else pkgs.stdenv.mkDerivation rec { 20680 + else mkPythonDerivation rec { 20681 20681 # TODO: Qt5 support 20682 20682 name = "qscintilla-${version}"; 20683 20683 version = pkgs.qscintilla.version; 20684 20684 20685 20685 src = pkgs.qscintilla.src; 20686 20686 20687 - buildInputs = with self; [ pkgs.xorg.lndir pyqt4.qt pyqt4 python ]; 20687 + buildInputs = with self; [ pkgs.xorg.lndir pyqt4.qt pyqt4 ]; 20688 20688 20689 20689 preConfigure = '' 20690 20690 mkdir -p $out