gnu: r-broom: Update to 0.5.6.
[jackhill/guix/guix.git] / gnu / packages / python.scm
index f3bea4a..048941e 100644 (file)
@@ -57,6 +57,7 @@
 ;;; Copyright © 2018, 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2018 Luther Thompson <lutheroto@gmail.com>
 ;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
+;;; Copyright © 2019 Tanguy Le Carrour <tanguy@bioneland.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -76,6 +77,7 @@
 (define-module (gnu packages python)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages dbm)
              "--with-system-ffi"                  ;build ctypes
              "--with-ensurepip=install"           ;install pip and setuptools
              "--enable-unicode=ucs4"
+
+             ;; Prevent the installed _sysconfigdata.py from retaining a reference
+             ;; to coreutils.
+             "INSTALL=install -c"
+             "MKDIR_P=mkdir -p"
+
              (string-append "LDFLAGS=-Wl,-rpath="
                             (assoc-ref %outputs "out") "/lib"))
        ;; With no -j argument tests use all available cpus, so provide one.
@@ -318,7 +326,7 @@ data types.")
 (define-public python-3.7
   (package (inherit python-2)
     (name "python")
-    (version "3.7.3")
+    (version "3.7.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
@@ -329,7 +337,7 @@ data types.")
                         "python-3-search-paths.patch"))
               (sha256
                (base32
-                "066ka8csjwkycqpgyv424d8hhqhfd7r6svsp4sfcvkylci0baq6s"))
+                "0gxiv5617zd7dnqm5k9r4q2188lk327nf9jznwq9j6b8p0s92ygv"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -338,31 +346,31 @@ data types.")
                   (substitute* "Modules/Setup.dist"
                     ;; Link Expat instead of embedding the bundled one.
                     (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
-
-                  (for-each delete-file
-                            '(;; This test may hang and eventually run out of
-                              ;; memory on some systems:
-                              ;; <https://bugs.python.org/issue34587>
-                              "Lib/test/test_socket.py"
-
-                              ;; Delete test that fails on low-memory systems.
-                              "Lib/test/test_mmap.py"
-
-                              ;; These tests fail on AArch64.
-                              "Lib/ctypes/test/test_win32.py"
-                              "Lib/test/test_fcntl.py"
-                              "Lib/test/test_posix.py"))
                   #t))))
     (arguments
      (substitute-keyword-arguments (package-arguments python-2)
        ((#:make-flags _)
         `(list (string-append
                 (format #f "TESTOPTS=-j~d" (parallel-job-count))
-                ;; Exclude the following test, which fails as of 3.7.3 (see:
-                ;; https://bugs.python.org/issue35998).
-                " --exclude test_asyncio")))
+                ;; test_mmap fails on low-memory systems.
+                " --exclude test_mmap"
+                ;; test_socket may hang and eventually run out of memory
+                ;; on some systems: <https://bugs.python.org/issue34587>.
+                " test_socket"
+                ;; XXX: test_ctypes fails on some platforms due to a problem in
+                ;; libffi 3.2.1: <https://bugs.python.org/issue23249>.
+                ,@(if (string-prefix? "aarch64" (%current-system))
+                      '(" test_ctypes")
+                      '()))))
        ((#:phases phases)
        `(modify-phases ,phases
+          (add-before 'check 'set-TZDIR
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; test_email requires the Olson time zone database.
+              (setenv "TZDIR"
+                      (string-append (assoc-ref inputs "tzdata")
+                                     "/share/zoneinfo"))
+              #t))
           ;; Unset SOURCE_DATE_EPOCH while running the test-suite and set it
           ;; again afterwards.  See <https://bugs.python.org/issue34022>.
           (add-before 'check 'unset-SOURCE_DATE_EPOCH
@@ -391,6 +399,9 @@ data types.")
                               (find-files out "\\.py$")))
                   (list '() '("-O") '("-OO")))
                  #t)))))))
+    (native-inputs
+     `(("tzdata" ,tzdata-for-tests)
+       ,@(package-native-inputs python-2)))
     (native-search-paths
      (list (search-path-specification
             (variable "PYTHONPATH")
@@ -398,6 +409,31 @@ data types.")
                                         (version-major+minor version)
                                         "/site-packages"))))))))
 
+(define-public python-3.8
+  (package
+    (inherit python-3.7)
+    (name "python-next")
+    (version "3.8.0")
+    (source
+     (origin
+       (inherit (package-source python-3.7))
+       (uri (string-append "https://www.python.org/ftp/python/"
+                           version "/Python-" version ".tar.xz"))
+       (sha256 (base32 "110d0did9rxn7rg85kf2fwli5hqq44xv2d8bi7d92m7v2d728mmk"))
+       (patches (search-patches
+                 "python-3.8-search-paths.patch"
+                 "python-3-fix-tests.patch"
+                 "python-3.8-fix-tests.patch"
+                 "python-3-deterministic-build-info.patch"))
+       (snippet
+        '(begin
+           ;; Delete the bundled copy of libexpat.
+           (delete-file-recursively "Modules/expat")
+           (substitute* "Modules/Setup"
+             ;; Link Expat instead of embedding the bundled one.
+             (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
+           #t))))))
+
 ;; Current 3.x version.
 (define-public python-3 python-3.7)
 
@@ -499,7 +535,7 @@ instead of @command{python3}.")))
 (define-public micropython
   (package
     (name "micropython")
-    (version "1.10")
+    (version "1.11")
     (source
       (origin
         (method url-fetch)
@@ -508,7 +544,7 @@ instead of @command{python3}.")))
                             "/micropython-" version ".tar.gz"))
         (sha256
          (base32
-          "1g1zjip3rkx6bp16qi1bag72wivnbh56fcsl3nffanrx4j5f4z90"))
+          "0px3xhw16rl0l7qifq7jw1gq92wzlnhd17dmszv9m2c3wbzs9p9f"))
       (modules '((guix build utils)))
       (snippet
        '(begin
@@ -522,7 +558,7 @@ instead of @command{python3}.")))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
-         (add-before 'build 'preprare-build
+         (add-before 'build 'prepare-build
            (lambda _
              (chdir "ports/unix")
              ;; see: https://github.com/micropython/micropython/pull/4246