summary refs log tree commit diff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm211
1 files changed, 170 insertions, 41 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4e0292e1a7..25e06e994b 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -53,6 +53,7 @@
   #:use-module (gnu packages adns)
   #:use-module (gnu packages attr)
   #:use-module (gnu packages backup)
+  #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages databases)
   #:use-module (gnu packages django)
@@ -107,7 +108,7 @@
 (define-public python-2.7
   (package
     (name "python")
-    (version "2.7.11")
+    (version "2.7.12")
     (source
      (origin
       (method url-fetch)
@@ -115,7 +116,7 @@
                           version "/Python-" version ".tar.xz"))
       (sha256
        (base32
-        "0iiz844riiznsyhhyy962710pz228gmhv8qi3yk4w4jhmx2lqawn"))
+        "0y7rl603vmwlxm6ilkhc51rx2mfj14ckcz40xxgs0ljnvlhp30yp"))
       (patches (search-patches "python-2.7-search-paths.patch"
                                "python-2-deterministic-build-info.patch"
                                "python-2.7-source-date-epoch.patch"))
@@ -127,6 +128,7 @@
        '(begin
           (for-each delete-file
                     '("Lib/test/test_compileall.py"
+                      "Lib/test/test_ctypes.py" ; fails on mips64el
                       "Lib/test/test_distutils.py"
                       "Lib/test/test_import.py"
                       "Lib/test/test_shutil.py"
@@ -202,13 +204,6 @@
            (lambda _
              ;; 'Lib/test/test_site.py' needs a valid $HOME
              (setenv "HOME" (getcwd))
-             ,@(if (string-prefix? "mips64el" (%current-system))
-
-                   ;; XXX: The following test fails on mips64el.
-                   '((false-if-exception
-                      (delete-file "Lib/test/test_ctypes.py")))
-
-                   '())
              #t))
           (add-after
            'unpack 'set-source-file-times-to-1980
@@ -290,7 +285,7 @@
      (list (search-path-specification
             (variable "PYTHONPATH")
             (files '("lib/python2.7/site-packages")))))
-    (home-page "http://python.org")
+    (home-page "https://www.python.org")
     (synopsis "High-level, dynamically-typed programming language")
     (description
      "Python is a remarkably powerful dynamic programming language that
@@ -305,23 +300,22 @@ data types.")
 ;; Current 2.x version.
 (define-public python-2 python-2.7)
 
-(define-public python-3.4
+(define-public python-3.5
   (package (inherit python-2)
-    (version "3.4.3")
+    (version "3.5.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
                                   version "/Python-" version ".tar.xz"))
               (patches (search-patches
                         "python-fix-tests.patch"
-                        ;; XXX Try removing this patch for python > 3.4.3
-                        "python-disable-ssl-test.patch"
+                        "python-3.5-fix-tests.patch"
                         "python-3-deterministic-build-info.patch"
                         "python-3-search-paths.patch"))
               (patch-flags '("-p0"))
               (sha256
                (base32
-                "1f4nm4z08sy0kqwisvv95l02crv6dyysdmx44p1mz3bn6csrdcxm"))))
+                "0h6a5fr7ram2s483lh0pnmc4ncijb8llnpfdxdcl5dxr01hza400"))))
     (arguments (substitute-keyword-arguments (package-arguments python-2)
                  ((#:tests? _) #t)))
     (native-search-paths
@@ -331,8 +325,25 @@ data types.")
                                         (version-major+minor version)
                                         "/site-packages"))))))))
 
+(define-public python-3.4
+  (package (inherit python-3.5)
+    (version "3.4.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://www.python.org/ftp/python/"
+                                  version "/Python-" version ".tar.xz"))
+              (patches (search-patches
+                        "python-fix-tests.patch"
+                        "python-3.4-fix-tests.patch"
+                        "python-3-deterministic-build-info.patch"
+                        "python-3-search-paths.patch"))
+              (patch-flags '("-p0"))
+              (sha256
+               (base32
+                "12l9klp778wklxmckhghniy5hklss8r26995pyd00qbllk4b2r7f"))))))
+
 ;; Current 3.x version.
-(define-public python-3 python-3.4)
+(define-public python-3 python-3.5)
 
 ;; Current major version.
 (define-public python python-3)
