pythonPackages: use mkPythonDerivation

wip/yesman
Frederik Rietdijk 8 years ago
parent e9c4d00cac
commit 4f6b6f1472
  1. 1
      doc/languages-frameworks/python.md
  2. 8
      pkgs/development/interpreters/python/mk-python-derivation.nix
  3. 16
      pkgs/development/python-modules/dbus/default.nix
  4. 8
      pkgs/development/python-modules/pycairo/default.nix
  5. 10
      pkgs/development/python-modules/pygobject/3.nix
  6. 8
      pkgs/development/python-modules/pygobject/default.nix
  7. 6
      pkgs/development/python-modules/pygtksourceview/default.nix
  8. 15
      pkgs/development/python-modules/pyqt/4.x.nix
  9. 14
      pkgs/development/python-modules/pyqt/5.x.nix
  10. 2
      pkgs/development/python-modules/pyside/default.nix
  11. 13
      pkgs/development/python-modules/pyxml/default.nix
  12. 10
      pkgs/development/python-modules/sip/default.nix
  13. 10
      pkgs/top-level/python-packages.nix

@ -536,6 +536,7 @@ All parameters from `mkDerivation` function are still supported.
* `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'"].
* `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`.
* `catchConflicts` If `true`, abort package build if a package name appears more than once in dependency tree. Default is `true`.
* `checkInputs` Dependencies needed for running the `checkPhase`. These are added to `buildInputs` when `doCheck = true`.
#### `buildPythonApplication` function

@ -13,8 +13,13 @@
# by default prefix `name` e.g. "python3.3-${name}"
, namePrefix ? python.libPrefix + "-"
# Dependencies for building the package
, buildInputs ? []
# Dependencies needed for running the checkPhase.
# These are added to buildInputs when doCheck = true.
, checkInputs ? []
# propagate build dependencies so in case we have A -> B -> C,
# C can import package A propagated by B
, propagatedBuildInputs ? []
@ -52,7 +57,8 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled"] // {
buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath
++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip);
++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
++ lib.optionals attrs.doCheck checkInputs;
# propagate python/setuptools to active setup-hook in nix-shell
propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];

@ -1,7 +1,7 @@
{ stdenv, fetchurl, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy
{ lib, fetchurl, mkPythonDerivation, python, pkgconfig, dbus, dbus_glib, dbus_tools, isPyPy
, ncurses, pygobject3 }:
if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
if isPyPy then throw "dbus-python not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
name = "dbus-python-1.2.4";
src = fetchurl {
@ -11,21 +11,17 @@ if isPyPy then throw "dbus-python not supported for interpreter ${python.executa
postPatch = "patchShebangs .";
buildInputs = [ python pkgconfig dbus dbus_glib ]
++ stdenv.lib.optionals doCheck [ dbus_tools pygobject3 ]
buildInputs = [ pkgconfig dbus dbus_glib ]
++ lib.optionals doCheck [ dbus_tools pygobject3 ]
# My guess why it's sometimes trying to -lncurses.
# It seems not to retain the dependency anyway.
++ stdenv.lib.optional (! python ? modules) ncurses;
++ lib.optional (! python ? modules) ncurses;
doCheck = true;
# Set empty pythonPath, so that the package is recognized as a python package
# for python.buildEnv
pythonPath = [];
meta = {
description = "Python DBus bindings";
license = stdenv.lib.licenses.mit;
license = lib.licenses.mit;
platforms = dbus.meta.platforms;
};
}

@ -1,6 +1,6 @@
{ stdenv, fetchurl, fetchpatch, python, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35 }:
{ lib, fetchurl, fetchpatch, python, mkPythonDerivation, pkgconfig, cairo, xlibsWrapper, isPyPy, isPy35 }:
if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
if (isPyPy) then throw "pycairo not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
version = "1.10.0";
name = "${python.libPrefix}-pycairo-${version}";
src = if python.is_py3k or false
@ -32,7 +32,7 @@ if (isPyPy) then throw "pycairo not supported for interpreter ${python.executabl
cd $(${python.executable} waf unpack)
pwd
patch -p1 < ${patch_waf}
${stdenv.lib.optionalString isPy35 "patch -p1 < ${patch_waf-py3_5}"}
${lib.optionalString isPy35 "patch -p1 < ${patch_waf-py3_5}"}
)
${python.executable} waf configure --prefix=$out
@ -40,5 +40,5 @@ if (isPyPy) then throw "pycairo not supported for interpreter ${python.executabl
buildPhase = "${python.executable} waf";
installPhase = "${python.executable} waf install";
meta.platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
meta.platforms = lib.platforms.linux ++ lib.platforms.darwin;
}

@ -1,6 +1,6 @@
{ stdenv, fetchurl, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo }:
{ lib, fetchurl, mkPythonDerivation, python, pkgconfig, glib, gobjectIntrospection, pycairo, cairo }:
stdenv.mkDerivation rec {
mkPythonDerivation rec {
major = "3.20";
minor = "0";
name = "pygobject-${major}.${minor}";
@ -10,14 +10,12 @@ stdenv.mkDerivation rec {
sha256 = "0ikzh3l7g1gjh8jj8vg6mdvrb25svp63gxcam4m0i404yh0lgari";
};
buildInputs = [ python pkgconfig glib gobjectIntrospection ];
buildInputs = [ pkgconfig glib gobjectIntrospection ];
propagatedBuildInputs = [ pycairo cairo ];
passthru.pythonPath = [];
meta = {
homepage = http://live.gnome.org/PyGObject;
description = "Python bindings for Glib";
platforms = stdenv.lib.platforms.unix;
platforms = lib.platforms.unix;
};
}

@ -1,6 +1,6 @@
{ stdenv, fetchurl, python, pkgconfig, glib }:
{ stdenv, fetchurl, python, mkPythonDerivation, pkgconfig, glib }:
stdenv.mkDerivation rec {
mkPythonDerivation rec {
name = "pygobject-2.28.6";
src = fetchurl {
@ -18,9 +18,7 @@ stdenv.mkDerivation rec {
configureFlags = "--disable-introspection";
buildInputs = [ python pkgconfig glib ];
passthru.pythonPath = [];
buildInputs = [ pkgconfig glib ];
# in a "normal" setup, pygobject and pygtk are installed into the
# same site-packages: we need a pth file for both. pygtk.py would be

@ -1,8 +1,8 @@
{ stdenv, fetchurl, python, pkgconfig, pygobject, glib, pygtk, gnome2 }:
{ lib, fetchurl, python, mkPythonDerivation, pkgconfig, pygobject, glib, pygtk, gnome2 }:
let version = "2.10.1"; in
stdenv.mkDerivation {
mkPythonDerivation {
name = "pygtksourceview-${version}";
src = fetchurl {
@ -15,6 +15,6 @@ stdenv.mkDerivation {
buildInputs = [ python pkgconfig pygobject glib pygtk gnome2.gtksourceview ];
meta = {
platforms = stdenv.lib.platforms.unix;
platforms = lib.platforms.unix;
};
}

@ -1,10 +1,10 @@
{ stdenv, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }:
{ lib, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }:
let
version = "4.11.3";
inherit (pythonPackages) python dbus-python sip;
in stdenv.mkDerivation {
name = "${python.libPrefix}-PyQt-x11-gpl-${version}";
inherit (pythonPackages) mkPythonDerivation python dbus-python sip;
in mkPythonDerivation {
name = "$PyQt-x11-gpl-${version}";
src = fetchurl {
url = "mirror://sourceforge/pyqt/PyQt4/PyQt-${version}/PyQt-x11-gpl-${version}.tar.gz";
@ -31,7 +31,7 @@ in stdenv.mkDerivation {
buildInputs = [ pkgconfig makeWrapper qt4 lndir dbus_libs ];
propagatedBuildInputs = [ sip python ];
propagatedBuildInputs = [ sip ];
postInstall = ''
for i in $out/bin/*; do
@ -42,7 +42,6 @@ in stdenv.mkDerivation {
enableParallelBuilding = true;
passthru = {
pythonPath = [];
qt = qt4;
};
@ -50,7 +49,7 @@ in stdenv.mkDerivation {
description = "Python bindings for Qt";
license = "GPL";
homepage = http://www.riverbankcomputing.co.uk;
maintainers = [ stdenv.lib.maintainers.sander ];
platforms = stdenv.lib.platforms.mesaPlatforms;
maintainers = [ lib.maintainers.sander ];
platforms = lib.platforms.mesaPlatforms;
};
}

@ -1,13 +1,13 @@
{ stdenv, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs
{ lib, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs
, lndir, makeWrapper, qmakeHook }:
let
version = "5.6";
inherit (pythonPackages) python dbus-python sip;
in stdenv.mkDerivation {
name = "${python.libPrefix}-PyQt-${version}";
inherit (pythonPackages) mkPythonDerivation python dbus-python sip;
in mkPythonDerivation {
name = "PyQt-${version}";
meta = with stdenv.lib; {
meta = with lib; {
description = "Python bindings for Qt5";
homepage = http://www.riverbankcomputing.co.uk;
license = licenses.gpl3;
@ -25,7 +25,7 @@ in stdenv.mkDerivation {
qtbase qtsvg qtwebkit dbus_libs qmakeHook
];
propagatedBuildInputs = [ sip python ];
propagatedBuildInputs = [ sip ];
configurePhase = ''
runHook preConfigure
@ -60,6 +60,4 @@ in stdenv.mkDerivation {
'';
enableParallelBuilding = true;
passthru.pythonPath = [];
}

@ -1,6 +1,6 @@
{ stdenv, fetchurl, cmake, python, pysideGeneratorrunner, pysideShiboken, qt4 }:
stdenv.mkDerivation rec {
stdenv.mkPythonDerivation rec {
name = "${python.libPrefix}-pyside-${version}";
version = "1.2.4";

@ -1,22 +1,21 @@
{stdenv, fetchurl, python, makeWrapper}:
{lib, fetchurl, python, mkPythonDerivation, makeWrapper}:
stdenv.mkDerivation rec {
mkPythonDerivation rec {
name = "PyXML-0.8.4";
src = fetchurl {
url = "mirror://sourceforge/pyxml/${name}.tar.gz";
sha256 = "04wc8i7cdkibhrldy6j65qp5l75zjxf5lx6qxdxfdf2gb3wndawz";
};
buildInputs = [python makeWrapper];
buildPhase = "python ./setup.py build";
buildInputs = [ makeWrapper ];
buildPhase = "${python.interpreter} ./setup.py build";
installPhase = ''
python ./setup.py install --prefix="$out" || exit 1
${python.interpreter} ./setup.py install --prefix="$out" || exit 1
for i in "$out/bin/"*
do
# FIXME: We're assuming Python 2.4.
wrapProgram "$i" --prefix PYTHONPATH : \
"$out/lib/python2.4/site-packages" || \
"$out/${python.sitePackages}" || \
exit 2
done
'';

@ -1,6 +1,6 @@
{ stdenv, fetchurl, python, isPyPy }:
{ lib, fetchurl, mkPythonDerivation, python, isPyPy }:
if isPyPy then throw "sip not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
if isPyPy then throw "sip not supported for interpreter ${python.executable}" else mkPythonDerivation rec {
name = "sip-4.18.1";
src = fetchurl {
@ -14,11 +14,7 @@ if isPyPy then throw "sip not supported for interpreter ${python.executable}" el
-b $out/bin -e $out/include
'';
buildInputs = [ python ];
passthru.pythonPath = [];
meta = with stdenv.lib; {
meta = with lib; {
description = "Creates C++ bindings for Python modules";
homepage = "http://www.riverbankcomputing.co.uk/";
license = licenses.gpl2Plus;

@ -20192,7 +20192,7 @@ in modules // {
});
pysvn = pkgs.stdenv.mkDerivation rec {
pysvn = mkPythonDerivation rec {
name = "pysvn-1.8.0";
src = pkgs.fetchurl {
@ -20200,7 +20200,7 @@ in modules // {
sha256 = "0srjr2qgxfs69p65d9vvdib2lc142x10w8afbbdrqs7dhi46yn9r";
};
buildInputs = with self; [ python pkgs.subversion pkgs.apr pkgs.aprutil pkgs.expat pkgs.neon pkgs.openssl ]
buildInputs = with self; [ pkgs.subversion pkgs.apr pkgs.aprutil pkgs.expat pkgs.neon pkgs.openssl ]
++ (if stdenv.isLinux then [pkgs.e2fsprogs] else []);
# There seems to be no way to pass that path to configure.
@ -20346,7 +20346,7 @@ in modules // {
});
pywebkitgtk = stdenv.mkDerivation rec {
pywebkitgtk = mkPythonDerivation rec {
name = "pywebkitgtk-${version}";
version = "1.1.8";
@ -20677,14 +20677,14 @@ in modules // {
qscintilla = if isPy3k || isPyPy
then throw "qscintilla-${pkgs.qscintilla.version} not supported for interpreter ${python.executable}"
else pkgs.stdenv.mkDerivation rec {
else mkPythonDerivation rec {
# TODO: Qt5 support
name = "qscintilla-${version}";
version = pkgs.qscintilla.version;
src = pkgs.qscintilla.src;
buildInputs = with self; [ pkgs.xorg.lndir pyqt4.qt pyqt4 python ];
buildInputs = with self; [ pkgs.xorg.lndir pyqt4.qt pyqt4 ];
preConfigure = ''
mkdir -p $out

Loading…
Cancel
Save