[bug#33185,4/7] gnu: Add python-django-jinja.

Message ID 20181104104455.3527-4-mail@cbaines.net
State New
Headers show
Series
  • [bug#33185,1/7] gnu: Add python-jsmin.
Related show

Checks

Context Check Description
cbaines/applying patch success Successfully applied

Commit Message

Christopher Baines Nov. 4, 2018, 10:44 a.m. UTC
* gnu/packages/django.scm (python-django-jinja, python2-django-jinja): New
variables.
---
 gnu/packages/django.scm | 49 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

Comments

Ludovic Courtès Nov. 19, 2018, 4:33 p.m. UTC | #1
Christopher Baines <mail@cbaines.net> skribis:

> * gnu/packages/django.scm (python-django-jinja, python2-django-jinja): New
> variables.

[...]

> +    (home-page
> +     "https://niwinz.github.io/django-jinja/latest/")
> +    (synopsis "Simple and nonobstructive jinja2 backend for Django")
> +    (description
> +     "Jinja2 provides certain advantages over the native system of Django, for
> +example, explicit calls to callable from templates and better performance.
> +@code{django-jinja} is a alternative to the jinja2 backend built in to Django.")

This is not crystal-clear to someone unfamiliar with Django and Jinja,
so bonus points if you can come up with a clearer synopsis and
description.  Otherwise LGTM!
Christopher Baines Nov. 20, 2018, 8:02 p.m. UTC | #2
Ludovic Courtès <ludo@gnu.org> writes:

> Christopher Baines <mail@cbaines.net> skribis:
>
>> * gnu/packages/django.scm (python-django-jinja, python2-django-jinja): New
>> variables.
>
> [...]
>
>> +    (home-page
>> +     "https://niwinz.github.io/django-jinja/latest/")
>> +    (synopsis "Simple and nonobstructive jinja2 backend for Django")
>> +    (description
>> +     "Jinja2 provides certain advantages over the native system of Django, for
>> +example, explicit calls to callable from templates and better performance.
>> +@code{django-jinja} is a alternative to the jinja2 backend built in to Django.")
>
> This is not crystal-clear to someone unfamiliar with Django and Jinja,
> so bonus points if you can come up with a clearer synopsis and
> description.  Otherwise LGTM!

Yep, I've made another pass at the synopsis and description, which is
hopefully much clearer now, and pushed this. Somehow I'd neglected to
mention that this related to templates!

Patch

diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index 589ba282e..48f36835d 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -338,6 +338,55 @@  merging, minifying and compiling CSS and Javascript files.")
 (define-public python2-django-assets
   (package-with-python2 python-django-assets))
 
+(define-public python-django-jinja
+  (package
+    (name "python-django-jinja")
+    (version "2.4.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/niwinz/django-jinja/archive/"
+             version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0bzrb4m6wx9ph5cpvz7wpvg5k6ksvj0dnxlg0nhhqskhvp46brs1"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-django" ,python-django)
+       ("python-jinja2" ,python-jinja2)
+       ("python-pytz" ,python-pytz)
+       ("python-django-pipeline" ,python-django-pipeline)))
+    (arguments
+     '(;; TODO Tests currently fail due to issues with the configuration for
+       ;; django-pipeline
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (or
+              (not tests?)
+              (with-directory-excursion "testing"
+                (invoke "python" "runtests.py"))))))))
+    (home-page
+     "https://niwinz.github.io/django-jinja/latest/")
+    (synopsis "Simple and nonobstructive jinja2 backend for Django")
+    (description
+     "Jinja2 provides certain advantages over the native system of Django, for
+example, explicit calls to callable from templates and better performance.
+@code{django-jinja} is a alternative to the jinja2 backend built in to Django.")
+    (license license:bsd-3)))
+
+(define-public python2-django-jinja
+  (let ((base (package-with-python2 (strip-python2-variant python-django-jinja))))
+    (package
+      (inherit base)
+      (native-inputs
+       `(("python2-mock" ,python2-mock)
+         ,@(package-native-inputs base))))))
+
 (define-public python-django-jsonfield
   (package
     (name "python-django-jsonfield")