diff mbox

gnu: Add python-odfpy.

Message ID 878tvvz69g.fsf@ike.i-did-not-set--mail-host-address--so-tickle-me
State New
Headers show

Commit Message

Marius Bakke Aug. 17, 2016, 4:53 p.m. UTC
None

Comments

Leo Famulari Aug. 21, 2016, 8:13 p.m. UTC | #1
On Wed, Aug 17, 2016 at 05:53:31PM +0100, Marius Bakke wrote:
> Subject: [PATCH] gnu: Add python-odfpy.
> 
> * gnu/packages/python.scm (python-odfpy, python2-odfpy): New variables.

Thanks for the patch!

> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (replace 'check
> +           (lambda _ (zero? (system* "make" "-C" "tests")))))))
> +    (native-inputs
> +     ;; The test runner wants to check both python versions at once.
> +     ;; To avoid patching it, we add them here.
> +     `(("python-2" ,python-2)
> +       ("python-3" ,python-3)))

I think we should take another approach. Doing it this way makes the
python-odfpy and python2-odfpy built outputs refer to both Python
versions:

$ guix gc --references $(./pre-inst-env guix build python2-odfpy)
/gnu/store/m4gc2wx4q9if1vrhgclpspdil7rqsn21-python-3.4.3
/gnu/store/s0ckr1yhrzgfisxpsfz5b8mybjmvqkf1-python2-odfpy-1.3.3
/gnu/store/vcx1n5nj4gr52xx5m6gvi7zrwngy06s3-python-2.7.11
/gnu/store/ykzwykkvr2c80rw4l1qh3mvfdkl7jibi-bash-4.3.42

This looks like the file to patch:
https://github.com/eea/odfpy/blob/master/tests/runtests
diff mbox

Patch

From aa54aaee18b096780220f85a02b7e036458858a2 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Wed, 17 Aug 2016 17:45:24 +0100
Subject: [PATCH] gnu: Add python-odfpy.

* gnu/packages/python.scm (python-odfpy, python2-odfpy): New variables.
---
 gnu/packages/python.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index d7886d9..ca3df19 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -25,6 +25,7 @@ 
 ;;; Copyright © 2016 Troy Sankey <sankeytms@gmail.com>
 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
 ;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
+;;; Copyright © 2016 Marius Bakke <mbakke@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -9983,3 +9984,34 @@  hardware-accelerated multitouch applications.")
 
 (define-public python2-kivy-next
   (package-with-python2 python-kivy-next))
+
+(define-public python-odfpy
+  (package
+    (name "python-odfpy")
+    (version "1.3.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "odfpy" version))
+       (sha256
+        (base32
+         "1a6ms0w9zfhhkqhvrnynwwbxrivw6hgjc0s5k7j06npc7rq0blxw"))))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (zero? (system* "make" "-C" "tests")))))))
+    (native-inputs
+     ;; The test runner wants to check both python versions at once.
+     ;; To avoid patching it, we add them here.
+     `(("python-2" ,python-2)
+       ("python-3" ,python-3)))
+    (build-system python-build-system)
+    (home-page "https://github.com/eea/odfpy")
+    (synopsis "API for OpenDocument in Python")
+    (description "Collection of utility programs written in Python to
+manipulate OpenDocument 1.2 files.")
+    (license (list asl2.0 gpl2+))))
+
+(define-public python2-odfpy
+  (package-with-python2 python-odfpy))
-- 
2.9.2