guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

05/57: gnu: python-django: Update to 3.1.1.


From: guix-commits
Subject: 05/57: gnu: python-django: Update to 3.1.1.
Date: Tue, 22 Sep 2020 12:43:30 -0400 (EDT)

mbakke pushed a commit to branch master
in repository guix.

commit ac3103e8f32005e694701f57fe75ea39df8765b7
Author: Marius Bakke <marius@gnu.org>
AuthorDate: Tue Sep 1 00:20:28 2020 +0200

    gnu: python-django: Update to 3.1.1.
    
    * gnu/packages/django.scm (python-django): Update to 3.1.1.
    [arguments]: Remove #:modules.  Rename set-tzdir phase to pre-check, and
    disable one test.  Adjust PYTHONPATH patching to preserve all entries.  
Ensure
    the test suite runs sequentially.
    [propagated-inputs]: Add PYTHON-ASGIREF.
    (python-django-2.2): New public variable.
    * gnu/packages/mail.scm (python-hyperkitty)[propagated-inptus]: Change from
    PYTHON-DJANGO to PYTHON-DJANGO-2.2.
    * gnu/packages/patchutils.scm (patchwork)[propagated-inputs]: Likewise.
---
 gnu/packages/django.scm     | 67 ++++++++++++++++++++++++++++++++-------------
 gnu/packages/mail.scm       |  2 +-
 gnu/packages/patchutils.scm |  2 +-
 3 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index dd066b5..1cc7199 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2018 Vijayalakshmi Vedantham <vijimay12@gmail.com>
 ;;; Copyright © 2019 Sam <smbaines8@gmail.com>
+;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -45,43 +46,55 @@
 (define-public python-django
   (package
     (name "python-django")
-    (version "1.11.29")
+    (version "3.1.1")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "Django" version))
               (sha256
                (base32
-                "171jsi54fbnxzi2n3l4hkdmmwfnfrwacs180rw59l0bqcvxsw022"))))
+                "0bzwy58hrxbsh7szak1yfh7qvvfnpdpi8ay1x7d3pvbkm1f15j2r"))))
     (build-system python-build-system)
     (arguments
-     '(#:modules ((srfi srfi-1)
-                  (guix build python-build-system)
-                  (guix build utils))
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         (add-before 'check 'set-tzdir
+         (add-before 'check 'pre-check
            (lambda* (#:key inputs #:allow-other-keys)
              ;; The test-suite tests timezone-dependent functions, thus tzdata
              ;; needs to be available.
              (setenv "TZDIR"
                      (string-append (assoc-ref inputs "tzdata")
                                     "/share/zoneinfo"))
-             #t))
-         (replace 'check
-           (lambda* (#:key inputs #:allow-other-keys)
-             (setenv "PYTHONPATH"
-                     (string-append ".:" (getenv "PYTHONPATH")))
+
+             ;; Disable test for incorrect timezone: it only raises the
+             ;; expected error when /usr/share/zoneinfo exists, even though
+             ;; the machinery gracefully falls back to TZDIR.  According to
+             ;; django/conf/__init__.py, lack of /usr/share/zoneinfo is
+             ;; harmless, so just ignore this test.
+             (substitute* "tests/settings_tests/tests.py"
+               ((".*def test_incorrect_timezone.*" all)
+                (string-append "    @unittest.skipIf(True, 'Disabled by 
Guix')\n"
+                               all)))
+
+             ;; Preserve the PYTHONPATH created by Guix when running the tests.
              (substitute* "tests/admin_scripts/tests.py"
                (("python_path = \\[")
                 (string-append "python_path = ['"
-                               (find (lambda (entry)
-                                       (string-prefix?
-                                        (assoc-ref inputs "python-pytz")
-                                        entry))
-                                     (string-split (getenv "PYTHONPATH")
-                                                   #\:))
+                               (string-join
+                                (string-split (getenv "PYTHONPATH") #\:)
+                                "','")
                                "', ")))
-             (invoke "python" "tests/runtests.py"))))))
+
+             #t))
+         (replace 'check
+           (lambda _
+             (with-directory-excursion "tests"
+               (setenv "PYTHONPATH"
+                       (string-append "..:" (getenv "PYTHONPATH")))
+               (invoke "python" "runtests.py"
+                       ;; By default tests run in parallel, which may cause
+                       ;; various race conditions.  Run sequentially for
+                       ;; consistent results.
+                       "--parallel=1")))))))
     ;; TODO: Install extras/django_bash_completion.
     (native-inputs
      `(("tzdata" ,tzdata-for-tests)
@@ -99,6 +112,7 @@
        ("python-tblib" ,python-tblib)))
     (propagated-inputs
      `(("python-argon2-cffi" ,python-argon2-cffi)
+       ("python-asgiref" ,python-asgiref)
        ("python-bcrypt" ,python-bcrypt)
        ("python-pytz" ,python-pytz)))
     (home-page "https://www.djangoproject.com/";)
@@ -125,6 +139,21 @@ to the @dfn{don't repeat yourself} (DRY) principle.")
          ;; required.
          ,@(package-native-inputs base))))))
 
+(define-public python-django-2.2
+  (package
+    (inherit python-django)
+    (version "2.2.16")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "Django" version))
+              (sha256
+               (base32
+                "1535g2r322cl4x52fb0dmzlbg23539j2wx6027j54p22xvjlbkv2"))))
+    (native-inputs
+     `(;; XXX: In 2.2 and 3.0, selenium is required for the test suite.
+       ("python-selenium" ,python-selenium)
+       ,@(package-native-inputs python-django)))))
+
 (define-public python-django-extensions
   (package
     (name "python-django-extensions")
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index c9edde6..2f26cf0 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -3118,7 +3118,7 @@ which sends emails to HyperKitty, the official Mailman3 
web archiver.")
                      "--settings=hyperkitty.tests.settings_test"))))))
     (propagated-inputs
      `(("python-dateutil" ,python-dateutil)
-       ("python-django" ,python-django)
+       ("python-django" ,python-django-2.2)
        ("python-django-compressor" ,python-django-compressor)
        ("python-django-extensions" ,python-django-extensions)
        ("python-django-gravatar2" ,python-django-gravatar2)
diff --git a/gnu/packages/patchutils.scm b/gnu/packages/patchutils.scm
index c26977b..335d251 100644
--- a/gnu/packages/patchutils.scm
+++ b/gnu/packages/patchutils.scm
@@ -467,7 +467,7 @@ if __name__ == \"__main__\":
     (inputs
      `(("python-wrapper" ,python-wrapper)))
     (propagated-inputs
-     `(("python-django" ,python-django)
+     `(("python-django" ,python-django-2.2)
        ;; TODO: Make this configurable
        ("python-psycopg2" ,python-psycopg2)
        ("python-mysqlclient" ,python-mysqlclient)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]