diff mbox

[03/16] gnu: Add python-promise.

Message ID 20160911185857.2123-4-efraim@flashner.co.il
State New
Headers show

Commit Message

Efraim Flashner Sept. 11, 2016, 6:58 p.m. UTC
* gnu/packages/python.scm (python-promise): New variable.
---
 gnu/packages/python.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

David Craven Sept. 11, 2016, 7:41 p.m. UTC | #1
> +(define-public python2-promise
> +  (let ((promise (package-with-python2
> +                   (strip-python2-variant python-promise))))
> +    (package (inherit promise)
> +      (arguments (substitute-keyword-arguments (package-arguments promise)
> +                   ((#:tests? _) #t)))

I've seen this in a few of your patches. Why do tests fail with python
but not with python-2?
Efraim Flashner Sept. 12, 2016, 5:31 a.m. UTC | #2
On Sun, Sep 11, 2016 at 09:41:10PM +0200, David Craven wrote:
> > +(define-public python2-promise
> > +  (let ((promise (package-with-python2
> > +                   (strip-python2-variant python-promise))))
> > +    (package (inherit promise)
> > +      (arguments (substitute-keyword-arguments (package-arguments promise)
> > +                   ((#:tests? _) #t)))
> 
> I've seen this in a few of your patches. Why do tests fail with python
> but not with python-2?

In this one the tests require python-futures, which is python2 only. I
tried adding python2-futures anyway to the native-inputs but
unsuprisingly it didn't help with the tests. The right fix is to have
upstream change it so that it says (something like)

tests:
  require:
    "pytest" ,(version < '3' "futures");

but I need to read up more on my python syntax to suggest a patch.
diff mbox

Patch

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 101e7f1..a340604 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -7441,6 +7441,40 @@  asynchronously executing callables.  This package backports the
 concurrent.futures package from Python 3.2")
     (license license:bsd-3)))
 
+(define-public python-promise
+  (package
+    (name "python-promise")
+    (version "0.4.2")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "promise" version))
+        (sha256
+         (base32
+          "1k19ms8l3d5jzjh557rgkxb5sg4mqgfc315rn4hx1z3n8qq6lr3h"))))
+    (build-system python-build-system)
+    ;; Tests wants python-futures, which is a python2 only program, and
+    ;; can't be found by python2-promise at test time.
+    (arguments `(#:tests? #f))
+    (home-page "https://github.com/syrusakbary/promise")
+    (synopsis "Promises/A+ implementation for Python")
+    (description
+     "Promises/A+ implementation for Python")
+    (properties `((python2-variant . ,(delay python2-promise))))
+    (license license:expat)))
+
+(define-public python2-promise
+  (let ((promise (package-with-python2
+                   (strip-python2-variant python-promise))))
+    (package (inherit promise)
+      (arguments (substitute-keyword-arguments (package-arguments promise)
+                   ((#:tests? _) #t)))
+      (native-inputs
+       `(("python2-futures" ,python2-futures)
+         ("python2-pytest" ,python2-pytest)
+         ("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs promise))))))
+
 (define-public python-urllib3
   (package
     (name "python-urllib3")