Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.05 101 lines 2.4 kB view raw
1{ lib, pythonPackages, pkg-config 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.4"; 18 format = "other"; 19 20 src = pythonPackages.fetchPypi { 21 inherit pname version; 22 sha256 = "06fc35hzg346a9c86dk7vzm1fakkgzn5l52jfq3bix3587sjip6f"; 23 }; 24 25 inherit patches; 26 27 outputs = [ "out" "dev" ]; 28 29 nativeBuildInputs = [ 30 pkg-config 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 dontWrapQtApps = true; 49 50 configurePhase = '' 51 runHook preConfigure 52 53 mkdir -p "$out/share/sip/PyQt5" 54 55 # FIXME: Without --no-dist-info, I get 56 # unable to create /nix/store/yv4pzx3lxk3lscq0pw3hqzs7k4x76xsm-python3-3.7.2/lib/python3.7/site-packages/PyQtWebEngine-5.12.dist-info 57 ${python.executable} configure.py -w \ 58 --destdir="$out/${python.sitePackages}/PyQt5" \ 59 --no-dist-info \ 60 --apidir="$out/api/${python.libPrefix}" \ 61 --sipdir="$out/share/sip/PyQt5" \ 62 --pyqt-sipdir="${pyqt5}/share/sip/PyQt5" \ 63 --stubsdir="$out/${python.sitePackages}/PyQt5" 64 65 runHook postConfigure 66 ''; 67 68 postInstall = '' 69 # Let's make it a namespace package 70 cat << EOF > $out/${python.sitePackages}/PyQt5/__init__.py 71 from pkgutil import extend_path 72 __path__ = extend_path(__path__, __name__) 73 EOF 74 ''; 75 76 installCheckPhase = let 77 modules = [ 78 "PyQt5.QtWebEngine" 79 "PyQt5.QtWebEngineWidgets" 80 ]; 81 imports = lib.concatMapStrings (module: "import ${module};") modules; 82 in '' 83 echo "Checking whether modules can be imported..." 84 PYTHONPATH=$PYTHONPATH:$out/${python.sitePackages} ${python.interpreter} -c "${imports}" 85 ''; 86 87 doCheck = true; 88 89 enableParallelBuilding = true; 90 91 passthru = { 92 inherit wrapQtAppsHook; 93 }; 94 95 meta = with lib; { 96 description = "Python bindings for Qt5"; 97 homepage = "http://www.riverbankcomputing.co.uk"; 98 license = licenses.gpl3; 99 platforms = platforms.mesaPlatforms; 100 }; 101}