nixpkgs/pkgs/development/python-modules/pywebview/default.nix

62 lines
1.4 KiB
Nix
Raw Normal View History

{ lib
, buildPythonPackage
, fetchFromGitHub
, importlib-resources
, pyqtwebengine
, pytest
, pythonOlder
, qt5
2021-05-08 14:45:03 +01:00
, xvfb-run
}:
2020-03-10 18:19:54 +00:00
buildPythonPackage rec {
pname = "pywebview";
version = "3.4";
2020-07-01 10:52:32 +01:00
disabled = pythonOlder "3.5";
2020-03-10 18:19:54 +00:00
src = fetchFromGitHub {
owner = "r0x0r";
repo = "pywebview";
rev = version;
sha256 = "sha256-3JHwtw8oReolEl4k8cdt7GCVGNkfWWJN6EnZYHxzDO8=";
2020-03-10 18:19:54 +00:00
};
nativeBuildInputs = [
qt5.wrapQtAppsHook
];
2020-07-01 10:52:32 +01:00
propagatedBuildInputs = [
pyqtwebengine
] ++ lib.optionals (pythonOlder "3.7") [ importlib-resources ];
checkInputs = [
pytest
2021-05-08 14:45:03 +01:00
xvfb-run
];
2020-07-01 10:52:32 +01:00
checkPhase = ''
# Cannot create directory /homeless-shelter/.... Error: FILE_ERROR_ACCESS_DENIED
export HOME=$TMPDIR
# QStandardPaths: XDG_RUNTIME_DIR not set
export XDG_RUNTIME_DIR=$HOME/xdg-runtime-dir
2020-07-01 10:52:32 +01:00
pushd tests
substituteInPlace run.sh \
--replace "PYTHONPATH=.." "PYTHONPATH=$PYTHONPATH" \
--replace "pywebviewtest test_js_api.py::test_concurrent ''${PYTEST_OPTIONS}" "# skip flaky test_js_api.py::test_concurrent"
2020-07-01 10:52:32 +01:00
patchShebangs run.sh
wrapQtApp run.sh
2020-07-01 10:52:32 +01:00
xvfb-run -s '-screen 0 800x600x24' ./run.sh
popd
'';
2020-03-10 18:19:54 +00:00
meta = with lib; {
homepage = "https://github.com/r0x0r/pywebview";
2020-07-01 10:52:32 +01:00
description = "Lightweight cross-platform wrapper around a webview";
2020-03-10 18:19:54 +00:00
license = licenses.bsd3;
maintainers = with maintainers; [ jojosch ];
};
}