projects/guix·blob python-team · refs

374 lines · 15.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015, 2016, 2018 Ricardo Wurmus <[email protected]>
3;;; Copyright © 2015 Eric Bavier <[email protected]>
4;;; Copyright © 2016, 2024 Efraim Flashner <[email protected]>
5;;; Copyright © 2017 Chris Marusich <[email protected]>
6;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2019, 2022, 2023, 2026 Maxim Cournoyer <[email protected]>
8;;; Copyright © 2019, 2021 Guillaume Le Vaillant <[email protected]>
9;;; Copyright © 2020 Prafulla Giri <[email protected]>
10;;; Copyright © 2020 Christopher Lam <[email protected]>
11;;; Copyright © 2023, 2024, 2026 gemmaro <[email protected]>
12;;; Copyright © 2025 Hartmut Goebel <[email protected]>
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29(define-module (gnu packages gnucash)
30 #:use-module ((guix licenses) #:prefix license:)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bash)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages cmake)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages docbook)
39 #:use-module (gnu packages documentation)
40 #:use-module (gnu packages finance)
41 #:use-module (gnu packages gettext)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gnome)
44 #:use-module (gnu packages gnupg)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages guile)
47 #:use-module (gnu packages icu4c)
48 #:use-module (gnu packages multiprecision)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages swig)
53 #:use-module (gnu packages tls)
54 #:use-module (gnu packages web)
55 #:use-module (gnu packages webkit)
56 #:use-module (gnu packages xml)
57 #:use-module (gnu packages)
58 #:use-module (guix build-system cmake)
59 #:use-module (guix build-system gnu)
60 #:use-module (guix download)
61 #:use-module (guix git-download)
62 #:use-module (guix gexp)
63 #:use-module (guix packages)
64 #:use-module (guix utils))
65
66(define-public gnucash
67 ;; TODO: Unbundle libraries such as guile-json found under the "borrowed/"
68 ;; directory.
69 (package
70 (name "gnucash")
71 (version "5.17")
72 (source
73 (origin
74 ;; Install from git, as the some test files contained in the release
75 ;; appear to corrupted, causing test failures.
76 (method git-fetch)
77 (uri (git-reference
78 (url "https://github.com/Gnucash/gnucash")
79 (commit version)))
80 (file-name (git-file-name name version))
81 (sha256
82 (base32
83 "10w5a81kzsw166fhxv2ycf1dmc5gcynyynxjghv6zknrfyss9xmg"))))
84 (outputs '("out" "doc" "debug" "python"))
85 (build-system cmake-build-system)
86 (arguments
87 (list
88 #:configure-flags #~(list "-DWITH_PYTHON=ON")
89 #:make-flags #~(list "GUILE_AUTO_COMPILE=0")
90 #:imported-modules `(,@%default-gnu-imported-modules
91 (guix build cmake-build-system)
92 (guix build glib-or-gtk-build-system))
93 #:modules '((guix build cmake-build-system)
94 ((guix build gnu-build-system) #:prefix gnu:)
95 ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
96 (guix build utils))
97 #:phases
98 #~(modify-phases %standard-phases
99 (add-after 'unpack 'remove-changelog-from-install-target
100 (lambda _
101 ;; We are building from git, but without the metadata, so the
102 ;; build system assumes we build from a tarball containing a
103 ;; pre-generated ChangeLog file.
104 (substitute* "CMakeLists.txt"
105 ((".*install.*CMAKE_SOURCE_DIR.*") ""))))
106 (add-after 'unpack 'disable-online-test
107 (lambda _
108 (call-with-output-file "libgnucash/app-utils/test/CMakeLists.txt"
109 (lambda (port)
110 (display "set(CTEST_CUSTOM_TESTS_IGNORE \
111online_wiggle test-lots)" port)))))
112 (add-after 'unpack 'set-env-vars
113 (lambda* (#:key inputs #:allow-other-keys)
114 ;; At least one test is time-related and requires this
115 ;; environment variable.
116 (setenv "TZDIR" (search-input-directory inputs "share/zoneinfo"))
117 (substitute* "CMakeLists.txt"
118 (("set\\(SHELL /bin/bash\\)")
119 (string-append "set(SHELL " (which "bash") ")")))))
120 (add-after 'unpack 'set-perl-path
121 (lambda _
122 (substitute* "libgnucash/app-utils/gnc-quotes.cpp"
123 (("c_cmd\\{bp::search_path\\(\"perl\"\\)\\}")
124 (format #f "c_cmd{~s}" #$(file-append perl "/bin/perl"))))))
125 ;; The qof test requires the en_US, en_GB, and fr_FR locales.
126 (add-before 'check 'install-locales
127 (lambda _
128 (setenv "LOCPATH" (getcwd))
129 (invoke "localedef" "-i" "en_US" "-f" "UTF-8" "./en_US.UTF-8")
130 (invoke "localedef" "-i" "en_GB" "-f" "UTF-8" "./en_GB.UTF-8")
131 (invoke "localedef" "-i" "fr_FR" "-f" "UTF-8" "./fr_FR.UTF-8")))
132 (add-before 'check 'set-GNC_DBD_DIR
133 (lambda* (#:key inputs #:allow-other-keys)
134 ;; Otherwise, some tests fail with SIGTRAP errors.
135 (setenv "GNC_DBD_DIR"
136 (search-input-directory inputs "lib/dbd"))))
137 (replace 'check (assoc-ref gnu:%standard-phases 'check))
138 ;; There is about 100 MiB of documentation.
139 (add-after 'install 'install-docs
140 (lambda _
141 (mkdir-p (string-append #$output:doc "/share"))
142 (symlink (string-append
143 #$(this-package-native-input "gnucash-docs")
144 "/share/help")
145 (string-append #$output:doc "/share/help"))))
146 (add-after 'install 'split-python-bindings
147 (lambda _
148 (let ((python-bindings (string-append
149 "lib/python"
150 #$(version-major+minor
151 (package-version python)))))
152 (mkdir-p (string-append #$output:python "/" python-bindings))
153 (copy-recursively
154 (string-append #$output "/" python-bindings)
155 (string-append #$output:python "/" python-bindings))
156 (delete-file-recursively
157 (string-append #$output "/" python-bindings)))))
158 (add-after 'install-docs 'wrap-programs
159 (lambda* (#:key inputs outputs #:allow-other-keys)
160 (for-each
161 (lambda (prog)
162 (wrap-program (search-input-file
163 outputs (string-append "bin/" prog))
164 `("GNC_DBD_DIR" =
165 (,(search-input-directory inputs "lib/dbd")))
166 `("PERL5LIB" ":" prefix
167 ,(map (lambda (o)
168 (string-append o "/lib/perl5/site_perl/"
169 #$(package-version perl)))
170 (list
171 #$@(transitive-input-references
172 'inputs
173 (map (lambda (l)
174 (assoc l (package-inputs this-package)))
175 '("perl-json-parse"
176 "perl-finance-quote"))))))))
177 '("gnucash"
178 "gnucash-cli"))))
179 (add-after 'install 'glib-or-gtk-compile-schemas
180 (assoc-ref glib-or-gtk:%standard-phases
181 'glib-or-gtk-compile-schemas))
182 (add-after 'install 'glib-or-gtk-wrap
183 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
184 (add-before 'glib-or-gtk-wrap 'delete-gnc-fq-update
185 (lambda _
186 ;; We are not updating Finance::Quote from CPAN. There is no
187 ;; reason to install this binary.
188 (delete-file (string-append #$output "/bin/gnc-fq-update"))))
189 (add-after 'glib-or-gtk-wrap 'unwrap-some
190 (lambda _
191 (for-each
192 (lambda (prog)
193 (delete-file (string-append #$output "/bin/" prog))
194 (rename-file (string-append #$output "/bin/." prog "-real")
195 (string-append #$output "/bin/" prog)))
196 ;; Sadly glib-or-gtk-wrap does not allow excluding individual
197 ;; files. Being wrapped breaks the finance-quote-wrapper (it
198 ;; is expected to be a perl script, not a shell one).
199 '("finance-quote-wrapper")))))))
200 (native-inputs
201 (list gmp
202 `(,glib "bin") ;glib-compile-schemas, etc.
203 gnucash-docs
204 googletest
205 intltool
206 (libc-utf8-locales-for-target)
207 pkg-config
208 swig-4.4
209 tzdata-for-tests))
210 (inputs
211 (list aqbanking
212 bash-minimal
213 boost
214 glib
215 gtk+
216 guile-3.0
217 icu4c
218 libdbi
219 libdbi-drivers
220 libofx
221 libxml2
222 libxslt
223 perl-finance-quote
224 perl-json
225 perl-json-parse
226 python
227 webkitgtk-for-gtk3))
228 (propagated-inputs
229 ;; dconf is required at runtime according to README.dependencies.
230 (list dconf))
231 (home-page "https://www.gnucash.org/")
232 (synopsis "Personal and small business financial accounting software")
233 (description
234 "GnuCash is personal and professional financial-accounting software.
235It can be used to track bank accounts, stocks, income and expenses, based on
236the double-entry accounting practice. It includes support for QIF/OFX/HBCI
237import and transaction matching. It also automates several tasks, such as
238financial calculations or scheduled transactions.
239
240To make the GnuCash documentation available, its doc output must be
241installed as well as Yelp, the Gnome help browser.")
242 (license license:gpl3+)))
243
244;; This package is not public, since we use it to build the "doc" output of
245;; the gnucash package (see above). It would be confusing if it were public.
246(define-public gnucash-docs
247 (let ((revision "")) ;set to the empty string when no revision
248 (package
249 (name "gnucash-docs")
250 (version (package-version gnucash))
251 (source
252 (origin
253 (method url-fetch)
254 ;; Fetch the releases from Github as Sourceforge is unreliable.
255 (uri (string-append
256 "https://github.com/Gnucash/gnucash/releases/download/"
257 version "/gnucash-docs-" version ".tar.gz"))
258 (sha256
259 (base32 "169ncc1cxq9ys2bghbw6lckvam3zbvs5fcn42ka9ldr4gsxklb5h"))))
260 (build-system cmake-build-system)
261 ;; These are native-inputs because they are only required for building the
262 ;; documentation.
263 (native-inputs
264 ;; The "check" target needs docbook-xml package to validate the DocBook
265 ;; XML during the tests.
266 (list docbook-xml
267 docbook-xsl
268 libxml2
269 libxslt))
270 (arguments
271 `(#:tests? #f)) ;no test target
272 (home-page "https://www.gnucash.org/")
273 (synopsis "Documentation for GnuCash")
274 (description
275 "User guide and other documentation for GnuCash in various languages.
276This package exists because the GnuCash project maintains its documentation in
277an entirely separate package from the actual GnuCash program. It is intended
278to be read using the GNOME Yelp program.")
279 (properties '((hidden? . #t))) ;meant to be an input to 'gnucash'
280 (license (list license:fdl1.1+ license:gpl3+)))))
281
282(define-public gwenhywfar
283 (package
284 (name "gwenhywfar")
285 (version "5.14.1")
286 (source
287 (origin
288 (method git-fetch)
289 (uri (git-reference
290 (url "https://git.aquamaniac.de/git/gwenhywfar")
291 (commit version)))
292 (sha256
293 (base32
294 "0p0fzi69jsr3flpr10s8gbl9i265x5j5k1q2i5yva2vsdx2j2878"))
295 (file-name (git-file-name name version))))
296 (build-system gnu-build-system)
297 (arguments
298 (list
299 #:configure-flags
300 #~(list "--disable-network-checks"
301 ;; GTK+3, GTK+2, Qt4, Qt5 and Qt6 are supported.
302 "--with-guis=gtk3"
303 "--enable-system-certs"
304 "--with-libxml2-code=yes"
305 "--disable-binreloc")
306 #:phases
307 #~(modify-phases %standard-phases
308 (add-before 'bootstrap 'make-cvs
309 (lambda _
310 (invoke "make" "-fMakefile.cvs"))))))
311 (inputs
312 (list libgcrypt gnutls openssl gtk+ libxml2))
313 (native-inputs
314 (list autoconf automake gettext-minimal libtool pkg-config))
315 (home-page "https://www.aquamaniac.de")
316 (synopsis "Utility library for networking and security applications")
317 (description
318 "This package provides a helper library for networking and security
319applications and libraries. It is used by AqBanking.")
320 ;; The license includes an explicit additional permission to compile and
321 ;; distribute this library with the OpenSSL Toolkit.
322 (license license:lgpl2.1+)))
323
324(define-public aqbanking
325 (package
326 (name "aqbanking")
327 (version "6.9.2")
328 (source
329 (origin
330 (method git-fetch)
331 (uri (git-reference
332 (url "https://git.aquamaniac.de/git/aqbanking")
333 (commit version)))
334 (sha256
335 (base32
336 "1n1867vdml71p9dbcx70rmf10b12l7l0vq847bbizrkq7b0ha8w0"))
337 (file-name (git-file-name name version))))
338 (build-system gnu-build-system)
339 (arguments
340 (list
341 ;; Parallel building fails because aqhbci is required before it's
342 ;; built.
343 #:parallel-build? #f
344 #:phases
345 #~(modify-phases %standard-phases
346 (add-before 'bootstrap 'make-cvs
347 (lambda _
348 (invoke "make" "-fMakefile.cvs")))
349 ;; Embed the package version instead of the build date
350 (add-after 'make-cvs 'use-version-instead-of-date
351 (lambda _
352 (substitute*
353 "src/libs/plugins/backends/aqhbci/header.xml.in"
354 (("@DATETIME@") #$version))))
355 (add-before 'build 'build-types
356 (lambda _
357 (invoke "make" "typedefs")
358 (invoke "make" "typefiles"))))))
359 (propagated-inputs
360 (list gwenhywfar))
361 (inputs
362 (list gmp xmlsec gnutls))
363 (native-inputs
364 (list autoconf automake gettext-minimal libltdl libtool pkg-config))
365 (home-page "https://www.aquamaniac.de")
366 (synopsis "Interface for online banking tasks")
367 (description
368 "AqBanking is a modular and generic interface to online banking tasks,
369financial file formats (import/export) and bank/country/currency information.
370AqBanking uses backend plugins to actually perform the online tasks. HBCI,
371OFX DirectConnect, YellowNet, GeldKarte, and DTAUS discs are currently
372supported. AqBanking is used by GnuCash, KMyMoney, and QBankManager.")
373 ;; AqBanking is licensed under the GPLv2 or GPLv3
374 (license (list license:gpl2 license:gpl3))))