GNU bug report logs - #62567
[PATCH] gnu: libreoffice: Fix access to python modules.

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Fri, 31 Mar 2023 10:10:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 62567 in the body.
You can then email your comments to 62567 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#62567; Package guix-patches. (Fri, 31 Mar 2023 10:10:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 31 Mar 2023 10:10:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: guix-patches <at> gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH] gnu: libreoffice: Fix access to python modules.
Date: Fri, 31 Mar 2023 12:09:01 +0200
* 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 <at> web.de>
 ;;; Copyright © 2019 Chris Marusich <cmmarusich <at> gmail.com>
 ;;; Copyright © 2020 Marcin Karpezo <sirmacik <at> wioo.waw.pl>
+;;; Copyright © 2023 Nicolas Graves <ngraves <at> 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





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 18 Jun 2023 21:09:02 GMT) Full text and rfc822 format available.

Notification sent to Nicolas Graves <ngraves <at> ngraves.fr>:
bug acknowledged by developer. (Sun, 18 Jun 2023 21:09:02 GMT) Full text and rfc822 format available.

Message #10 received at 62567-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Nicolas Graves <ngraves <at> ngraves.fr>
Cc: 62567-done <at> debbugs.gnu.org
Subject: Re: bug#62567: [PATCH] gnu: libreoffice: Fix access to python modules.
Date: Sun, 18 Jun 2023 23:08:16 +0200
Hi,

Nicolas Graves <ngraves <at> ngraves.fr> skribis:

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

Finally applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 17 Jul 2023 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 277 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.