summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorEric Bavier <bavier@posteo.net>2023-02-13 22:24:36 -0600
committerEric Bavier <bavier@posteo.net>2023-02-14 10:33:04 -0600
commita22b62b98e051cced363e7a363aa3847210aec50 (patch)
tree89adea6ecb137f08da50bcae7166410fe48b0acd /gnu/packages
parent4501a50bbdb35b4e0b5adf57c11a511af31f76f5 (diff)
downloadguix-a22b62b98e051cced363e7a363aa3847210aec50.tar.gz
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.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/patches/onionshare-cli-async-mode.patch25
-rw-r--r--gnu/packages/tor.scm25
2 files changed, 38 insertions, 12 deletions
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 <efraim@flashner.co.il>
 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
 ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2017, 2018, 2019, 2021 Eric Bavier <bavier@posteo.net>
+;;; Copyright © 2017, 2018, 2019, 2021, 2023 Eric Bavier <bavier@posteo.net>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
 ;;; Copyright © 2018, 2022 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
@@ -46,6 +46,7 @@
   #: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 @@ networks.")
 (define-public onionshare-cli
   (package
     (name "onionshare-cli")
-    (version "2.5")
+    (version "2.6")
     (source
      (origin
        (method git-fetch)
@@ -265,7 +266,8 @@ networks.")
              (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 @@ 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 @@ 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 @@ 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.")))