summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/generic/wrap.sh46
-rw-r--r--pkgs/development/python-modules/pyqt/4.x.nix21
-rw-r--r--pkgs/development/python-modules/pyqt/5.x.nix20
-rw-r--r--pkgs/development/python-modules/sip/4.16.nix28
-rw-r--r--pkgs/development/python-modules/sip/default.nix9
5 files changed, 57 insertions, 67 deletions
diff --git a/pkgs/development/python-modules/generic/wrap.sh b/pkgs/development/python-modules/generic/wrap.sh
index efbb1e737876..ca73a473ed56 100644
--- a/pkgs/development/python-modules/generic/wrap.sh
+++ b/pkgs/development/python-modules/generic/wrap.sh
@@ -4,16 +4,12 @@ wrapPythonPrograms() {
     wrapPythonProgramsIn $out "$out $pythonPath"
 }
 
-# Transforms any binaries generated by the setup.py script, replacing them
-# with an executable shell script which will set some environment variables
-# and then call into the original binary (which has been given a .wrapped
-# suffix).
-wrapPythonProgramsIn() {
-    local dir="$1"
-    local pythonPath="$2"
+# Builds environment variables like PYTHONPATH and PATH walking through closure
+# of dependencies.
+buildPythonPath() {
+    local pythonPath="$1"
     local python="@executable@"
     local path
-    local f
 
     # Create an empty table of python paths (see doc on _addToPythonPath
     # for how this is used). Build up the program_PATH and program_PYTHONPATH
@@ -21,9 +17,35 @@ wrapPythonProgramsIn() {
     declare -A pythonPathsSeen=()
     program_PYTHONPATH=
     program_PATH=
+    pythonPathsSeen["@python@"]=1
+    addToSearchPath program_PATH @python@/bin
     for path in $pythonPath; do
         _addToPythonPath $path
     done
+}
+
+# Patches a Python script so that it has correct libraries path and executable
+# name.
+patchPythonScript() {
+    local f="$1"
+
+    # The magicalSedExpression will invoke a "$(basename "$f")", so
+    # if you change $f to something else, be sure to also change it
+    # in pkgs/top-level/python-packages.nix!
+    # It also uses $program_PYTHONPATH.
+    sed -i "$f" -re '@magicalSedExpression@'
+}
+
+# Transforms any binaries generated by the setup.py script, replacing them
+# with an executable shell script which will set some environment variables
+# and then call into the original binary (which has been given a .wrapped
+# suffix).
+wrapPythonProgramsIn() {
+    local dir="$1"
+    local pythonPath="$2"
+    local f
+
+    buildPythonPath "$pythonPath"
 
     # Find all regular files in the output directory that are executable.
     for f in $(find "$dir" -type f -perm -0100); do
@@ -39,16 +61,12 @@ wrapPythonProgramsIn() {
             # dont wrap EGG-INFO scripts since they are called from python
             if echo "$f" | grep -qv EGG-INFO/scripts; then
                 echo "wrapping \`$f'..."
-                # The magicalSedExpression will invoke a "$(basename "$f")", so
-                # if you change $f to something else, be sure to also change it
-                # in pkgs/top-level/python-packages.nix!
-                sed -i "$f" -re '@magicalSedExpression@'
+                patchPythonScript "$f"
                 # wrapProgram creates the executable shell script described
                 # above. The script will set PYTHONPATH and PATH variables.!
                 # (see pkgs/build-support/setup-hooks/make-wrapper.sh)
                 local -a wrap_args=("$f"
-                                 --prefix PYTHONPATH ':' "$program_PYTHONPATH"
-                                 --prefix PATH ':' "$program_PATH:$dir/bin")
+                                 --prefix PATH ':' "$program_PATH")
 
                 # Add any additional arguments provided by makeWrapperArgs
                 # argument to buildPythonPackage.
diff --git a/pkgs/development/python-modules/pyqt/4.x.nix b/pkgs/development/python-modules/pyqt/4.x.nix
index ead5c4ffe9d2..0eefce47e966 100644
--- a/pkgs/development/python-modules/pyqt/4.x.nix
+++ b/pkgs/development/python-modules/pyqt/4.x.nix
@@ -1,8 +1,9 @@
-{ stdenv, fetchurl, python, pythonPackages, qt4, pythonDBus, pkgconfig, lndir, makeWrapper }:
+{ stdenv, fetchurl, pythonPackages, qt4, pkgconfig, lndir, dbus_libs, makeWrapper }:
 
-let version = "4.11.3";
-in
-stdenv.mkDerivation {
+let
+  version = "4.11.3";
+  inherit (pythonPackages) python dbus-python sip;
+in stdenv.mkDerivation {
   name = "${python.libPrefix}-PyQt-x11-gpl-${version}";
 
   src = fetchurl {
@@ -12,7 +13,7 @@ stdenv.mkDerivation {
 
   configurePhase = ''
     mkdir -p $out
-    lndir ${pythonDBus} $out
+    lndir ${dbus-python} $out
 
     export PYTHONPATH=$PYTHONPATH:$out/lib/${python.libPrefix}/site-packages
 
@@ -21,16 +22,16 @@ stdenv.mkDerivation {
 
     configureFlagsArray=( \
       --confirm-license --bindir $out/bin \
-      --destdir $out/lib/${python.libPrefix}/site-packages \
-      --plugin-destdir $out/lib/qt4/plugins --sipdir $out/share/sip \
-      --dbus=$out/include/dbus-1.0 --verbose)
+      --destdir $out/${python.sitePackages} \
+      --plugin-destdir $out/lib/qt4/plugins --sipdir $out/share/sip/PyQt4 \
+      --dbus=${dbus_libs.dev}/include/dbus-1.0 --verbose)
 
     ${python.executable} configure.py $configureFlags "''${configureFlagsArray[@]}"
   '';
 
-  buildInputs = [ pkgconfig makeWrapper qt4 lndir ];
+  buildInputs = [ pkgconfig makeWrapper qt4 lndir dbus_libs ];
 
-  propagatedBuildInputs = [ pythonPackages.sip_4_16 python ];
+  propagatedBuildInputs = [ sip python ];
 
   postInstall = ''
     for i in $out/bin/*; do
diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix
index 69fb6e266ea5..f5ee50a73522 100644
--- a/pkgs/development/python-modules/pyqt/5.x.nix
+++ b/pkgs/development/python-modules/pyqt/5.x.nix
@@ -1,8 +1,9 @@
-{ stdenv, fetchurl, python, pkgconfig, qtbase, qtsvg, qtwebkit, sip, pythonDBus
+{ stdenv, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, dbus_libs
 , lndir, makeWrapper, qmakeHook }:
 
 let
-  version = "5.5.1";
+  version = "5.6";
+  inherit (pythonPackages) python dbus-python sip;
 in stdenv.mkDerivation {
   name = "${python.libPrefix}-PyQt-${version}";
 
@@ -15,13 +16,13 @@ in stdenv.mkDerivation {
   };
 
   src = fetchurl {
-    url = "mirror://sourceforge/pyqt/PyQt5/PyQt-${version}/PyQt-gpl-${version}.tar.gz";
-    sha256 = "11l3pm0wkwkxzw4n3022iid3yyia5ap4l0ny1m5ngkzzzfafyw0a";
+    url = "mirror://sourceforge/pyqt/PyQt5/PyQt-${version}/PyQt5_gpl-${version}.tar.gz";
+    sha256 = "1qgh42zsr9jppl9k7fcdbhxcd1wrb7wyaj9lng9nxfa19in1lj1f";
   };
 
   buildInputs = [
     pkgconfig makeWrapper lndir
-    qtbase qtsvg qtwebkit qmakeHook
+    qtbase qtsvg qtwebkit dbus_libs qmakeHook
   ];
 
   propagatedBuildInputs = [ sip python ];
@@ -30,7 +31,7 @@ in stdenv.mkDerivation {
     runHook preConfigure
 
     mkdir -p $out
-    lndir ${pythonDBus} $out
+    lndir ${dbus-python} $out
 
     export PYTHONPATH=$PYTHONPATH:$out/lib/${python.libPrefix}/site-packages
 
@@ -40,12 +41,13 @@ in stdenv.mkDerivation {
 
     ${python.executable} configure.py  -w \
       --confirm-license \
-      --dbus=$out/include/dbus-1.0 \
+      --dbus=${dbus_libs.dev}/include/dbus-1.0 \
       --qmake=$QMAKE \
       --no-qml-plugin \
       --bindir=$out/bin \
-      --destdir=$out/lib/${python.libPrefix}/site-packages \
-      --sipdir=$out/share/sip \
+      --destdir=$out/${python.sitePackages} \
+      --stubsdir=$out/${python.sitePackages}/PyQt5 \
+      --sipdir=$out/share/sip/PyQt5 \
       --designer-plugindir=$out/plugins/designer
 
     runHook postConfigure
diff --git a/pkgs/development/python-modules/sip/4.16.nix b/pkgs/development/python-modules/sip/4.16.nix
deleted file mode 100644
index 2861816885f3..000000000000
--- a/pkgs/development/python-modules/sip/4.16.nix
+++ /dev/null
@@ -1,28 +0,0 @@
-{ stdenv, fetchurl, python, isPyPy }:
-
-if isPyPy then throw "sip not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
-  name = "sip-4.16.6";
-
-  src = fetchurl {
-    url = "mirror://sourceforge/pyqt/sip/${name}/${name}.tar.gz";
-    sha256 = "0lj5f581dkwswlwpg7lbicqf940dvrp8vjbkhmyywd99ynxb4zcc";
-  };
-
-  configurePhase = ''
-    ${python.executable} ./configure.py \
-      -d $out/lib/${python.libPrefix}/site-packages \
-      -b $out/bin -e $out/include
-  '';
-
-  buildInputs = [ python ];
-
-  passthru.pythonPath = [];
-
-  meta = with stdenv.lib; {
-    description = "Creates C++ bindings for Python modules";
-    homepage    = "http://www.riverbankcomputing.co.uk/";
-    license     = licenses.gpl2Plus;
-    maintainers = with maintainers; [ lovek323 sander urkud ];
-    platforms   = platforms.all;
-  };
-}
diff --git a/pkgs/development/python-modules/sip/default.nix b/pkgs/development/python-modules/sip/default.nix
index 6c455b3bb1bd..cbee1867cf63 100644
--- a/pkgs/development/python-modules/sip/default.nix
+++ b/pkgs/development/python-modules/sip/default.nix
@@ -1,17 +1,14 @@
 { stdenv, fetchurl, python, isPyPy }:
 
 if isPyPy then throw "sip not supported for interpreter ${python.executable}" else stdenv.mkDerivation rec {
-  name = "sip-4.14.7"; # kde410.pykde4 doesn't build with 4.15
+  name = "sip-4.18.1";
 
   src = fetchurl {
     url = "mirror://sourceforge/pyqt/sip/${name}/${name}.tar.gz";
-    sha256 = "1dv1sdwfmnq481v80k2951amzs9s87d4qhk0hpwrhb1sllh92rh5";
+    sha256 = "1452zy3g0qv4fpd9c0y4gq437kn0xf7bbfniibv5n43zpwnpmklv";
   };
 
-  configurePhase = stdenv.lib.optionalString stdenv.isDarwin ''
-    # prevent sip from complaining about python not being built as a framework
-    sed -i -e 1564,1565d siputils.py
-  '' + ''
+  configurePhase = ''
     ${python.executable} ./configure.py \
       -d $out/lib/${python.libPrefix}/site-packages \
       -b $out/bin -e $out/include