20 ] ++ lib.optionals stdenv.isLinux [
26 ps.buildPythonApplication rec {
31 disabled = ps.pythonOlder "3.9";
33 src = fetchFromGitHub {
36 rev = "refs/tags/v${version}";
37 hash = "sha256-iMlW8oEt4OSipJaQ2XzBZeBVqiZP/C1sM0f5LYjv7/A=";
41 # disable coverage testing
42 substituteInPlace pyproject.toml \
43 --replace-fail "addopts = [" "addopts_ = ["
66 "''${qtWrapperArgs[@]}"
67 --set QT_QPA_PLATFORM xcb
68 --prefix PATH : ${lib.makeBinPath wrapperDeps}
72 nativeCheckInputs = wrapperDeps ++ [
76 ] ++ lib.optionals stdenv.isLinux [
82 export HOME=$(mktemp -d)
83 '' + lib.optionalString stdenv.isLinux ''
84 # setup a virtual x11 display
85 export DISPLAY=:$((2000 + $RANDOM % 1000))
86 Xvfb $DISPLAY -screen 5 1024x768x8 &
90 postCheck = lib.optionalString stdenv.isLinux ''
91 # cleanup the virtual x11 display
97 # requires a wayland session (no xclip support)
99 # RuntimeError: Please destroy the QApplication singleton before creating a new QApplication instance
100 "test_get_application"
101 # times out, unknown why
102 "test_update_checker_triggers_checked_signal"
104 "test_urls_reachable"
106 "test_synchronized_capture"
108 "test_normcap_ocr_testcases"
109 ] ++ lib.optionals stdenv.isDarwin [
110 # requires impure pbcopy
111 "test_get_copy_func_with_pbcopy"
112 "test_get_copy_func_without_pbcopy"
113 "test_perform_pbcopy"
114 # NSXPCSharedListener endpointForReply:withListenerName:replyErrorCode:
115 # while obtaining endpoint 'ClientCallsAuxiliary': Connection interrupted
117 "test_introduction_initialize_checkbox_state"
118 "test_introduction_checkbox_sets_return_code"
119 "test_introduction_toggle_checkbox_changes_return_code"
120 "test_show_introduction"
123 disabledTestPaths = [
125 "tests/tests_gui/test_downloader.py"
126 # fails to import, causes pytest to freeze
127 "tests/tests_gui/test_language_manager.py"
128 # RuntimeError("Internal C++ object (PySide6.QtGui.QHideEvent) already deleted.")
129 # AttributeError("'LoadingIndicator' object has no attribute 'timer'")
130 "tests/tests_gui/test_loading_indicator.py"
131 ] ++ lib.optionals stdenv.isDarwin [
133 "tests/integration/test_normcap.py"
134 "tests/integration/test_tray_menu.py"
135 # failure unknown, crashes in first test with `.show()`
136 "tests/tests_gui/test_loading_indicator.py"
140 description = "OCR powered screen-capture tool to capture information instead of images";
141 homepage = "https://dynobo.github.io/normcap/";
142 license = licenses.gpl3Plus;
143 maintainers = with maintainers; [ cafkafk pbsds ];
144 mainProgram = "normcap";
145 broken = stdenv.isDarwin;