From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id mDQ8C98eqmEzgQAAgWs5BA (envelope-from ) for ; Fri, 03 Dec 2021 14:42:55 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id QF4KB98eqmEpcwAA1q6Kng (envelope-from ) for ; Fri, 03 Dec 2021 13:42:55 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BA9184BB6 for ; Fri, 3 Dec 2021 14:42:54 +0100 (CET) Received: from localhost ([::1]:45940 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mt8px-0002kA-SR for larch@yhetil.org; Fri, 03 Dec 2021 08:42:53 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mt8p8-0001W1-NG for guix-patches@gnu.org; Fri, 03 Dec 2021 08:42:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:38725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mt8p8-0007LG-FC for guix-patches@gnu.org; Fri, 03 Dec 2021 08:42:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mt8p8-00016Z-DU for guix-patches@gnu.org; Fri, 03 Dec 2021 08:42:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#52259] [PATCH 3/3] gnu: trytond: Ensure all modules are found. Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 03 Dec 2021 13:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 52259 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 52259@debbugs.gnu.org X-Debbugs-Original-To: 52259@debbugs.gnu.org, guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16385388864185 (code B ref -1); Fri, 03 Dec 2021 13:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Dec 2021 13:41:26 +0000 Received: from localhost ([127.0.0.1]:50270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mt8oX-00015R-TV for submit@debbugs.gnu.org; Fri, 03 Dec 2021 08:41:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:43090) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mt8oW-00015E-HW for submit@debbugs.gnu.org; Fri, 03 Dec 2021 08:41:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mt8oW-00087O-9t for guix-patches@gnu.org; Fri, 03 Dec 2021 08:41:24 -0500 Received: from mout.kundenserver.de ([217.72.192.75]:51429) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mt8oU-0005vZ-7h for guix-patches@gnu.org; Fri, 03 Dec 2021 08:41:24 -0500 Received: from hermia.goebel-consult.de ([79.211.191.200]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N1xZX-1mR3Ed3Ain-012Doc; Fri, 03 Dec 2021 14:41:10 +0100 Received: from lenashee.fritz.box (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id 5FAE766096; Fri, 3 Dec 2021 14:41:11 +0100 (CET) From: Hartmut Goebel Date: Fri, 3 Dec 2021 14:41:04 +0100 Message-Id: <0d461f73e5c687d1c53df55540d3248b38349414.1638538371.git.h.goebel@crazy-compilers.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <5fae975202b1a50b25270568def974822ca0ba98.1638538371.git.h.goebel@crazy-compilers.com> References: <5fae975202b1a50b25270568def974822ca0ba98.1638538371.git.h.goebel@crazy-compilers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:fbYBNL+a6+IjFVq/0+JbvHgovANGJ4fW/wkh55TfQ8unVFhCrkc knUPi6xtOfIlp5DRSlnRqmbx6uyd6gmRqdhYl+b0834bs3HlRa90u+aJP666yKJCORcDrz9 +sxDdgg4mGhlMLcE97Cb6OyMeKtGdK9gPuu9qeYNv0lpzFpICraAmogiUx5qwT2MuD7U+WE 9594dzKeZREOFmUASFaOw== X-UI-Out-Filterresults: notjunk:1;V03:K0:2IRbRwI5qkw=:wm4q1ZSqdMz34hGS0oGhjw ZAGZabJNvHOUTHmdE5OzKFT+hQSOwtx4Z4ZtALrTsX/Q98l10A1mPPEiKgEBpgLAZ4zV8Spe1 MXhaIaVoFQwGSMRqDakETn04UAGadnAFq0z5Y6mwxwyq49hMzVf/5b4oAvtEBl3b8XN7yvmB3 1Ln3ADnhXO9TxWcdkCJ1P4xeti9qPoiUXx9LUGPdP5VtpNLmOriEuwsgIbMn3GPhApx4OTC9c WwOgxxyu4FHY88AbbWV4J/RbasaA2WwPJJsBCj0tIByb6NJPzTiDgFITvqsxWz0bV812I4a/o rAHWogbf1WIthuDnAFH37hFSAs24GPXYhM9C2yu4OQD1z1rmB1UeV83o317xk9obK1muMgGn/ MVgAJOqHrFBXFY6z0SNjU/ejjcXlz+bdXJ56okfNmOJ83KhecswOu97LM2lSpvQtyfbceVKJo IIV4LC7bVUH3l+km7qBqQL8HSP5Al1i1e38tw6a6DztturJGNZ2mQOLyRpQ6gMqcu3J530K0z rrjahwNSiogHlVqjq2UZqVI3xfwlXngmItGrPtJuuvWA5fEu1FRm5e6tSK9VCKkOUkty6k2B/ oNTOVEuJEbz9idFHbsH6bM3WOgoLvKTNI3Ej7X/6j4v2BD3DLur4xXRxbFKit4bJ+yrT7+F0y l+5C7NsWH2J4yrgbElH45Uiv4wb1o5ReYzp12GUb4lx/CY484nSWUPGPQ2GGBQImFyakxVpSx 9YaJXkMBP+RAVje2 Received-SPF: none client-ip=217.72.192.75; envelope-from=h.goebel@crazy-compilers.com; helo=mout.kundenserver.de 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_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1638538974; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=IsZJ6ShsQGvLF4fCZpGu7MwVnKdKE6sJ5/MBCcWWnRw=; b=PA3vK2pyCBKaRfoesBzs1bBv2egM1kQhn+SwatvaCN6Oj8BNtbuCD6cArAi9JPB2aiftAR kRPuFDR+B5GhDiTEF7nM8CLuHWd21WOyxqug0Yj/sPtajvWhTGtRsNYlDrjysKFRfpMAIg xfQGZa+mi4zMTG/jZoh7AskNwl29duWd7vasdZEUcPrWl0c+WuAN9qCYSOxFKRgjZ6x+hj ljJp4u5azsx738XnaGrAT7bQlkK4uBE+VZBiU6vLLv9Go3oScqr7C05TMl/nW9aRoXab8X i4FmcMTf9iUPW4sBAZ39HiEjJJUm75wJ/dgvUJX5aAJ1I7vUNH8oM93d4m51Cw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1638538974; a=rsa-sha256; cv=none; b=lKhkh2zao78mv6STpYB6t3/E9+WVfEeCiqi3Bl7iO2wjT21VpgJD/HbEpdu5ySwh49AdNX 1Iu0C3ApZOqJwkCpb1UeUCxHX/kcax3nMOJ46c2ambZwrnmT8VzJGofXwCAmjHUDBfDRYx /LrqUgjceFTmdDGHefSMgVXw67332Yktq7/fYmoh9KRx23saUKKzSbVWmITaDv4GhSRGDz BY6LRCfBoMJRuhDI9XXF4LEA6BQSCygOQJERlnKiSIhF0PFPTtNxaIV/dCq46x47fwuq8I inYxDhVNBFAB5yyN8iix9p3iY7FqiWPOSKcOR1k6NXxtCvHxIaU9JZihNr4rPQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.12 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BA9184BB6 X-Spam-Score: -2.12 X-Migadu-Scanner: scn0.migadu.com X-TUID: lb8tOB46a+jd If the python package matching tryton is not installed alongside to trytond, PYTHONPATH ist not set (or pointing to a wring version) and trytond (and the trytond tools) would not find the trytond modules. This change introduces a new native-search-path GUIX_TRYTOND_MODULES_PATH. Trytond gets patched to honor this environment variable. Thanks to Maxim Cournoyer, who's code for guix-pythonpath-search-path was the template for guix-trytonpath-search-path. * gnu/packages/patches/trytond-add-guix_trytond_path.patch: New file. * gnu/local.mk: (dist_patch_DATA): Add it. * gnu/packages/tryton.scm (trytond): Use it. [native-search-paths]: New element. (guix-trytonpath-search-path): New function. --- gnu/local.mk | 1 + .../trytond-add-guix_trytond_path.patch | 26 +++++++++++++++++++ gnu/packages/tryton.scm | 19 +++++++++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/trytond-add-guix_trytond_path.patch diff --git a/gnu/local.mk b/gnu/local.mk index a8b9bcac21..cac9079325 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1817,6 +1817,7 @@ dist_patch_DATA = \ %D%/packages/patches/transcode-ffmpeg.patch \ %D%/packages/patches/transmission-honor-localedir.patch \ %D%/packages/patches/trytond-add-egg-modules-to-path.patch \ + %D%/packages/patches/trytond-add-guix_trytond_path.patch \ %D%/packages/patches/ttf2eot-cstddef.patch \ %D%/packages/patches/tup-unbundle-dependencies.patch \ %D%/packages/patches/tuxpaint-stamps-path.patch \ diff --git a/gnu/packages/patches/trytond-add-guix_trytond_path.patch b/gnu/packages/patches/trytond-add-guix_trytond_path.patch new file mode 100644 index 0000000000..7dc136ec46 --- /dev/null +++ b/gnu/packages/patches/trytond-add-guix_trytond_path.patch @@ -0,0 +1,26 @@ +Make trytond add all paths listed in GUIX_TRYTOND_MODULES_PATH to sys.path. + +*** a/trytond/modules/__init__.py 1970-01-01 01:00:01.000000000 +0100 +--- b/trytond/modules/__init__.py 2021-12-02 22:17:28.014612267 +0100 +*************** +*** 31,36 **** +--- 31,48 ---- + + EGG_MODULES = {} + ++ def __extend_python_path__(): ++ tryton_python_path = os.environ.get("GUIX_TRYTOND_MODULES_PATH") ++ if tryton_python_path: ++ paths = [path[:-16] # remove "/trytond/modules" ++ for path in tryton_python_path.split(os.pathsep)] ++ sys.path.extend(paths) ++ # ensure new paths are in the pkg_resources WorkingSet ++ import pkg_resources ++ list(map(pkg_resources.working_set.add_entry, paths)) ++ ++ __extend_python_path__() ++ + + def update_egg_modules(): + global EGG_MODULES +l diff --git a/gnu/packages/tryton.scm b/gnu/packages/tryton.scm index 212d6593ad..f8cd2b4c9d 100644 --- a/gnu/packages/tryton.scm +++ b/gnu/packages/tryton.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2020 Vinicius Monego ;;; Copyright © 2021 Maxime Devos ;;; Copyright © 2021 Hartmut Goebel +;;; Copyright © 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -39,6 +40,19 @@ #:use-module (guix utils) #:use-module (guix build-system python)) +(define (guix-trytonpath-search-path version) + "Generate a GUIX_TRYTOND_MODULES_PATH search path specification, using +VERSION. + +Do not use PYTHHONPATH not avoid interfering with any different Python package +installed in the same environments. Collecting only paths actually containing +/tryton/modules reduces the number of paths." + (search-path-specification (variable "GUIX_TRYTOND_MODULES_PATH") + (files (list (string-append + "lib/python" + (version-major+minor version) + "/site-packages/trytond/modules"))))) + (define-public trytond (package (name "trytond") @@ -49,7 +63,8 @@ (uri (pypi-uri "trytond" version)) (sha256 (base32 "1jp5cadqpwkcnml8r1hj6aak5kc8an2d5ai62p96x77nn0dp3ny4")) - (patches (search-patches "trytond-add-egg-modules-to-path.patch")))) + (patches (search-patches "trytond-add-egg-modules-to-path.patch" + "trytond-add-guix_trytond_path.patch")))) (build-system python-build-system) (propagated-inputs `(("python-dateutil" ,python-dateutil) @@ -66,6 +81,8 @@ (native-inputs `(("python-mock" ,python-mock) ("python-pillow" ,python-pillow))) + (native-search-paths + (list (guix-trytonpath-search-path (package-version python)))) (arguments `(#:phases (modify-phases %standard-phases -- 2.30.2