1{
2 lib,
3 stdenv,
4 pythonPackages,
5 fetchPypi,
6 pkg-config,
7 qmake,
8 qtbase,
9 qtsvg,
10 qtwebengine,
11 qtwebchannel,
12 qtdeclarative,
13 wrapQtAppsHook,
14 darwin,
15 buildPackages,
16}:
17
18let
19 inherit (pythonPackages)
20 buildPythonPackage
21 python
22 isPy27
23 pyqt5
24 sip
25 pyqt-builder
26 ;
27 inherit (darwin) autoSignDarwinBinariesHook;
28in
29buildPythonPackage (
30 rec {
31 pname = "pyqtwebengine";
32 version = "5.15.6";
33 format = "pyproject";
34
35 disabled = isPy27;
36
37 src = fetchPypi {
38 pname = "PyQtWebEngine";
39 inherit version;
40 sha256 = "sha256-riQe8qYceCk5xYtSwq6lOtmbMPOTTINY1eCm67P9ByE=";
41 };
42
43 postPatch = ''
44 substituteInPlace pyproject.toml \
45 --replace "[tool.sip.project]" "[tool.sip.project]''\nsip-include-dirs = [\"${pyqt5}/${python.sitePackages}/PyQt5/bindings\"]"
46 '';
47
48 outputs = [
49 "out"
50 "dev"
51 ];
52
53 nativeBuildInputs =
54 [
55 pkg-config
56 qmake
57 ]
58 ++ lib.optionals (stdenv.buildPlatform == stdenv.hostPlatform) [ sip ]
59 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
60 python.pythonOnBuildForHost.pkgs.sip
61 ]
62 ++ [
63 qtbase
64 qtsvg
65 qtwebengine
66 pyqt-builder
67 pythonPackages.setuptools
68 ]
69 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ qtdeclarative ]
70 ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ];
71
72 buildInputs =
73 [
74 sip
75 qtbase
76 qtsvg
77 qtwebengine
78 ]
79 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
80 qtwebchannel
81 qtdeclarative
82 ];
83
84 propagatedBuildInputs = [ pyqt5 ];
85
86 dontWrapQtApps = true;
87
88 # Avoid running qmake, which is in nativeBuildInputs
89 dontConfigure = true;
90
91 # Checked using pythonImportsCheck
92 doCheck = false;
93
94 pythonImportsCheck = [
95 "PyQt5.QtWebEngine"
96 "PyQt5.QtWebEngineWidgets"
97 ];
98
99 enableParallelBuilding = true;
100
101 passthru = {
102 inherit wrapQtAppsHook;
103 };
104
105 meta = with lib; {
106 description = "Python bindings for Qt5";
107 homepage = "http://www.riverbankcomputing.co.uk";
108 license = licenses.gpl3;
109 hydraPlatforms = lib.lists.intersectLists qtwebengine.meta.platforms platforms.mesaPlatforms;
110 };
111 }
112 // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) {
113 # TODO: figure out why the env hooks aren't adding these inclusions automatically
114 env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [
115 "-I${lib.getDev qtbase}/include/QtPrintSupport/"
116 "-I${lib.getDev qtwebchannel}/include/QtWebChannel/"
117 ];
118 }
119)