[PATCH] gnu: gnucash: Enable python bindings.

DoneSubmitted by Prafulla Giri.
Details
2 participants
  • Marius Bakke
  • Prafulla Giri
Owner
unassigned
Severity
normal
P
P
Prafulla Giri wrote on 29 Oct 2020 16:29
(address . guix-patches@gnu.org)
CAFw+=j2NSyb3YywVU1t4JtPF-Y9JBoLjW-m5cqHQ9VEpuO+i0w@mail.gmail.com
Esteemed maintainers,
Attached is a patch that enables python bindings in gnucash.
I have also taken the liberty of adding native-search-paths field andadding 'PYTHONPATH' to it for foreign distro users who might want to usegnucash python bindings with host-os-supplied python.
Thanks!
Attachment: file
From a7ea4f9743441219940442be188238e363c4943f Mon Sep 17 00:00:00 2001From: Prafulla Giri <pratheblackdiamond@gmail.com>Date: Thu, 29 Oct 2020 20:47:37 +0545Subject: [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(+)
Toggle diff (55 lines)diff --git a/gnu/packages/gnucash.scm b/gnu/packages/gnucash.scmindex 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
P
P
Prafulla Giri wrote on 1 Nov 2020 05:44
Further Cleanups
(address . 44309@debbugs.gnu.org)
CAFw+=j1SZSf6F-bp2wqFe3oWrZBN-=82zArWRYEs1qf86HpA+g@mail.gmail.com
I am wondering if the python bindings should be separated into an output.gnucash:python perhaps. That is the route that the Ubuntu developers seemto have taken. `apt show python3-gnucash`. It would actually make even moresense with guix as one could use flatpak-installed gnucash for their dailyusage, and then from their /usr/bin/python3 or $GUIX_PROFILE/bin/python3they could use gnucash programmatically via the bindings.
However, I am not sure if it is possible to specify asearch-path-specification for a particular output of a package. I don'tknow much about splitting packages into outputs either. If we hadgnucash:python, and a user ran `guix install gnucash:python`, would thatonly get the user /gnu/store/...-gnucash-x.y-python from the substituteserver and save them bandwidth?
If anybody is willing to give me some pointers as to how I could go aboutcleanly splitting gnucash into gnucash:python - with thenative-search-path-specification for PYTHONPATH only being declared forgnucash:python (and that will be an absolute must), I am more than happy toclean this patch up.
Thank you.
Attachment: file
P
P
Prafulla Giri wrote on 2 Nov 2020 14:52
New and Improved Patch
(address . 44309@debbugs.gnu.org)
CAFw+=j2OPcgYo=0qve4URhUtCkOM3oGSiZV2sLs0bU7pbsXWnw@mail.gmail.com
Esteemed maintainers,
Attached is an updated version of the patch.
I have removed the native-search-paths specification of PYTHONPATH. I havealso created a new output "python" that contains the python bindings. A newphasehas been added that splits the python bindings into it's own separateoutput. With that, users who only want to use gnucash programmatically canuse it with `guix environment --ad-hoc python gnucash:python`.
Please do let me know if there are any further corrections that I can make.Thank you.
Attachment: file
From a7fc9565e89bd76e821dcf9df7d783bd5a9dcb51 Mon Sep 17 00:00:00 2001From: Prafulla Giri <pratheblackdiamond@gmail.com>Date: Thu, 29 Oct 2020 20:47:37 +0545Subject: [PATCH] gnu: gnucash: Enable python bindings.
* gnu/packages/gnucash.scm (gnucash): [inputs]: Add python. [outputs]: Add new output 'python' for python bindings. [arguments]<configure-flags>: Add '-DWITH_PYTHON=ON' [arguments]: Add new build phase 'split-python-bindings'--- gnu/packages/gnucash.scm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
Toggle diff (63 lines)diff --git a/gnu/packages/gnucash.scm b/gnu/packages/gnucash.scmindex 8f58ce332a..525a2c53b8 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)))@@ -95,9 +98,10 @@ (propagated-inputs ;; dconf is required at runtime according to README.dependencies. `(("dconf" ,dconf)))- (outputs '("out" "doc" "debug"))+ (outputs '("out" "doc" "debug" "python")) (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:)@@ -149,6 +153,20 @@ (symlink (string-append docs "/share/gnome") (string-append doc-output "/share/gnome")) #t)))+ (add-after 'install 'split-python-bindings+ (lambda* (#:key inputs outputs #:allow-other-keys)+ (let* ((out (assoc-ref outputs "out"))+ (python-output (assoc-ref outputs "python"))+ (python-bindings (string-append+ "lib/python"+ ,(version-major+minor+ (package-version python)))))+ (mkdir-p (string-append python-output "/" python-bindings))+ (copy-recursively+ (string-append out "/" python-bindings)+ (string-append python-output "/" python-bindings))+ (delete-file-recursively+ (string-append out "/" python-bindings))))) (add-after 'install-docs 'wrap-programs (lambda* (#:key inputs outputs #:allow-other-keys) (for-each (lambda (prog)-- 2.28.0
M
M
Marius Bakke wrote on 10 Nov 2020 22:10
87k0usdijq.fsf@gnu.org
Prafulla Giri <pratheblackdiamond@gmail.com> writes:
Toggle quote (13 lines)> Esteemed maintainers,>> Attached is an updated version of the patch.>> I have removed the native-search-paths specification of PYTHONPATH. I have> also created a new output "python" that contains the python bindings. A new> phase> has been added that splits the python bindings into it's own separate> output. With that, users who only want to use gnucash programmatically can> use it with `guix environment --ad-hoc python gnucash:python`.>> Please do let me know if there are any further corrections that I can make.
Looks great to me. Applied, thanks!
-----BEGIN PGP SIGNATURE-----
iQFDBAEBCgAtFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAl+rAdkPHG1hcml1c0BnbnUub3JnAAoJEKKgbfKjOlT68R4H/RnXp2E0VLKcPSAZDelNjUiO3wgNTcLq+GJzIZvQhnxx4mwSS357PUcmsbmtENm0uNtFQxCrpx55ZSc1H2T8CsRdaxFsna86ThfFQpVXtEbzVX+3uAle5WPuWgQqmT0PxzKAems2x5jfi4iNov5YziI645OQPbx4COhtsWdeO9AMYUzsL0pzRa95z1wqobovGCFeFO3knCOkcZhGucdRoo2lacryWbcjhtPoDXyXe/bJJ/MfFzHkxadF2Ozk2rkhXV5rbVUKTfy7JZrBv1opHMQFDmQJ44f2b+m7SGOQkQXH8o7ttt56t3FIi/WsmRT1ZLI/tDza2K025aM/+Jom5dA==zrvi-----END PGP SIGNATURE-----
Closed
P
P
Prafulla Giri wrote on 11 Nov 2020 10:26
(name . Marius Bakke)(address . marius@gnu.org)(address . 44309-done@debbugs.gnu.org)
CAFw+=j28XzfF=VRWwK68D_qOvqXXjns0hfFgKHKKO3=G7v2DZw@mail.gmail.com
Thank you!
On Wed, Nov 11, 2020 at 2:55 AM Marius Bakke <marius@gnu.org> wrote:
Toggle quote (21 lines)> Prafulla Giri <pratheblackdiamond@gmail.com> writes:>> > Esteemed maintainers,> >> > Attached is an updated version of the patch.> >> > I have removed the native-search-paths specification of PYTHONPATH. I> have> > also created a new output "python" that contains the python bindings. A> new> > phase> > has been added that splits the python bindings into it's own separate> > output. With that, users who only want to use gnucash programmatically> can> > use it with `guix environment --ad-hoc python gnucash:python`.> >> > Please do let me know if there are any further corrections that I can> make.>> Looks great to me. Applied, thanks!>
Attachment: file
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 44309@debbugs.gnu.org