Subject: bug#41025: blueman does not start

From: Raghav Gururajan <[email-masked]>
Date: Sun, 3 May 2020 11:24:41 -0400

Hi Pierre!

> Thanks!  Sadly your patch does not fix the issue for me.
> 
> You can reproduce with
> 
> --8<---------------cut here---------------start------------->8---
> ./pre-inst-env guix environment --pure --ad-hoc blueman -- blueman-tray
> --8<---------------cut here---------------end--------------->8---
> 
> I had a quick look at the package definition: it's a
> glib-or-gtk-build-system but the package is in python, so you need to
> set the PYTHONPATH manually I think.  Look at the other GNOME package
> written in Python, my guess is that it's the same thing.

Thanks! I was able to fix "gi" error. But "No module 'blueman', I could not
fix. Any ideas?

I have attached a new patch.

Regards,
RG.
>From 19cdddadcff5fa940c8e7e6ef1a31040a4412db5 Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <[email-masked]>
Date: Sun, 3 May 2020 11:21:48 -0400
Subject: [PATCH 4/4] gnu: blueman: Test patch.

* gnu/packages/networking.scm (blueman): Test patch.
---
 gnu/packages/networking.scm | 119 +++++++++++++++++++++++++++++++++++-
 1 file changed, 118 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 94b521584f..b624149b23 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -143,7 +143,124 @@
         "--enable-polkit"
         "--disable-appindicator"         ; Deprecated
         "--with-systemdsystemunitdir=no" ; Not required
-        "--with-systemduserunitdir=no")))  ; Not required
+        "--with-systemduserunitdir=no")  ; Not required
+       #:phases
+       (modify-phases %standard-phases
+         ;; Python references are not being patched in patch-phase of build;
+         ;; despite using python-wrapper as input. So patching them manually.
+         (add-after 'unpack 'patch-python-references
+           (lambda* (#:key inputs #:allow-other-keys)
+             (substitute* "apps/blueman-adapters.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-applet.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-assistant.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-manager.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-mechanism.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-report.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-rfcomm-watcher.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-sendto.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-services.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             (substitute* "apps/blueman-tray.in"
+               (("@PYTHON@") (string-append (assoc-ref inputs "python")
+                                            "/bin/python3.7")))
+             #t))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-adapters
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-adap
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-adapters")))
+               (wrap-program bm-adap
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-applet
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-app
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-applet")))
+               (wrap-program bm-app
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-assistant
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-ass
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-assistant")))
+               (wrap-program bm-ass
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-manager
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-man
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-manager")))
+               (wrap-program bm-man
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-report
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-rep
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-report")))
+               (wrap-program bm-rep
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-sendto
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-st
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-sendto")))
+               (wrap-program bm-st
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-services
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-serv
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-services")))
+               (wrap-program bm-serv
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t)))
+         (add-after 'glib-or-gtk-wrap 'wrap-blueman-tray
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let
+                 ((bm-tray
+                   (string-append
+                    (assoc-ref outputs "out") "/bin/blueman-tray")))
+               (wrap-program bm-tray
+                 `("PYTHONPATH" = (,(getenv "PYTHONPATH")))
+                 `("GI_TYPELIB_PATH" = (,(getenv "GI_TYPELIB_PATH"))))
+               #t))))))
     (native-inputs
      `(("cython" ,python-cython)
        ("glib:bin" ,glib "bin")
-- 
2.26.2