From patchwork Fri Mar 31 10:09:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicolas Graves X-Patchwork-Id: 48848 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id D4C3E172B9; Fri, 31 Mar 2023 11:10:26 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DBB7F172B1 for ; Fri, 31 Mar 2023 11:10:25 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1piBhr-0006bM-Rw; Fri, 31 Mar 2023 06:10:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piBhq-0006aw-GE for guix-patches@gnu.org; Fri, 31 Mar 2023 06:10:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1piBhq-0003w1-7b for guix-patches@gnu.org; Fri, 31 Mar 2023 06:10:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1piBhp-0000m0-KQ for guix-patches@gnu.org; Fri, 31 Mar 2023 06:10:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62567] [PATCH] gnu: libreoffice: Fix access to python modules. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 31 Mar 2023 10:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62567 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62567@debbugs.gnu.org Cc: ngraves@ngraves.fr X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16802573542854 (code B ref -1); Fri, 31 Mar 2023 10:10:01 +0000 Received: (at submit) by debbugs.gnu.org; 31 Mar 2023 10:09:14 +0000 Received: from localhost ([127.0.0.1]:60413 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1piBh3-0000jy-Ic for submit@debbugs.gnu.org; Fri, 31 Mar 2023 06:09:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:33212) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1piBh0-0000jm-Vx for submit@debbugs.gnu.org; Fri, 31 Mar 2023 06:09:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piBh0-0006NF-Ix for guix-patches@gnu.org; Fri, 31 Mar 2023 06:09:10 -0400 Received: from 2.mo582.mail-out.ovh.net ([46.105.76.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1piBgy-0003pb-OE for guix-patches@gnu.org; Fri, 31 Mar 2023 06:09:10 -0400 Received: from director2.ghost.mail-out.ovh.net (unknown [10.108.1.191]) by mo582.mail-out.ovh.net (Postfix) with ESMTP id 3667A262A7 for ; Fri, 31 Mar 2023 10:09:04 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-pz96z (unknown [10.110.208.181]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id C3D4D1FE54; Fri, 31 Mar 2023 10:09:03 +0000 (UTC) Received: from ngraves.fr ([37.59.142.97]) by ghost-submission-6684bf9d7b-pz96z with ESMTPSA id GFajLD+xJmQUmQAAoqrwCg (envelope-from ); Fri, 31 Mar 2023 10:09:03 +0000 Authentication-Results: garm.ovh; auth=pass (GARM-97G002eef9004e-42c7-4c37-8a20-ea167a8cec75, 6EDB0577B4A4070ED54A7D4BC3C99A904D58EC0F) smtp.auth=ngraves@ngraves.fr X-OVh-ClientIp: 81.67.140.142 Date: Fri, 31 Mar 2023 12:09:01 +0200 Message-Id: <20230331100902.3866-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 12772208546386076386 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeiuddgvdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeehteeijeejuefgvdfgieffueeftddvhfeltddvuddvvdffiedtkefgiefhvdffudenucffohhmrghinhepshhunhdrshhtrghrnecukfhppeduvdejrddtrddtrddupdekuddrieejrddugedtrddugedvpdefjedrheelrddugedvrdeljeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepoehnghhrrghvvghssehnghhrrghvvghsrdhfrheqpdhnsggprhgtphhtthhopedupdhrtghpthhtohepghhuihigqdhprghttghhvghssehgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkedvpdhmohguvgepshhmthhpohhuth Received-SPF: pass client-ip=46.105.76.65; envelope-from=ngraves@ngraves.fr; helo=2.mo582.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches X-Patchwork-Original-From: Nicolas Graves via Guix-patches via From: Nicolas Graves Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2019 Chris Marusich ;;; Copyright © 2020 Marcin Karpezo +;;; Copyright © 2023 Nicolas Graves ;;; ;;; 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"