1{ lib, fetchurl, pythonPackages, pkgconfig, makeWrapper, qmake
2, lndir, qtbase, qtsvg, qtwebkit, qtwebengine, dbus_libs
3, withWebSockets ? false, qtwebsockets
4, withConnectivity ? false, qtconnectivity
5}:
6
7let
8 pname = "PyQt";
9 version = "5.10";
10
11 inherit (pythonPackages) buildPythonPackage python dbus-python sip;
12in buildPythonPackage {
13 pname = pname;
14 version = version;
15 format = "other";
16
17 meta = with lib; {
18 description = "Python bindings for Qt5";
19 homepage = http://www.riverbankcomputing.co.uk;
20 license = licenses.gpl3;
21 platforms = platforms.mesaPlatforms;
22 maintainers = with maintainers; [ sander ];
23 };
24
25 src = fetchurl {
26 url = "mirror://sourceforge/pyqt/PyQt5/PyQt-${version}/PyQt5_gpl-${version}.tar.gz";
27 sha256 = "0l2zy6b7bfjxmg4bb8yikg6i8iy2xdwmvk7knfmrzfpqbmkycbrl";
28 };
29
30 nativeBuildInputs = [ pkgconfig qmake ];
31
32 buildInputs = [
33 lndir qtbase qtsvg qtwebkit qtwebengine dbus_libs
34 ] ++ lib.optional withWebSockets qtwebsockets ++ lib.optional withConnectivity qtconnectivity;
35
36 propagatedBuildInputs = [ sip ];
37
38 configurePhase = ''
39 runHook preConfigure
40
41 mkdir -p $out
42 lndir ${dbus-python} $out
43 rm -rf "$out/nix-support"
44
45 export PYTHONPATH=$PYTHONPATH:$out/${python.sitePackages}
46
47 substituteInPlace configure.py \
48 --replace 'install_dir=pydbusmoddir' "install_dir='$out/${python.sitePackages}/dbus/mainloop'" \
49 --replace "ModuleMetadata(qmake_QT=['webkitwidgets'])" "ModuleMetadata(qmake_QT=['webkitwidgets', 'printsupport'])"
50
51 ${python.executable} configure.py -w \
52 --confirm-license \
53 --dbus=${dbus_libs.dev}/include/dbus-1.0 \
54 --no-qml-plugin \
55 --bindir=$out/bin \
56 --destdir=$out/${python.sitePackages} \
57 --stubsdir=$out/${python.sitePackages}/PyQt5 \
58 --sipdir=$out/share/sip/PyQt5 \
59 --designer-plugindir=$out/plugins/designer
60
61 runHook postConfigure
62 '';
63
64 postInstall = ''
65 for i in $out/bin/*; do
66 wrapProgram $i --prefix PYTHONPATH : "$PYTHONPATH"
67 done
68 '';
69
70 enableParallelBuilding = true;
71}