@@ -354,14 +365,12 @@ data types.")
   (package (inherit python)
     (name "python-minimal")
     (outputs '("out"))
-    (arguments
-     (substitute-keyword-arguments (package-arguments python)
-       ((#:configure-flags cf)
-        `(append ,cf '("--without-system-ffi")))))
 
+    ;; Build fails due to missing ctypes without libffi.
     ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
     ;; zlib is required by 'zipimport', used by pip.
-    (inputs `(("openssl" ,openssl)
+    (inputs `(("libffi" ,libffi)
+              ("openssl" ,openssl)
               ("zlib" ,zlib)))))
 
 (define* (wrap-python3 python
@@ -372,6 +381,7 @@ data types.")
     (source #f)
     (build-system trivial-build-system)
     (outputs '("out"))
+    (inputs `(("bash" ,bash)))
     (propagated-inputs `(("python" ,python)))
     (arguments
      `(#:modules ((guix build utils))
@@ -385,8 +395,20 @@ data types.")
                   (lambda (old new)
                     (symlink (string-append python old)
                              (string-append bin "/" new)))
-                  '("python3" "pydoc3" "idle3")
-                  '("python"  "pydoc"  "idle"))))))
+                  `("python3" ,"pydoc3" ,"idle3" ,"pip3")
+                  `("python"  ,"pydoc"  ,"idle"  ,"pip"))
+                ;; python-config outputs search paths based upon its location,
+                ;; use a bash wrapper to avoid changing its outputs.
+                (let ((bash (string-append (assoc-ref %build-inputs "bash")
+                                           "/bin/bash"))
+                      (old  (string-append python "python3-config"))
+                      (new  (string-append bin "/python-config")))
+                  (with-output-to-file new
+                    (lambda ()
+                      (format #t "#!~a~%" bash)
+                      (format #t "exec \"~a\" \"$@\"~%" old)
+                      (chmod new #o755)
+                      #t)))))))
     (synopsis "Wrapper for the Python 3 commands")
     (description
      "This package provides wrappers for the commands of Python@tie{}3.x such
@@ -1386,14 +1408,14 @@ backported for previous versions of Python from 2.4 to 3.3.")
       (uri (pypi-uri "parse" version))
       (sha256
        (base32
-        "0y31i3mwgv35qn0kzzjn9q8jqfdqmbi6sr6yfvn8rq4lqjm5lhvi"))))
+        "0y31i3mwgv35qn0kzzjn9q8jqfdqmbi6sr6yfvn8rq4lqjm5lhvi"))
+      (patches (search-patches "python-parse-too-many-fields.patch"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
-       (alist-replace
-        'check
-        (lambda _ (zero? (system* "python" "test_parse.py")))
-        %standard-phases)))
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (zero? (system* "python" "test_parse.py")))))))
     (home-page "https://github.com/r1chardj0n3s/parse")
     (synopsis "Parse strings")
     (description
@@ -6242,6 +6264,20 @@ responses, rather than doing any computation.")
         (base32
          "1a85l548w5vvq3yhz0az7ajg2ijixzp6gagapw6wgrqvq28ghgs2"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'disable-failing-test
+           (lambda _
+             ;; This test is known to fail with OpenSSL >= 1.0.2i and older
+             ;; versions of python-cryptography:
+             ;; https://github.com/pyca/cryptography/issues/3196
+             ;; TODO: Try re-enabling the test when upgrading
+             ;; python-cryptography.
+             (substitute* "tests/hazmat/backends/test_openssl.py"
+               (("def test_numeric_string_x509_name_entry")
+                 "@pytest.mark.xfail\n    def test_numeric_string_x509_name_entry"))
+             #t)))))
     (inputs
      `(("openssl" ,openssl)))
     (propagated-inputs
@@ -6457,9 +6493,14 @@ Python's @code{ctypes} foreign function interface (FFI).")
   (package
     (inherit file)
     (name "python-file")
+    (source (origin
+              (inherit (package-source file))
+              ;; This patch should not be applied to python2-file.
+              (patches (search-patches "python-file-double-encoding-bug.patch"))))
     (build-system python-build-system)
     (arguments
      '(#:tests? #f                                ;no tests
+       #:configure-flags '("--single-version-externally-managed" "--root=/")
        #:phases (modify-phases %standard-phases
                   (add-before 'build 'change-directory
                     (lambda _
@@ -6477,10 +6518,17 @@ Python's @code{ctypes} foreign function interface (FFI).")
     (synopsis "Python bindings to the libmagic file type guesser.  Note that
 this module and the python-magic module both provide a \"magic.py\" file;
 these two modules, which are different and were developed separately, both
-serve the same purpose: provide Python bindings for libmagic.")))
+serve the same purpose: provide Python bindings for libmagic.")
+    (properties `((python2-variant . ,(delay python2-file))))))
 
 (define-public python2-file
-  (package-with-python2 python-file))
+  (let ((base (package-with-python2 (strip-python2-variant python-file))))
+    (package
+      (inherit base)
+      (source (package-source file))
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
 
 (define-public python-debian
   (package
@@ -7100,6 +7148,9 @@ be set via config files and/or environment variables.")
                 (base32
                   "0x32ibixm3vv5m9xfk83xsqm8xcqw4dd0khbh6qbri6rxgymbhg8"))))
     (build-system python-build-system)
+    (arguments
+     '(;; The tests appear to require networking.
+       #:tests? #f))
     (propagated-inputs
      `(("python-pyopenssl" ,python-pyopenssl)))
     (synopsis "HTTPS support for Python's httplib and urllib2")
@@ -7235,6 +7286,10 @@ for atomic file system operations.")
               (base32
                "15q9nrgp85nqlr4kdz1zvj8z2npafi2sr12y7fqgxbkq28j1aci6"))))
     (build-system python-build-system)
+    (native-inputs
+     `(("python-betamax" ,python-betamax)
+       ("python-mock" ,python-mock)
+       ("python-pytest" ,python-pytest)))
     (propagated-inputs
      `(("python-requests" ,python-requests)))
     (synopsis "Extensions to python-requests")
@@ -7323,8 +7378,14 @@ pure Python module that works on virtually all Python versions.")
               (base32
                "1rpk1vyclhg911p3hql0m0nrpq7q7mysxnaaw6vs29cpa6kx8vgn"))))
     (build-system python-build-system)
+    (arguments
+     `(;; 2 failed, 275 passed, 670 skipped, 4 xfailed
+       ;; The two test failures are caused by the lack of an `ssh` executable.
+       ;; The test suite can be run with pytest after the 'install' phase.
+       #:tests? #f))
     (native-inputs
-     `(("python-setuptools-scm" ,python-setuptools-scm)))
+     `(("python-pytest" ,python-pytest)
+       ("python-setuptools-scm" ,python-setuptools-scm)))
     (inputs
      `(("python-apipkg" ,python-apipkg)))
     (synopsis "Rapid multi-Python deployment")
@@ -7428,7 +7489,8 @@ framework which enables you to test server connections locally.")
     (build-system python-build-system)
     (native-inputs
      `(("python-pytest" ,python-pytest)
-       ("python-six" ,python-six)))
+       ("python-six" ,python-six)
+       ("python-urllib3" ,python-urllib3)))
     (propagated-inputs
      `(("python-httplib2" ,python-httplib2)
        ("python-requests" ,python-requests)))
@@ -8065,6 +8127,17 @@ python-xdo for newer bindings.)")
         (base32
          "0vyl26y9cg409cfyj8rhqxazsdnd0jipgjw06civhrd53yyi1pzz"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'remove-django-test
+           ;; Don't fail the tests when the inputs for the optional tests cannot be found.
+           (lambda _
+             (substitute*
+               "tests/runtests.py"
+               (("'ext_django.tests', 'ext_sqlalchemy', 'ext_dateutil', 'locale_babel'") "")
+               (("sys.stderr.write(\"### Disabled test '%s', dependency not found\n\" % name)") ""))
+             #t)))))
     (native-inputs
      `(("unzip" ,unzip)))
     (home-page "http://wtforms.simplecodes.com/")
@@ -8464,21 +8537,22 @@ alternative when librabbitmq is not available.")
 (define-public python-kombu
   (package
     (name "python-kombu")
-    (version "3.0.33")
+    (version "3.0.37")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "kombu" version))
        (sha256
         (base32
-         "16brjx2lgwbj2a37d0pjbfb84nvld6irghmqrs3qfncajp51hgc5"))))
+         "0l16chb314gpq2v7fh94a22c30lcv6w3ylmhsa60bldlcq6a0r70"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-mock" ,python-mock)
        ("python-nose" ,python-nose)))
     (propagated-inputs
      `(("python-anyjson" ,python-anyjson)
-       ("python-amqp" ,python-amqp)))
+       ("python-amqp" ,python-amqp)
+       ("python-redis" ,python-redis)))
     (home-page "http://kombu.readthedocs.org")
     (synopsis "Message passing library for Python")
     (description "The aim of Kombu is to make messaging in Python as easy as
@@ -8502,14 +8576,14 @@ RabbitMQ messaging server is the most popular implementation.")
 (define-public python-billiard
   (package
     (name "python-billiard")
-    (version "3.3.0.22")
+    (version "3.3.0.23")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "billiard" version))
        (sha256
         (base32
-         "0zp7h6a58alrb3mwdw61jds07395j4j0mj6iqsb8czrihw9ih5nj"))))
+         "02wxsc6bhqvzh8j6w758kvgqbnj14l796mvmrcms8fgfamd2lak9"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-nose" ,python-nose)))
@@ -8537,15 +8611,24 @@ Python 2.4 and 2.5, and will draw its fixes/improvements from python-trunk.")
 (define-public python-celery
   (package
     (name "python-celery")
-    (version "3.1.20")
+    (version "3.1.24")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "celery" version))
        (sha256
         (base32
-         "1md6ywg1s0946qyp8ndnsd677wm0yax933h2sb4m3a4j7lf1jbyh"))))
+         "0yh2prhdnx2dgkb67a5drj12hh2zvzx5f611p7mqqg01ydghif4r"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; These tests break with Python 3.5:
+         ;; https://github.com/celery/celery/issues/2897#issuecomment-253066295
+         (replace 'check
+           (lambda _
+             (zero?
+               (system* "nosetests" "--exclude=^test_safe_to_remove.*")))))))
     (native-inputs
      `(("python-nose" ,python-nose)))
     (inputs
@@ -8728,6 +8811,9 @@ introspection of @code{zope.interface} instances in code.")
                (base32
                 "1qfnwlx8qwkgr6nf5wvl6ff1r3kll53dh3z6nyp173nmlhhhqccb"))))
     (build-system python-build-system)
+    (arguments
+     '(;; The test suite relies on some non-portable Windows interfaces.
+       #:tests? #f))
     (inputs
      `(("python-dateutil-2" ,python-dateutil-2)
        ("python-pyicu" ,python-pyicu)))
@@ -11001,7 +11087,8 @@ CPU, load, memory, network bandwidth, disk I/O, disk use, and more.")
           "0rsaarx2sj4xnw9966rhh4haiqaapm4lm2mfqm48ywd51j5vh1a0"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
+     `(#:tests? #f ; Tests require the unpackaged pytest-benchmark.
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-hardcoded-version
            (lambda _ (substitute*
@@ -11150,6 +11237,38 @@ provide extendible implementations of common aspects of a cloud so that you can
 focus on building massively scalable web applications.")
     (license license:expat)))
 
+(define-public python-betamax
+  (package
+    (name "python-betamax")
+    (version "0.8.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "betamax" version))
+        (sha256
+         (base32
+          "18f8v5gng3j773jlbbzx4rg1i4y2zw3m2l1zpmbvp8bh5a2q1i42"))))
+    (build-system python-build-system)
+    (arguments
+     '(;; Many tests fail because they require networking.
+       #:tests? #f))
+    (inputs
+     `(("python-requests" ,python-requests)))
+    (home-page "https://github.com/sigmavirus24/betamax")
+    (synopsis "Record HTTP interactions with python-requests")
+    (description "Betamax will record your test suite's HTTP interactions and
+replay them during future tests.  It is designed to work with python-requests.")
+    (license license:expat)
+    (properties `((python2-variant . ,(delay python2-betamax))))))
+
+(define-public python2-betamax
+  (let ((base (package-with-python2 (strip-python2-variant python-betamax))))
+    (package
+      (inherit base)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs base))))))
+
 (define-public python-s3transfer
   (package
     (name "python-s3transfer")
@@ -11161,8 +11280,18 @@ focus on building massively scalable web applications.")
                (base32
                 "1jivjkp3xqif9gzr5fiq28jsskmh50vzzd7ldsb4rbyiw1iyv3hy"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             ;; 7 of the 'integration' tests require network access or login
+             ;; credentials.
+             (zero? (system* "nosetests" "--exclude=integration")))))))
     (native-inputs
-     `(("python-docutils" ,python-docutils)))
+     `(("python-docutils" ,python-docutils)
+       ("python-mock" ,python-mock)
+       ("python-nose" ,python-nose)))
     (inputs
      `(("python-botocore" ,python-botocore)))
     (synopsis "Amazon S3 Transfer Manager")