Subject: [PATCH] gnu: gnucash: Enable python bindings.

From: Prafulla Giri <[email-masked]>
Date: Thu, 29 Oct 2020 21:14:00 +0545

Esteemed maintainers,

Attached is a patch that enables python bindings in gnucash.

I have also taken the liberty of adding native-search-paths field and
adding 'PYTHONPATH' to it for foreign distro users who might want to use
gnucash python bindings with host-os-supplied python.

Thanks!
From a7ea4f9743441219940442be188238e363c4943f Mon Sep 17 00:00:00 2001
From: Prafulla Giri <[email-masked]>
Date: Thu, 29 Oct 2020 20:47:37 +0545
Subject: [PATCH] gnu: gnucash: Enable python bindings.

* gnu/packages/gnucash.scm (gnucash):
  [inputs]: Add python.
  [arguments]<configure-flags>: Add '-DWITH_PYTHON=ON'
  [native-search-paths]: New field. Add PYTHONPATH.
---
 gnu/packages/gnucash.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/packages/gnucash.scm b/gnu/packages/gnucash.scm
index 8f58ce332a..d5a356ab54 100644
--- a/gnu/packages/gnucash.scm
+++ b/gnu/packages/gnucash.scm
@@ -24,6 +24,7 @@
 
 (define-module (gnu packages gnucash)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
@@ -48,6 +49,7 @@
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages web)
   #:use-module (gnu packages webkit)
@@ -82,6 +84,7 @@
        ("libxslt" ,libxslt)
        ("webkitgtk" ,webkitgtk)
        ("aqbanking" ,aqbanking)
+       ("python" ,python)
        ("perl-date-manip" ,perl-date-manip)
        ("perl-finance-quote" ,perl-finance-quote)
        ("tzdata" ,tzdata-for-tests)))
@@ -98,6 +101,7 @@
     (outputs '("out" "doc" "debug"))
     (arguments
      `(#:test-target "check"
+       #:configure-flags '("-DWITH_PYTHON=ON")
        #:make-flags '("GUILE_AUTO_COMPILE=0")
        #:modules ((guix build cmake-build-system)
                   ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
@@ -184,6 +188,16 @@
            (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
          (add-after 'install 'glib-or-gtk-wrap
            (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
+    ;; Export 'PYTHONPATH' for foreign-distro users who might want to
+    ;; use gnucash python bindings with their host-os-supplied python
+    (native-search-paths
+     (list
+      (search-path-specification
+       (variable "PYTHONPATH")
+       (files `(,(string-append "lib/python"
+                                (version-major+minor
+                                 (package-version python))
+                                "/site-packages"))))))
     (home-page "https://www.gnucash.org/")
     (synopsis "Personal and small business financial accounting software")
     (description
-- 
2.28.0