From d4ecdc3328d998c787cbdad6d02e1a74d2fc7ac4 Mon Sep 17 00:00:00 2001 From: Hartmut Goebel Date: Thu, 2 Dec 2021 23:20:22 +0100 Subject: gnu: trytond: Ensure all modules are found. If the python package matching trytond is not installed alongside to trytond, PYTHONPATH is not set (or pointing to a wrong 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, whose 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/packages/tryton.scm | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'gnu/packages/tryton.scm') diff --git a/gnu/packages/tryton.scm b/gnu/packages/tryton.scm index 0bd5ffcd5b..af8f2f0ab3 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 @@ (define-module (gnu packages tryton) #: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 @@ (define-public trytond (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 (list python-dateutil @@ -65,6 +80,8 @@ (define-public trytond python-wrapt)) (native-inputs (list python-mock python-pillow)) + (native-search-paths + (list (guix-trytonpath-search-path (package-version python)))) (arguments `(#:phases (modify-phases %standard-phases -- cgit v1.2.3