Subject: [PATCH] gnu: python-django-compressor: Add missing files.

From: Evgeny Pisemsky <[email-masked]>
Date: Sat, 19 Apr 2025 14:34:32 +0300

* gnu/packages/django.scm (python-django-compressor): Add missing files.
[arguments] <phases>: Remove 'add-missing-init-files, add 'add-missing-files
to recursively copy all necessary non-python files. In 'check phase change
directory to run tests against installed package.

Change-Id: Iec7139607510ae09972241f459376750b3d7e461
---
 gnu/packages/django.scm | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index 461affdef9..aedd83a52e 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -1468,15 +1468,19 @@ (define-public python-django-compressor
             (substitute* "compressor/tests/test_filters.py"
               (("test_calmjs_filter") "_test_calmjs_filter"))))
         ;; TODO: Report upstream.
-        (add-after 'unpack 'add-missing-init-files
-          (lambda _
-            (call-with-output-file "compressor/templates/__init__.py"
-              (const #t))
-            (call-with-output-file "compressor/templates/compressor/__init__.py"
-              (const #t))))
+        (add-after 'install 'add-missing-files
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let ((sitedir (site-packages inputs outputs)))
+              (for-each (lambda (dir)
+                          (copy-recursively dir (string-append sitedir "/" dir)))
+                        '("compressor/templates/compressor"
+                          "compressor/tests/static"
+                          "compressor/tests/test_templates"
+                          "compressor/tests/test_templates_jinja2")))))
         (replace 'check
-          (lambda* (#:key tests? #:allow-other-keys)
+          (lambda* (#:key tests? inputs outputs #:allow-other-keys)
             (when tests?
+              (chdir (site-packages inputs outputs))
               (setenv "DJANGO_SETTINGS_MODULE" "compressor.test_settings")
               (invoke "django-admin" "test"
                       "--pythonpath=.")))))))

base-commit: b276cf2f9785c71cc37688c3e2b1db38e2c710a1
-- 
2.49.0