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 15:45:03 +02:00
, xvfb-run
}:
2020-03-10 19:19:54 +01:00
buildPythonPackage rec {
pname = "pywebview";
version = "3.4";
2020-07-01 11:52:32 +02:00
disabled = pythonOlder "3.5";
2020-03-10 19:19:54 +01:00
src = fetchFromGitHub {
owner = "r0x0r";
repo = "pywebview";
rev = version;
sha256 = "sha256-3JHwtw8oReolEl4k8cdt7GCVGNkfWWJN6EnZYHxzDO8=";
2020-03-10 19:19:54 +01:00
};
nativeBuildInputs = [
qt5.wrapQtAppsHook
];
2020-07-01 11:52:32 +02:00
propagatedBuildInputs = [
pyqtwebengine
] ++ lib.optionals (pythonOlder "3.7") [ importlib-resources ];
checkInputs = [
pytest
2021-05-08 15:45:03 +02:00
xvfb-run
];
2020-07-01 11:52:32 +02: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 11:52:32 +02: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 11:52:32 +02:00
patchShebangs run.sh
wrapQtApp run.sh
2020-07-01 11:52:32 +02:00
xvfb-run -s '-screen 0 800x600x24' ./run.sh
popd
'';
2020-03-10 19:19:54 +01:00
meta = with lib; {
homepage = "https://github.com/r0x0r/pywebview";
2020-07-01 11:52:32 +02:00
description = "Lightweight cross-platform wrapper around a webview";
2020-03-10 19:19:54 +01:00
license = licenses.bsd3;
maintainers = with maintainers; [ jojosch ];
};
}