On 2016-01-03 18:05, Leo Famulari wrote:
* gnu/packages/calendar.scm (khal): New variable.
---
gnu/packages/calendar.scm | 79 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 78 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/calendar.scm b/gnu/packages/calendar.scm
index 7e87fbb..d8f9627 100644
--- a/gnu/packages/calendar.scm
+++ b/gnu/packages/calendar.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 David Thompson <da...@gnu.org>
+;;; Copyright © 2015 Leo Famulari <l...@famulari.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -22,8 +23,14 @@
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system cmake)
+  #:use-module (guix build-system python)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages dav)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages icu4c)
-  #:use-module (gnu packages perl))
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages python))

 (define-public libical
   (package
@@ -50,3 +57,73 @@
"Libical is an implementation of the iCalendar protocols and protocol
 data units.")
     (license lgpl2.1)))
+
+(define-public khal
+  (package
+    (name "khal")
+    (version "0.7.0")
+    (source (origin
+             (method url-fetch)
+             (uri (pypi-uri "khal" version))
+             (sha256
+              (base32
+ "00llxj7cv31mjsx0j6zxmyi9s1q20yvfkn025xcy8cv1ylfwic66"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+        ;; Patch sent upstream: https://github.com/geier/khal/pull/307
+        (add-after
+          'unpack 'patch-broken-path
+          (lambda _
+            (substitute* "doc/source/Makefile"
+              (("../../../khal/khal/settings/khal.spec")
+               "../../khal/settings/khal.spec" ))))

This should perhaps be moved to an origin snippet since the fix is not specific to the guix build, so that users who want to `guix build --sources khal` get working source.


+        ;; Bug reported: https://github.com/geier/khal/issues/309
+        (add-after 'unpack 'disable-test
+          (lambda _
+            (substitute* "tests/khalendar_test.py"
+                         (("test_only_update_old_event")
+                          "disabled_only_update_old_event"))))
+        ;; Building the manpage requires khal to be installed.
+        (add-after 'install 'manpage
+          (lambda* (#:key outputs #:allow-other-keys)
+            (setenv "PYTHONPATH"
+                    (string-append
+                      (getenv "PYTHONPATH")
+                      ":" (assoc-ref outputs "out")))
+            (zero? (system* "make" "--directory=doc/" "man"))
+            (install-file
+              "doc/build/man/khal.1"
+              (string-append
+                (assoc-ref outputs "out")
+                "/share/man/man1"))))
+        (replace 'check
+          (lambda* (#:key inputs #:allow-other-keys)
+            ;; The tests require us to choose a timezone.
+            (setenv "TZ"
+                    (string-append (assoc-ref inputs "tzdata")
+                                   "/share/zoneinfo/Zulu"))
+            (zero? (system* "py.test" "tests")))))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ("python-setuptools-scm" ,python-setuptools-scm)
+       ;; Required for tests
+       ("tzdata" ,tzdata)
+       ;; Required to build manpage
+ ("python-sphinxcontrib-newsfeed" ,python-sphinxcontrib-newsfeed)
+       ("python-sphinx" ,python-sphinx)))
+    (inputs
+     `(("sqlite" ,sqlite)))
+    (propagated-inputs
+     `(("python-configobj" ,python-configobj)
+       ("python-dateutil-2" ,python-dateutil-2)
+       ("python-icalendar" ,python-icalendar)
+       ("python-tzlocal" ,python-tzlocal)
+       ("python-urwid" ,python-urwid)
+       ("python-pyxdg" ,python-pyxdg)
+       ("vdirsyncer" ,vdirsyncer)))
+    (synopsis "CLI and TUI calendar program")

How about "Console calendar program"?

+ (description "Khal is a standards based CLI and TUI calendar program, able

ditto

+to synchronize with CalDAV servers through vdirsyncer.")
+    (home-page "http://lostpackets.de/khal/";)
+    (license expat)))

--
`~Eric

Reply via email to