Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, pythonPackages, pkgconfig 2, qmake, qtbase, qtsvg, qtwebengine 3, wrapQtAppsHook 4}: 5 6let 7 8 inherit (pythonPackages) buildPythonPackage python isPy3k pyqt5 enum34; 9 inherit (pyqt5) sip; 10 # source: https://www.riverbankcomputing.com/pipermail/pyqt/2020-June/042985.html 11 patches = lib.optional (lib.hasPrefix "5.14" pyqt5.version) 12 [ ./fix-build-with-qt-514.patch ] 13 ; 14 15in buildPythonPackage rec { 16 pname = "PyQtWebEngine"; 17 version = "5.15.0"; 18 format = "other"; 19 20 src = pythonPackages.fetchPypi { 21 inherit pname version; 22 sha256 = "0xdzhl07x3mzfnr5cf4d640168vxi7fyl0fz1pvpbgs0irl14237"; 23 }; 24 25 inherit patches; 26 27 outputs = [ "out" "dev" ]; 28 29 nativeBuildInputs = [ 30 pkgconfig 31 qmake 32 sip 33 qtbase 34 qtsvg 35 qtwebengine 36 ]; 37 38 buildInputs = [ 39 sip 40 qtbase 41 qtsvg 42 qtwebengine 43 ]; 44 45 propagatedBuildInputs = [ pyqt5 ] 46 ++ lib.optional (!isPy3k) enum34; 47 48 configurePhase = '' 49 runHook preConfigure 50 51 mkdir -p "$out/share/sip/PyQt5" 52 53 # FIXME: Without --no-dist-info, I get 54 # unable to create /nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/site-packages/PyQtWebEngine-5.12.dist-info 55 ${python.executable} configure.py -w \ 56 --destdir="$out/${python.sitePackages}/PyQt5" \ 57 --no-dist-info \ 58 --apidir="$out/api/${python.libPrefix}" \ 59 --sipdir="$out/share/sip/PyQt5" \ 60 --pyqt-sipdir="${pyqt5}/share/sip/PyQt5" \ 61 --stubsdir="$out/${python.sitePackages}/PyQt5" 62 63 runHook postConfigure 64 ''; 65 66 postInstall = '' 67 # Let's make it a namespace package 68 cat << EOF > $out/${python.sitePackages}/PyQt5/__init__.py 69 from pkgutil import extend_path 70 __path__ = extend_path(__path__, __name__) 71 EOF 72 ''; 73 74 installCheckPhase = let 75 modules = [ 76 "PyQt5.QtWebEngine" 77 "PyQt5.QtWebEngineWidgets" 78 ]; 79 imports = lib.concatMapStrings (module: "import ${module};") modules; 80 in '' 81 echo "Checking whether modules can be imported..." 82 PYTHONPATH=$PYTHONPATH:$out/${python.sitePackages} ${python.interpreter} -c "${imports}" 83 ''; 84 85 doCheck = true; 86 87 enableParallelBuilding = true; 88 89 passthru = { 90 inherit wrapQtAppsHook; 91 }; 92 93 meta = with lib; { 94 description = "Python bindings for Qt5"; 95 homepage = "http://www.riverbankcomputing.co.uk"; 96 license = licenses.gpl3; 97 platforms = platforms.mesaPlatforms; 98 }; 99}