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. --- .../patches/trytond-add-guix_trytond_path.patch | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 gnu/packages/patches/trytond-add-guix_trytond_path.patch (limited to 'gnu/packages/patches') 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 -- cgit v1.2.3