diff mbox

[1/4] gnu: Add python-avro.

Message ID 20160925211728.7636-1-mbakke@fastmail.com
State New
Headers show

Commit Message

Marius Bakke Sept. 25, 2016, 9:17 p.m. UTC
* gnu/packages/serialization.scm (avro-version): New variable (private).
(avro-source): New variable (private).
(python-avro, python2-avro): New variables.
---
 gnu/packages/serialization.scm | 50 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

Comments

Hartmut Goebel Sept. 26, 2016, 9:31 a.m. UTC | #1
Am 25.09.2016 um 23:17 schrieb Marius Bakke:
> +;;; Avro uses a single source repository for all implementations. The individual
> +;;; released versions often have missing or incomplete test data, so we define
> +;;; the common source here for use in all avro packages.
> +(define (avro-version) "1.8.1")
> +(define (avro-source version)

With "Avro uses a single source repository for all implementations " you
mean for both Python 2 and Python 3? Well, this is the common case :-)
Any other packages do have this and we never use a separate definition
for source or version. Please have a look at e.g. python-graphql-relay
(picked as example at random).
> +              `(#:tests? #f ; Requires Apache Ivy.

Please add, why this is a problem. If Ivy is not yet pacakges, I suggest
adding something like "TODO: enable if Apache Ivy is packaged".
Ludovic Courtès Oct. 4, 2016, 9:32 a.m. UTC | #2
Hi!

Marius Bakke <mbakke@fastmail.com> skribis:

> * gnu/packages/serialization.scm (avro-version): New variable (private).
> (avro-source): New variable (private).
> (python-avro, python2-avro): New variables.

[...]

> +;;; Avro uses a single source repository for all implementations. The individual
> +;;; released versions often have missing or incomplete test data, so we define
> +;;; the common source here for use in all avro packages.

Two semicolons please.  :-)

> +(define-public python2-avro
> +  (let ((base (package-with-python2 (strip-python2-variant python-avro))))
> +    (package (inherit base)
> +             (arguments
> +              `(#:tests? #f ; Requires Apache Ivy.
> +                #:python ,python-2 ; Needed when overriding inherited args.
> +                #:phases
> +                (modify-phases %standard-phases
> +                  (add-after 'unpack 'enter-source
> +                    (lambda _ (chdir "lang/py") #t))))))))

Rather:

  (package
    (inherit base)
    (arguments
      (substitute-keyword-arguments (package-arguments python-avro)
        ((#:phases _)
         `(modify-phases %standard-phases
            (add-after 'unpack 'enter-source …))))))


OK with this change, thanks!

Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 4a3278f..c97778a 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -25,6 +25,7 @@ 
   #:use-module (guix download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages boost)
@@ -200,3 +201,52 @@  it a convenient format to store user input files.")
      "Cap'n Proto is a very fast data interchange format and capability-based
 RPC system.  Think JSON, except binary.  Or think Protocol Buffers, except faster.")
     (license license:expat)))
+
+;;; Avro uses a single source repository for all implementations. The individual
+;;; released versions often have missing or incomplete test data, so we define
+;;; the common source here for use in all avro packages.
+(define (avro-version) "1.8.1")
+(define (avro-source version)
+  (origin
+    (method url-fetch)
+    (uri (string-append "mirror://apache/avro/avro-" version
+                        "/avro-src-" version ".tar.gz"))
+    (sha256 (base32 "0bplj4qmh7d6p987qd6a13g59awrc5cbx25n5brcrwq8yjik21av"))
+    (modules '((guix build utils)))
+    (snippet
+     '(begin
+        ;; Delete unneeded bundled dependencies here.
+        (delete-file-recursively "lang/py/lib/simplejson")
+        #t))))
+
+(define-public python-avro
+  (package
+    (name "python-avro")
+    (version (avro-version))
+    (source (avro-source version))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'enter-source
+           (lambda _ (chdir "lang/py3") #t)))))
+    (propagated-inputs
+     `(("python-simplejson" ,python-simplejson)))
+    (home-page "https://avro.apache.org/")
+    (synopsis "Python implementation of the Avro data serialization system")
+    (description
+     "Avro is a data serialization system and RPC framework with rich data
+structures.  This package provides the python version.")
+    (license license:asl2.0)
+    (properties `((python2-variant . ,(delay python2-avro))))))
+
+(define-public python2-avro
+  (let ((base (package-with-python2 (strip-python2-variant python-avro))))
+    (package (inherit base)
+             (arguments
+              `(#:tests? #f ; Requires Apache Ivy.
+                #:python ,python-2 ; Needed when overriding inherited args.
+                #:phases
+                (modify-phases %standard-phases
+                  (add-after 'unpack 'enter-source
+                    (lambda _ (chdir "lang/py") #t))))))))