Subject: [bug#65758] [PATCH v6 23/55] gnu: python-django-sortedm2m: Update to 3.1.1-0-ddf321f.

From: Nicolas Graves <[email-masked]>
Date: Tue, 5 Sep 2023 18:30:59 +0200

* gnu/packages/django.scm (python-django-sortedm2m): Update to 3.1.1-0-ddf321f.
[build-system]: Use pyproject-build-system.
[arguments](tests?): Disable tests.
(phases): Execute phase 'check command when tests?.
[native-inputs]: Add python-psycopg2.
---
 gnu/packages/django.scm | 57 ++++++++++++++++++++++++-----------------
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index b5830234b4..a741eb64a0 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -973,32 +973,41 @@ (define-public python-django-q
     (license license:expat)))
 
 (define-public python-django-sortedm2m
-  (package
-    (name "python-django-sortedm2m")
-    (version "3.0.2")
-    (source (origin
-              (method url-fetch)
-              (uri (pypi-uri "django-sortedm2m" version))
-              (sha256
-               (base32
-                "0z0yymmrr2l5cznqbzwziw624df0qsiflvbpqwrpan52nww3dk4a"))))
-    (build-system python-build-system)
-    (arguments
-     `(#:phases (modify-phases %standard-phases
-                  (replace 'check
-                    (lambda _
-                      (invoke "django-admin"
-                              "test" "--settings=test_project.settings"
-                              "--pythonpath=."))))))
-    (propagated-inputs
-     (list python-django-3.2))
-    (home-page "https://github.com/jazzband/django-sortedm2m")
-    (synopsis "Drop-in replacement for django's own ManyToManyField")
-    (description
-      "Sortedm2m is a drop-in replacement for django's own ManyToManyField.
+  (let ((commit "ddf321fc9736b9a9477d496c60250270111cf2ce")
+        (revision "0"))
+    (package
+      (name "python-django-sortedm2m")
+      (version (git-version "3.1.1" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/jazzband/django-sortedm2m")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "1j08xyvlc5dypd26p48v0dj3k5g5ssrygvdy8zgg64g3iw8sw7v3"))))
+      (build-system pyproject-build-system)
+      (arguments
+       `(#:tests? #f ; require a running postgresql server
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'check
+             (lambda* (#:key tests? #:allow-other-keys)
+               (when tests?
+                 (invoke "django-admin"
+                         "test" "--settings=test_project.settings"
+                         "--pythonpath=.")))))))
+      (native-inputs
+       (list python-psycopg2))
+      (propagated-inputs
+       (list python-django))
+      (home-page "https://github.com/jazzband/django-sortedm2m")
+      (synopsis "Drop-in replacement for django's own ManyToManyField")
+      (description
+       "Sortedm2m is a drop-in replacement for django's own ManyToManyField.
 The provided SortedManyToManyField behaves like the original one but remembers
 the order of added relations.")
-    (license license:bsd-3)))
+      (license license:bsd-3))))
 
 (define-public python-django-appconf
   (package
-- 
2.41.0