summary refs log tree commit diff
path: root/gnu/packages/django.scm
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2022-08-30 20:18:55 +0200
committerMarius Bakke <marius@gnu.org>2022-08-30 20:18:55 +0200
commit59c136ef611b7a00683af1d1bb406dbd1af1a2bd (patch)
tree1ab434580130c7fd11b8ef5c22a91087b8401559 /gnu/packages/django.scm
parenta6f42953626df657041fddfc36a207b06c38f944 (diff)
parentd62fc2cc837b095ff1a633ae2639513ea3253596 (diff)
downloadguix-59c136ef611b7a00683af1d1bb406dbd1af1a2bd.tar.gz
Merge branch 'staging' into core-updates
Diffstat (limited to 'gnu/packages/django.scm')
-rw-r--r--gnu/packages/django.scm51
1 files changed, 51 insertions, 0 deletions
diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index b9144f32bc..5e03155d2d 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -1359,3 +1359,54 @@ Django's filtering system in ORM).")
 models that use Django's standard @code{ImageField}, in addition to the
 image files already supported by it.")
     (license license:expat)))
+
+(define-public python-django-cleanup
+  (package
+    (name "python-django-cleanup")
+    (version "6.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/un1t/django-cleanup")
+             (commit (string-append version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0c1nghn1bnlq0a4d3sy3s363ksqsnxksixbimdy3cc6a0vk4sjps"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-tests-settings
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; django-cleanup optionally integrates with
+             ;; sorl-thumbnail, which is not available in Guix yet, so
+             ;; this patch comments it out to avoid import failures in
+             ;; test settings.
+             (substitute* "django_cleanup/testapp/settings.py"
+               (("'sorl\\.thumbnail',") "# 'sorl.thumbnail',"))))
+         (replace 'check
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               ;; Add CWD to PYTHONPATH so that the tests can find the
+               ;; testapp package in the source.
+               (setenv "PYTHONPATH" (getcwd))
+               (invoke "pytest")))))))
+    (native-inputs
+     (list ;; python-django-sorl-thumbnail  ; TODO: Add to Guix.
+           python-easy-thumbnails
+           python-pillow
+           python-pytest
+           python-pytest-cov
+           python-pytest-django
+           python-pytest-xdist))
+    (propagated-inputs
+     (list python-django))
+    (home-page "https://github.com/un1t/django-cleanup")
+    (synopsis "Automatically deletes unused media files")
+    (description "This application automatically deletes user-uploaded
+files when a model is modified or deleted.  It works for FileField,
+ImageField and their subclasses.  Files set as default values for any
+FileField are not deleted.")
+    (license license:expat)))