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