~ruther/guix-local

4d86f0a3126ddb8eb2678e3dcd264a342b6e8e78 — Hartmut Goebel 5 months ago ac647c3
gnu: trytond: Downgrade to 7.0.37 (latest LTS version).

Discussion <https://codeberg.org/guix/guix/issues/1438> resulted in the
decision to maintain the LTS version, which is 7.0.

* gnu/packages/tryton.scm(tryton): Downgrade to 7.0.37.
[arguments][#:phases][preperations]: Set DB_CACHE.
[propagated-inputs] Add python-psycopg2.
[native-inputs] Add python-html2text, remove python-wheel.
[native-search-paths] Add guix-pythonpath-search-path.
* gnu/packages/patches/trytond-add-guix_trytond_path.patch: Add modules in
GUIX_TRYTOND_MODULES_PATH directly to trytond.modules.__path__. Delete helper
function after it's done.

Change-Id: Ib2902c8e204467f08135885c793371105aeed7e5
3 files changed, 20 insertions(+), 21 deletions(-)

M gnu/local.mk
M gnu/packages/patches/trytond-add-guix_trytond_path.patch
M gnu/packages/tryton.scm
M gnu/local.mk => gnu/local.mk +1 -0
@@ 2369,6 2369,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/transcode-ffmpeg.patch	\
  %D%/packages/patches/transmission-4.0.6-fix-build.patch	\
  %D%/packages/patches/trytond-add-guix_trytond_path.patch	\
  %D%/packages/patches/trytond-hack-import.patch		\
  %D%/packages/patches/ttf2eot-cstddef.patch			\
  %D%/packages/patches/turbovnc-custom-paths.patch		\
  %D%/packages/patches/turbovnc-find-system-packages.patch	\

M gnu/packages/patches/trytond-add-guix_trytond_path.patch => gnu/packages/patches/trytond-add-guix_trytond_path.patch +8 -11
@@ 1,24 1,21 @@
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
*** a/trytond/modules/__init__.py
--- b/trytond/modules/__init__.py
***************
*** 31,36 ****
--- 31,48 ----
--- 31,45 ----
  
  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))
+     trytond_modules_path = os.environ.get("GUIX_TRYTOND_MODULES_PATH")
+     if trytond_modules_path:
+         # make tryton.module behave like a namespace package
+         __path__.extend(trytond_modules_path.split(os.pathsep))
+ 
+ __extend_python_path__()
+ del __extend_python_path__
+ 
  
  def update_egg_modules():

M gnu/packages/tryton.scm => gnu/packages/tryton.scm +11 -10
@@ 2,7 2,7 @@
;;; Copyright © 2017 Adriano Peluso <catonano@gmail.com>
;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2021,2024,2025 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2021 Maxim Cournoyer <maxim@guixotic.coop>
;;; Copyright © 2025 Ricardo Wurmus <rekado@elephly.net>
;;;


@@ 65,13 65,13 @@ installed in the same environments.  Collecting only paths actually containing
(define-public trytond
  (package
    (name "trytond")
    (version "7.4.4")
    (version "7.0.37")
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "trytond" version))
       (sha256
        (base32 "1bwa631qz07k6s5fbki3ph6sx0ch9yss2q4sa1jb67z6angiwv5f"))
        (base32 "1i51yd5kvmcny5k36pj0l3rblyig9zxv5pvvln9c2xq2nkndqqr6"))
       (patches (search-patches "trytond-add-guix_trytond_path.patch"))))
    (build-system pyproject-build-system)
    (arguments


@@ 88,6 88,7 @@ installed in the same environments.  Collecting only paths actually containing
         (add-before 'check 'preparations
           (lambda _
             (setenv "DB_NAME" ":memory:")
             (setenv "DB_CACHE" "/tmp")
             (setenv "HOME" "/tmp"))))))
    (propagated-inputs
     (list python-dateutil


@@ 96,18 97,18 @@ installed in the same environments.  Collecting only paths actually containing
           python-lxml
           python-passlib
           python-polib
           python-psycopg2
           python-relatorio
           python-sql
           python-werkzeug))
    (native-inputs
     (list python-pillow
           python-pydot
           python-pytest
           python-setuptools
           python-wheel
           tzdata-for-tests))
     (list python-html2text python-pillow python-pydot python-pytest
           python-setuptools tzdata-for-tests))
    (native-search-paths
     (list (guix-trytonpath-search-path (package-version python))))
     (list (guix-trytonpath-search-path (package-version python))
           ;; Required to pick up entry-points from profile for Tryton modules
           ;; which are not in named 'trytond.modules.…'
           (guix-pythonpath-search-path (package-version python))))
    (home-page "https://www.tryton.org/")
    (synopsis "Tryton Server")
    (description "Tryton is a three-tier high-level general purpose