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