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