gnu: Add a tzdata variant for testing purposes.
[jackhill/guix/guix.git] / gnu / packages / calendar.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2015, 2016 Leo Famulari <leo@famulari.name>
4 ;;; Copyright © 2016 Kei Kebreau <kei@openmailbox.org>
5 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2016 Troy Sankey <sankeytms@gmail.com>
7 ;;; Copyright © 2016 Stefan Reichoer <stefan@xsteve.at>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages calendar)
25 #:use-module (gnu packages)
26 #:use-module (guix licenses)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system cmake)
32 #:use-module (guix build-system python)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages databases)
35 #:use-module (gnu packages dav)
36 #:use-module (gnu packages freedesktop)
37 #:use-module (gnu packages icu4c)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages python)
40 #:use-module (srfi srfi-26))
41
42 (define-public libical
43 (package
44 (name "libical")
45 (version "2.0.0")
46 (source (origin
47 (method url-fetch)
48 (uri (string-append
49 "https://github.com/libical/libical/releases/download/v"
50 version "/libical-" version ".tar.gz"))
51 (sha256
52 (base32
53 "1njn2kr0rrjqv5g3hdhpdzrhankyj4fl1bgn76z3g4n1b7vi2k35"))))
54 (build-system cmake-build-system)
55 (arguments
56 '(#:tests? #f ; test suite appears broken
57 #:configure-flags
58 (list (string-append "-DCMAKE_INSTALL_RPATH="
59 (assoc-ref %outputs "out") "/lib:"
60 (assoc-ref %outputs "out") "/lib64"))
61 #:phases
62 (modify-phases %standard-phases
63 (add-before 'configure 'patch-paths
64 (lambda _
65 (let ((tzdata (assoc-ref %build-inputs "tzdata")))
66 (substitute* "src/libical/icaltz-util.c"
67 (("char \\*search_paths \\[\\] =.*$")
68 (string-append
69 "char *search_paths [] = "
70 "{\"" tzdata "/share/zoneinfo\"};\n"))))
71 #t)))))
72 (native-inputs
73 `(("perl" ,perl)))
74 (inputs
75 `(("icu4c" ,icu4c)
76 ("tzdata" ,tzdata)))
77 (home-page "https://libical.github.io/libical/")
78 (synopsis "iCalendar protocols and data formats implementation")
79 (description
80 "Libical is an implementation of the iCalendar protocols and protocol
81 data units.")
82 (license lgpl2.1)))
83
84 (define-public khal
85 (package
86 (name "khal")
87 (version "0.9.3")
88 (source (origin
89 (method url-fetch)
90 (uri (pypi-uri "khal" version))
91 (sha256
92 (base32
93 "1iva6cw2x3p2jzjj6bsyx7lc7yxin4fsd37j9c96j07x16p4imyl"))))
94 (build-system python-build-system)
95 (arguments
96 `(#:phases (modify-phases %standard-phases
97 ;; Building the manpage requires khal to be installed.
98 (add-after 'install 'manpage
99 (lambda* (#:key inputs outputs #:allow-other-keys)
100 ;; Make installed package available for running the tests
101 (add-installed-pythonpath inputs outputs)
102 (zero? (system* "make" "--directory=doc/" "man"))
103 (install-file
104 "doc/build/man/khal.1"
105 (string-append (assoc-ref outputs "out") "/share/man/man1"))))
106
107 ;; The tests require us to choose a timezone.
108 (replace 'check
109 (lambda* (#:key inputs #:allow-other-keys)
110 (setenv "TZ"
111 (string-append (assoc-ref inputs "tzdata")
112 "/share/zoneinfo/Zulu"))
113 (zero? (system* "py.test" "tests")))))))
114 (native-inputs
115 ;; XXX Uses tmpdir_factory, introduced in pytest 2.8.
116 `(("python-pytest" ,python-pytest-2.9.2)
117 ("python-pytest-cov" ,python-pytest-cov)
118 ("python-setuptools-scm" ,python-setuptools-scm)
119 ;; Required for tests
120 ("tzdata" ,tzdata)
121 ("python-freezegun" ,python-freezegun)
122 ;; Required to build manpage
123 ("python-sphinxcontrib-newsfeed" ,python-sphinxcontrib-newsfeed)
124 ("python-sphinx" ,python-sphinx)))
125 (inputs
126 `(("sqlite" ,sqlite)))
127 (propagated-inputs
128 `(("python-configobj" ,python-configobj)
129 ("python-dateutil" ,python-dateutil)
130 ("python-icalendar" ,python-icalendar)
131 ("python-tzlocal" ,python-tzlocal)
132 ("python-urwid" ,python-urwid)
133 ("python-pyxdg" ,python-pyxdg)
134 ("vdirsyncer" ,vdirsyncer)))
135 (synopsis "Console calendar program")
136 (description "Khal is a standards based console calendar program,
137 able to synchronize with CalDAV servers through vdirsyncer.")
138 (home-page "http://lostpackets.de/khal/")
139 (license expat)))
140
141 (define-public remind
142 (package
143 (name "remind")
144 (version "3.1.15")
145 (source
146 (origin
147 (method url-fetch)
148 (uri (string-append "https://www.roaringpenguin.com/files/download/"
149 "remind-"
150 (string-join (map (cut string-pad <> 2 #\0)
151 (string-split version #\.))
152 ".")
153 ".tar.gz"))
154 (sha256
155 (base32
156 "1hcfcxz5fjzl7606prlb7dgls5kr8z3wb51h48s6qm8ang0b9nla"))))
157 (build-system gnu-build-system)
158 (arguments
159 '(#:tests? #f)) ;no "check" target
160 (home-page "http://www.roaringpenguin.com/products/remind/")
161 (synopsis "Sophisticated calendar and alarm program")
162 (description
163 "Remind allows you to remind yourself of upcoming events and appointments.
164 Each reminder or alarm can consist of a message sent to standard output, or a
165 program to be executed. It also features: sophisticated date calculation,
166 moon phases, sunrise/sunset, Hebrew calendar, alarms, PostScript output and
167 proper handling of holidays.")
168 (license gpl2)))
169
170 (define-public libhdate
171 (package
172 (name "libhdate")
173 (version "1.6.02")
174 (source
175 (origin
176 (method url-fetch)
177 (uri (string-append "mirror://sourceforge/libhdate/libhdate/libhdate-"
178 version "/" name "-" version ".tar.bz2"))
179 (sha256
180 (base32
181 "0qkpq412p78znw8gckwcx3l0wcss9s0dgw1pvjb1ih2pxf6hm4rw"))))
182 (build-system gnu-build-system)
183 (home-page "http://libhdate.sourceforge.net/")
184 (synopsis "Library to use Hebrew dates")
185 (description "LibHdate is a small library for the Hebrew calendar and times
186 of day, written in C, and including bindings for C++, pascal, perl, php, python,
187 and ruby. It includes two illustrative command-line programs, @code{hcal} and
188 @code{hdate}, and some snippets and scripts written in the binding languages.")
189 (license gpl3+)))