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 [ 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 ]; 66 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 ]; 78 79 propagatedBuildInputs = [ pyqt5 ]; 80 81 dontWrapQtApps = true; 82 83 # Avoid running qmake, which is in nativeBuildInputs 84 dontConfigure = true; 85 86 # Checked using pythonImportsCheck 87 doCheck = false; 88 89 pythonImportsCheck = [ 90 "PyQt5.QtWebEngine" 91 "PyQt5.QtWebEngineWidgets" 92 ]; 93 94 enableParallelBuilding = true; 95 96 passthru = { 97 inherit (libsForQt5) wrapQtAppsHook; 98 }; 99 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 } 114)