unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#62567] [PATCH] gnu: libreoffice: Fix access to python modules.
@ 2023-03-31 10:09 Nicolas Graves via Guix-patches via
  2023-06-18 21:08 ` bug#62567: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Graves via Guix-patches via @ 2023-03-31 10:09 UTC (permalink / raw)
  To: 62567; +Cc: ngraves

* gnu/packages/libreoffice.scm (libreoffice): Fix access to python modules.
---
 gnu/packages/libreoffice.scm | 38 ++++++++++++++++++++++++++++++++++--
 1 file changed, 36 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
index 3d3e6d18dc..48689b9342 100644
--- a/gnu/packages/libreoffice.scm
+++ b/gnu/packages/libreoffice.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2018, 2020 Jonathan Brielmaier <jonathan.brielmaier@web.de>
 ;;; Copyright © 2019 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2020 Marcin Karpezo <sirmacik@wioo.waw.pl>
+;;; Copyright © 2023 Nicolas Graves <ngraves@ngraves.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -912,6 +913,11 @@ (define-public libreoffice
     (build-system glib-or-gtk-build-system)
     (arguments
      (list
+      #:imported-modules `((guix build python-build-system)
+                           ,@%glib-or-gtk-build-system-modules)
+      #:modules `(((guix build python-build-system) #:select (python-version))
+                  (ice-9 textual-ports)
+                  ,@%glib-or-gtk-build-system-modules)
       #:tests? #f                       ; Building the tests already fails.
       #:phases
       #~(modify-phases %standard-phases
@@ -975,7 +981,12 @@ (define-public libreoffice
             ;; Create 'soffice' and 'libreoffice' symlinks to the executable
             ;; script.
             (lambda _
-              (let ((out #$output))
+              (let* ((out #$output)
+                     (python-libdir
+                      (string-append out "/lib/python"
+                                     (python-version
+                                      #$(this-package-input "python"))
+                                     "/site-packages/")))
                 (define (symlink-output src dst)
                   (mkdir-p (dirname (string-append out dst)))
                   (symlink (string-append out src) (string-append out dst)))
@@ -1001,6 +1012,24 @@ (define (install-appdata app)
                                  "sysui/desktop/appstream-appdata/"
                                  "libreoffice-" app ".appdata.xml")
                                 (string-append out "/share/appdata")))
+                (define (install-python-script name)
+                  (with-input-from-file
+                      (string-append out "/lib/libreoffice/program/" name ".py")
+                    (lambda _
+                      (let ((file (get-string-all (current-input-port))))
+                        (with-output-to-file
+                            (string-append python-libdir name ".py")
+                          (lambda _
+                            (format (current-output-port) "~a"
+                                    (string-append
+                                     "import sys, os\n"
+                                     "sys.path.append('"
+                                     out "/lib/libreoffice/program" "')\n"
+                                     "os.putenv('URE_BOOTSTRAP', 'vnd.sun.star.pathname:"
+                                     out "/lib/libreoffice/program/fundamentalrc')\n\n"
+                                     file)))))))
+                  (delete-file
+                   (string-append out "/lib/libreoffice/program/" name ".py")))
                 (symlink-output "/lib/libreoffice/program/soffice"
                                 "/bin/soffice")
                 (symlink-output "/lib/libreoffice/program/soffice"
@@ -1015,7 +1044,12 @@ (define (install-appdata app)
                           '("base" "calc" "draw" "impress" "writer"))
                 (mkdir-p (string-append out "/share/icons/hicolor"))
                 (copy-recursively "sysui/desktop/icons/hicolor"
-                                  (string-append out "/share/icons/hicolor"))))))
+                                  (string-append out "/share/icons/hicolor"))
+                (mkdir-p python-libdir)
+                (for-each install-python-script
+                          '("access2base" "mailmerge" "msgbox" "officehelper"
+                            "pythonloader" "pythonscript" "scriptforge"
+                            "unohelper" "uno"))))))
       #:configure-flags
       #~(list
          "--enable-release-build"
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#62567: [PATCH] gnu: libreoffice: Fix access to python modules.
  2023-03-31 10:09 [bug#62567] [PATCH] gnu: libreoffice: Fix access to python modules Nicolas Graves via Guix-patches via
@ 2023-06-18 21:08 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2023-06-18 21:08 UTC (permalink / raw)
  To: Nicolas Graves; +Cc: 62567-done

Hi,

Nicolas Graves <ngraves@ngraves.fr> skribis:

> * gnu/packages/libreoffice.scm (libreoffice): Fix access to python modules.

Finally applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-18 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 10:09 [bug#62567] [PATCH] gnu: libreoffice: Fix access to python modules Nicolas Graves via Guix-patches via
2023-06-18 21:08 ` bug#62567: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).