Subject: [PATCH] gnu: Add python-ruamel.yaml

From: Muriithi Frederick Muriuki <[email-masked]>
Date: Fri, 14 Jul 2017 16:22:49 +0300

* gnu/packages/serialization.scm (python-ruamel.yaml, python-ruamel2.yaml):
* New variables.
* Use module (guix build-system python)
---
 gnu/packages/serialization.scm | 43 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 6b7461e62..dc030758b 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -38,7 +38,8 @@
   #:use-module (gnu packages lua)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages perl))
+  #:use-module (gnu packages perl)
+  #:use-module (guix build-system python))
 
 (define-public cereal
   (package
@@ -351,3 +352,43 @@ it is comparable to protobuf.")
 “Trivial integration”, and “Serious testing”.
 However, “Memory efficiency” and “Speed” have not been primary goals.")
     (license license:expat)))
+
+(define-public python-ruamel.yaml
+  (package
+    (name "python-ruamel.yaml")
+    (version "0.15.19")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "ruamel.yaml" version))
+       (sha256
+        (base32
+         "0qx779avw8d1vsjqyi7z21h1g5ykp8paqavgj0lzbp8h7bw9vpgv"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (arguments
+     `(;; The 'check phase defined below seems to be correct, but the code on
+       ;; pypi comes with no tests, and the code fetched directly from
+       ;; bitbucket (https://bitbucket.org/ruamel/yaml/get/<version>.tar.gz)
+       ;; fails the tests with "ImportError: No module named 'ruamel.yaml'"
+       ;; or "ImportError: No module named 'ruamel'".
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "bash" "-c" "py.test" "_test/test_*.py")))))
+       #:tests? #f))
+    (home-page "https://bitbucket.org/ruamel/yaml")
+    (synopsis
+     "A YAML 1.2 parser/emitter")
+    (description
+     "This package provides YAML parser/emitter that supports roundtrip
+preservation of comments, seq/map flow style, and map key order.  It
+is a derivative of Kirill Simonov’s PyYAML 3.11.  It supports YAML 1.2
+and has round-trip loaders and dumpers. It supports comments. Block
+style and key ordering are kept, so you can diff the source.")
+    (license license:expat)))
+
+(define-public python2-ruamel.yaml
+  (package-with-python2 python-ruamel.yaml))
-- 
2.13.2