1{ lib 2, buildPythonPackage 3, fetchFromGitHub 4, importlib-resources 5, pyqtwebengine 6, pytest 7, pythonOlder 8, qt5 9, xvfb-run 10}: 11 12buildPythonPackage rec { 13 pname = "pywebview"; 14 version = "3.4"; 15 disabled = pythonOlder "3.5"; 16 17 src = fetchFromGitHub { 18 owner = "r0x0r"; 19 repo = "pywebview"; 20 rev = version; 21 sha256 = "sha256-3JHwtw8oReolEl4k8cdt7GCVGNkfWWJN6EnZYHxzDO8="; 22 }; 23 24 nativeBuildInputs = [ 25 qt5.wrapQtAppsHook 26 ]; 27 28 propagatedBuildInputs = [ 29 pyqtwebengine 30 ] ++ lib.optionals (pythonOlder "3.7") [ importlib-resources ]; 31 32 checkInputs = [ 33 pytest 34 xvfb-run 35 ]; 36 37 checkPhase = '' 38 # Cannot create directory /homeless-shelter/.... Error: FILE_ERROR_ACCESS_DENIED 39 export HOME=$TMPDIR 40 # QStandardPaths: XDG_RUNTIME_DIR not set 41 export XDG_RUNTIME_DIR=$HOME/xdg-runtime-dir 42 43 pushd tests 44 substituteInPlace run.sh \ 45 --replace "PYTHONPATH=.." "PYTHONPATH=$PYTHONPATH" \ 46 --replace "pywebviewtest test_js_api.py::test_concurrent ''${PYTEST_OPTIONS}" "# skip flaky test_js_api.py::test_concurrent" 47 48 patchShebangs run.sh 49 wrapQtApp run.sh 50 51 xvfb-run -s '-screen 0 800x600x24' ./run.sh 52 popd 53 ''; 54 55 meta = with lib; { 56 homepage = "https://github.com/r0x0r/pywebview"; 57 description = "Lightweight cross-platform wrapper around a webview"; 58 license = licenses.bsd3; 59 maintainers = with maintainers; [ jojosch ]; 60 }; 61}