2021-04-08 16:26:57 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, importlib-resources
|
|
|
|
, pyqtwebengine
|
|
|
|
, pytest
|
|
|
|
, pythonOlder
|
|
|
|
, qt5
|
2021-05-20 23:08:51 +00:00
|
|
|
, xvfb-run
|
2021-12-21 02:18:32 +00:00
|
|
|
, proxy_tools
|
2021-04-08 16:26:57 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pywebview";
|
2021-12-21 02:18:32 +00:00
|
|
|
version = "3.5";
|
2020-07-18 16:06:22 +00:00
|
|
|
disabled = pythonOlder "3.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "r0x0r";
|
|
|
|
repo = "pywebview";
|
|
|
|
rev = version;
|
2021-12-21 02:18:32 +00:00
|
|
|
sha256 = "sha256-+At/ToEylSPcLh/u2NHVTXQpMnw+2/afsevg5YAX/4c=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
qt5.wrapQtAppsHook
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2021-04-08 16:26:57 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
pyqtwebengine
|
2021-12-21 02:18:32 +00:00
|
|
|
proxy_tools
|
2021-04-08 16:26:57 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [ importlib-resources ];
|
|
|
|
|
|
|
|
checkInputs = [
|
|
|
|
pytest
|
2021-05-20 23:08:51 +00:00
|
|
|
xvfb-run
|
2021-04-08 16:26:57 +00:00
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
|
|
|
checkPhase = ''
|
2021-04-08 16:26:57 +00:00
|
|
|
# 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-18 16:06:22 +00:00
|
|
|
pushd tests
|
2021-04-08 16:26:57 +00:00
|
|
|
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-18 16:06:22 +00:00
|
|
|
patchShebangs run.sh
|
2021-04-08 16:26:57 +00:00
|
|
|
wrapQtApp run.sh
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
xvfb-run -s '-screen 0 800x600x24' ./run.sh
|
|
|
|
popd
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-21 02:18:32 +00:00
|
|
|
pythonImportsCheck = [ "webview" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/r0x0r/pywebview";
|
2020-07-18 16:06:22 +00:00
|
|
|
description = "Lightweight cross-platform wrapper around a webview";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ jojosch ];
|
|
|
|
};
|
|
|
|
}
|