summary refs log tree commit diff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-11-25 19:08:04 +0100
committerLudovic Courtès <ludo@gnu.org>2018-11-25 19:08:04 +0100
commit18142e23e8ee55d996d9d4ed1113f3d13e81f234 (patch)
treea72e0a2daf6e8906a87ba55a48c06304033104a8 /gnu/packages/python.scm
parentb01e89593da524f131d3c38a9ac0eb95467455f0 (diff)
downloadguix-18142e23e8ee55d996d9d4ed1113f3d13e81f234.tar.gz
gnu: python2-gevent: Fix compilation.
* gnu/packages/python.scm (python-gevent)[arguments]: Add (ice-9 match)
to #:modules.  In 'do-not-use-bundled-sources' phase, use 'scandir' to
avoid hard-coded include directory name.
[properties]: New field.
(python2-gevent): Add 'native-inputs' and 'arguments' fields.
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm35
1 files changed, 30 insertions, 5 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 6f967c5d6a..578d529eb7 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -9134,6 +9134,7 @@ graphviz.")
     (build-system python-build-system)
     (arguments
      `(#:modules ((ice-9 ftw)
+                  (ice-9 match)
                   (srfi srfi-26)
                   (guix build utils)
                   (guix build python-build-system))
@@ -9161,9 +9162,16 @@ graphviz.")
                       (setenv "LIBEV_EMBED" "false")
                       (setenv "CARES_EMBED" "false")
                       (setenv "EMBED" "false")
-                      (setenv "CPATH"
-                              (string-append (assoc-ref inputs "python-greenlet")
-                                             "/include/python3.7m"))
+
+                      (let ((greenlet (string-append
+                                       (assoc-ref inputs "python-greenlet")
+                                       "/include")))
+                        (match (scandir greenlet
+                                        (lambda (item)
+                                          (string-prefix? "python" item)))
+                          ((python)
+                           (setenv "CPATH"
+                                   (string-append greenlet "/" python)))))
                       #t))
                   (replace 'check
                     (lambda _
@@ -9197,10 +9205,27 @@ graphviz.")
     (description
      "gevent is a coroutine-based Python networking library that uses greenlet
 to provide a high-level synchronous API on top of the libev event loop.")
-    (license license:expat)))
+    (license license:expat)
+    (properties `((python2-variant . ,(delay python2-gevent))))))
 
 (define-public python2-gevent
-  (package-with-python2 python-gevent))
+  (let ((base (package-with-python2
+               (strip-python2-variant python-gevent))))
+    (package
+      (inherit base)
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'check 'skip-timer-test
+               (lambda _
+                 ;; XXX: Skip 'TestTimerResolution', which appears to be
+                 ;; unreliable.
+                 (substitute* "src/greentest/test__core_timer.py"
+                   (("not greentest.RUNNING_ON_CI") "False"))
+                 #t))))))
+      (native-inputs `(,@(package-native-inputs python-gevent)
+                       ("python-mock" ,python2-mock))))))
 
 (define-public python-fastimport
   (package