1{ lib, fetchurl, pythonPackages, pkgconfig
2, qmake, qtbase, qtsvg, qtwebengine
3, wrapQtAppsHook
4}:
5
6let
7
8 inherit (pythonPackages) buildPythonPackage python isPy3k pyqt5 enum34;
9 inherit (pyqt5) sip;
10
11in buildPythonPackage rec {
12 pname = "pyqtwebengine";
13 version = "5.12.1";
14 format = "other";
15
16 src = fetchurl {
17 url = "https://www.riverbankcomputing.com/static/Downloads/PyQtWebEngine/${version}/PyQtWebEngine_gpl-${version}.tar.gz";
18 sha256 = "0wylkd7fh2g27y3710rpxmj9wx0wpi3z7qbv6khiddm15rkh81w6";
19 };
20
21 outputs = [ "out" "dev" ];
22
23 nativeBuildInputs = [
24 pkgconfig
25 qmake
26 sip
27 qtbase
28 qtsvg
29 qtwebengine
30 ];
31
32 buildInputs = [
33 sip
34 qtbase
35 qtsvg
36 qtwebengine
37 ];
38
39 propagatedBuildInputs = [ pyqt5 ]
40 ++ lib.optional (!isPy3k) enum34;
41
42 configurePhase = ''
43 runHook preConfigure
44
45 mkdir -p "$out/share/sip/PyQt5"
46
47 # FIXME: Without --no-dist-info, I get
48 # unable to create /nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/site-packages/PyQtWebEngine-5.12.dist-info
49 ${python.executable} configure.py -w \
50 --destdir="$out/${python.sitePackages}/PyQt5" \
51 --no-dist-info \
52 --apidir="$out/api/${python.libPrefix}" \
53 --sipdir="$out/share/sip/PyQt5" \
54 --pyqt-sipdir="${pyqt5}/share/sip/PyQt5" \
55 --stubsdir="$out/${python.sitePackages}/PyQt5"
56
57 runHook postConfigure
58 '';
59
60 postInstall = ''
61 # Let's make it a namespace package
62 cat << EOF > $out/${python.sitePackages}/PyQt5/__init__.py
63 from pkgutil import extend_path
64 __path__ = extend_path(__path__, __name__)
65 EOF
66 '';
67
68 installCheckPhase = let
69 modules = [
70 "PyQt5.QtWebEngine"
71 "PyQt5.QtWebEngineWidgets"
72 ];
73 imports = lib.concatMapStrings (module: "import ${module};") modules;
74 in ''
75 echo "Checking whether modules can be imported..."
76 PYTHONPATH=$PYTHONPATH:$out/${python.sitePackages} ${python.interpreter} -c "${imports}"
77 '';
78
79 doCheck = true;
80
81 enableParallelBuilding = true;
82
83 passthru = {
84 inherit wrapQtAppsHook;
85 };
86
87 meta = with lib; {
88 description = "Python bindings for Qt5";
89 homepage = http://www.riverbankcomputing.co.uk;
90 license = licenses.gpl3;
91 platforms = platforms.mesaPlatforms;
92 };
93}