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