Subject: [bug#50295] [PATCH 4/6] gnu: tryton modules: Unify native-inputs.

From: Hartmut Goebel <[email-masked]>
Date: Tue, 31 Aug 2021 10:49:36 +0200

For testing, the tryton modules require a common set of native-input, which
basically are the propagated-inputs of `trytond`. (Some modules leave out one
or two of these, but most modules require all.) So to avoid redundant code,
use a variable for defining this common set. This reduces the maintenance
burden when more trytond modules are added.

* gnu/packages/tryton.scm (%standard-trytond-native-inputs): New variable.
  (trytond-account, trytond-account-invoice, trytond-account-invoice-stock,
  trytond-account-product, trytond-analytic-account, trytond-company,
  trytond-country, trytond-currency, trytond-party, trytond-product,
  trytond-purchase, trytond-purchase-request, trytond-stock, trytond-stock-lot,
  trytond-stock-supply)[native-inputs]: Use it.

native-inouts2
---
 gnu/packages/tryton.scm | 198 ++++++----------------------------------
 1 file changed, 30 insertions(+), 168 deletions(-)

diff --git a/gnu/packages/tryton.scm b/gnu/packages/tryton.scm
index d7f03e9181..d9acc671e1 100644
--- a/gnu/packages/tryton.scm
+++ b/gnu/packages/tryton.scm
@@ -171,6 +171,20 @@ the build system."
 ;;;  Tryton modules - please sort alphabetically
 ;;;
 
+(define %standard-trytond-native-inputs
+  ;; native-inputs required by most of the tryton module for running the test
+  `(("python-dateutil" ,python-dateutil)
+    ("python-genshi" ,python-genshi)
+    ("python-lxml" ,python-lxml)
+    ("python-magic" ,python-magic)
+    ("python-passlib" ,python-passlib)
+    ("python-polib" ,python-polib)
+    ("python-proteus" ,python-proteus)
+    ("python-relatorio" ,python-relatorio)
+    ("python-sql" ,python-sql)
+    ("python-werkzeug" ,python-werkzeug)
+    ("python-wrapt" ,python-wrapt)))
+
 (define-public trytond-account
   (package
     (name "trytond-account")
@@ -183,16 +197,7 @@ the build system."
         (base32 "16ny67vcnxk9ngcxd56cfixm441vs9jxv3apmb16xsi47yk2xd7w"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "account"))
-    (native-inputs
-     `(("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-dateutil" ,python-dateutil)
        ("python-simpleeval" ,python-simpleeval)
@@ -223,16 +228,7 @@ most of accounting needs.")
         (base32 "0drccambg6855p7ai8654c7f9v85jzwicwpxmagyrr09qz6qzgcz"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "account_invoice"))
-    (native-inputs
-     `(("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-dateutil" ,python-dateutil)
        ("python-sql" ,python-sql)
@@ -267,18 +263,7 @@ term.")
         (base32 "02m6ikcc38ac41ddzg5xp5l9jz0k6j7j1g2xa62ki4v093yn4z5v"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "account_invoice_stock"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-sql" ,python-sql)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("trytond" ,trytond)
        ("trytond-account-invoice" ,trytond-account-invoice)
@@ -308,18 +293,7 @@ average price of the posted invoice lines that are linked to it.")
         (base32 "10bpbkkmllbh9lm5ajydmc5nvqm9bbdn9rmm03jqgik23s5kyx2z"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "account_product"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-sql" ,python-sql)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("trytond" ,trytond)
        ("trytond-account" ,trytond-account)
@@ -348,17 +322,7 @@ and category.")
         (base32 "10rn2rf1ji7d1gxmgca368yvabql1ahklqg7p8sh5bl79vn5qx5x"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "analytic_account"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-sql" ,python-sql)
        ("trytond" ,trytond)
@@ -389,18 +353,7 @@ required to analyse accounting using multiple different axes.")
         (base32 "1bwy2rkgfw32cwhq5fh3rpy7bx425h44ap10i9kjx5ak86bfnpz9"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "company"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-sql" ,python-sql)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("trytond" ,trytond)
        ("trytond-currency" ,trytond-currency)
@@ -428,18 +381,7 @@ company and employee and extend the user model.")
     (build-system python-build-system)
     ;; Doctest contains one test that requires internet access.
     (arguments (tryton-arguments "country" "--no-doctest"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-sql" ,python-sql)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-pycountry" ,python-pycountry)
        ("trytond" ,trytond)))
@@ -465,18 +407,9 @@ company and employee and extend the user model.")
     (build-system python-build-system)
     (arguments (tryton-arguments "currency"))
     (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
+     `(,@%standard-trytond-native-inputs
        ("python-forex-python" ,python-forex-python)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-pycountry" ,python-pycountry)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+       ("python-pycountry" ,python-pycountry)))
     (propagated-inputs
      `(("python-sql" ,python-sql)
        ("trytond" ,trytond)))
@@ -503,17 +436,7 @@ currency and rate.")
     (build-system python-build-system)
     ;; Doctest 'scenario_party_phone_number.rst' fails.
     (arguments (tryton-arguments "party" "--no-doctest"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-sql" ,python-sql)
        ("python-stnum" ,python-stdnum)
@@ -541,17 +464,7 @@ addresses.")
         (base32 "0x18ngpjyrdwjwg17bz98jph4jv5gcv0qc0p2kxpam4lqsy34ic2"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "product"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-sql" ,python-sql)
        ("python-stdnum" ,python-stdnum)
@@ -579,17 +492,7 @@ Template and Product.")
         (base32 "0na74zijj46b12gypy9si3las02a96rh5ygl503c7razha61g1b0"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "purchase"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-sql" ,python-sql)
        ("trytond" ,trytond)
@@ -624,18 +527,7 @@ Template and Product.")
     (build-system python-build-system)
     ;; Doctest 'scenario_purchase_request.rst' fails.
     (arguments (tryton-arguments "purchase_request" "--no-doctest"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-sql" ,python-sql)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("trytond" ,trytond)
        ("trytond-product" ,trytond-product)
@@ -664,16 +556,7 @@ generated by other process from Tryton.")
         (base32 "0yb8kd3alwqkivrlpx0ni4jxv3x14i37lmwism9yi81xwchyrcjk"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "stock"))
-    (native-inputs
-     `(("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-simpleeval" ,python-simpleeval)
        ("python-sql" ,python-sql)
@@ -706,18 +589,7 @@ inventory to control and update stock levels.")
         (base32 "0w2f62cfzm7j8wnw8igmjslpxc1a8s82dkdizyvim5qhjg6mrsym"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "stock_lot"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-sql" ,python-sql)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("trytond" ,trytond)
        ("trytond-product" ,trytond-product)
@@ -743,17 +615,7 @@ inventory to control and update stock levels.")
         (base32 "01cgpxlznldrba79a3xmj4d0csyfc3ccgs66c490j8v8rdnqpbww"))))
     (build-system python-build-system)
     (arguments (tryton-arguments "stock_supply"))
-    (native-inputs
-     `(("python-dateutil" ,python-dateutil)
-       ("python-genshi" ,python-genshi)
-       ("python-lxml" ,python-lxml)
-       ("python-magic" ,python-magic)
-       ("python-passlib" ,python-passlib)
-       ("python-polib" ,python-polib)
-       ("python-proteus" ,python-proteus)
-       ("python-relatorio" ,python-relatorio)
-       ("python-werkzeug" ,python-werkzeug)
-       ("python-wrapt" ,python-wrapt)))
+    (native-inputs `(,@%standard-trytond-native-inputs))
     (propagated-inputs
      `(("python-sql" ,python-sql)
        ("trytond" ,trytond)
-- 
2.30.2