From a22b62b98e051cced363e7a363aa3847210aec50 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Mon, 13 Feb 2023 22:24:36 -0600 Subject: gnu: onionshare: Update to 2.6. * gnu/packages/patches/onionshare-cli-async-mode.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/tor.scm (onionshare): Update to 2.6. [source]: Use patch. [inputs]: Add xdg-utils. Move xvfb-run, used for tests, to ... [native-inputs]: here. [arguments]: Run tests. Add "absolutize" phase for xdg-open. --- gnu/local.mk | 1 + .../patches/onionshare-cli-async-mode.patch | 25 ++++++++++++++++++++++ gnu/packages/tor.scm | 25 +++++++++++----------- 3 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 gnu/packages/patches/onionshare-cli-async-mode.patch diff --git a/gnu/local.mk b/gnu/local.mk index cdb99813d0..07a7a0f527 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1597,6 +1597,7 @@ dist_patch_DATA = \ %D%/packages/patches/ocaml-4.09-multiple-definitions.patch \ %D%/packages/patches/omake-fix-non-determinism.patch \ %D%/packages/patches/oneko-remove-nonfree-characters.patch \ + %D%/packages/patches/onionshare-cli-async-mode.patch \ %D%/packages/patches/onnx-optimizer-system-library.patch \ %D%/packages/patches/onnx-use-system-googletest.patch \ %D%/packages/patches/onnx-shared-libraries.patch \ diff --git a/gnu/packages/patches/onionshare-cli-async-mode.patch b/gnu/packages/patches/onionshare-cli-async-mode.patch new file mode 100644 index 0000000000..b71b56046d --- /dev/null +++ b/gnu/packages/patches/onionshare-cli-async-mode.patch @@ -0,0 +1,25 @@ +Specifying the `async_mode` parameter seems to have been a workaround for +packaging on Windows and macOS. If not given, flask_socketio.SocketIO will +probe for an available asynchronous model, e.g. `eventlet`, and otherwise gets +stuck if `gevent-socketio` is not available. + +c.f. https://github.com/onionshare/onionshare/commit/ec7fa4ef16c9e1ba6028ee927c23f76c399a17a6 +and https://github.com/onionshare/onionshare/issues/1510 + +diff --git a/cli/onionshare_cli/web/web.py b/cli/onionshare_cli/web/web.py +index 64844b5..7e1b095 100644 +--- a/cli/onionshare_cli/web/web.py ++++ b/cli/onionshare_cli/web/web.py +@@ -164,10 +164,10 @@ class Web: + elif self.mode == "chat": + if self.common.verbose: + self.socketio = SocketIO( +- async_mode="gevent", logger=True, engineio_logger=True ++ logger=True, engineio_logger=True + ) + else: +- self.socketio = SocketIO(async_mode="gevent") ++ self.socketio = SocketIO() + self.socketio.init_app(self.app) + self.chat_mode = ChatModeWeb(self.common, self) + diff --git a/gnu/packages/tor.scm b/gnu/packages/tor.scm index 6e5b3c0f60..9e26753857 100644 --- a/gnu/packages/tor.scm +++ b/gnu/packages/tor.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2016, 2017, 2018, 2020, 2021, 2022 Efraim Flashner ;;; Copyright © 2016, 2017 Nikita ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice -;;; Copyright © 2017, 2018, 2019, 2021 Eric Bavier +;;; Copyright © 2017, 2018, 2019, 2021, 2023 Eric Bavier ;;; Copyright © 2017 Rutger Helling ;;; Copyright © 2018, 2022 Ricardo Wurmus ;;; Copyright © 2020 Vincent Legoll @@ -46,6 +46,7 @@ (define-module (gnu packages tor) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages pcre) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages glib) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) @@ -256,7 +257,7 @@ (define-public privoxy (define-public onionshare-cli (package (name "onionshare-cli") - (version "2.5") + (version "2.6") (source (origin (method git-fetch) @@ -265,7 +266,8 @@ (define-public onionshare-cli (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "16m5ll0v0qjbirwwzbzxg53kq4ry1n3ay5x0h8zkij73v3x0q864")))) + (base32 "1bhrp019a0923h7dnfxhgvgvdp81blvnsbnvzy34hp827abxf3ic")) + (patches (search-patches "onionshare-cli-async-mode.patch")))) (build-system python-build-system) (native-inputs (list python-pytest)) @@ -329,6 +331,11 @@ (define-public onionshare (substitute-keyword-arguments (package-arguments onionshare-cli) ((#:phases phases) #~(modify-phases #$phases + (add-after 'unpack 'absolutize + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "desktop/onionshare/tab/mode/history.py" + (("Popen\\(\\[\"xdg-open\"") + (string-append "Popen([\"" (which "xdg-open") "\""))))) (replace 'change-directory (lambda _ (chdir "desktop/"))) (add-after 'install 'install-data @@ -353,15 +360,9 @@ (define-public onionshare (setenv "QT_QPA_PLATFORM" "offscreen") (setenv "HOME" "/tmp") (apply invoke "xvfb-run" "pytest" "-vv" - (find-files "tests" "^test_gui.*\\.py$"))))))) - ;; Most tests fail: "2 failed, 8 warnings, 44 errors in 6.06s", due to - ;; error "RuntimeError: Please destroy the Application singleton before - ;; creating a new Application instance." (see: - ;; https://github.com/onionshare/onionshare/issues/1603). - ((#:tests? _ #f) - #f))) + (find-files "tests" "^test_gui.*\\.py$"))))))))) (native-inputs - (list python-pytest)) + (list python-pytest xvfb-run)) (inputs ;; The desktop client uses onionshare-cli like a python module. But ;; propagating onionshare-cli's inputs is not great, since a user would @@ -372,7 +373,7 @@ (define-public onionshare python-shiboken-2 python-pyside-2 python-qrcode - xvfb-run))) + xdg-utils))) (description "OnionShare lets you securely and anonymously share files, host websites, and chat with friends using the Tor network."))) -- cgit v1.2.3