1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, fetchPypi
6, babel
7, markupsafe
8, pytestCheckHook
9, sphinxHook
10, pallets-sphinx-themes
11, sphinxcontrib-log-cabinet
12, sphinx-issues
13, enableDocumentation ? false
14}:
15
16buildPythonPackage rec {
17 pname = "Jinja2";
18 version = "3.1.2";
19 outputs = [ "out" ] ++ lib.optional enableDocumentation "doc";
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-MTUacCpAip51laj8YVD8P0O7a/fjGXcMvA2535Q36FI=";
26 };
27
28 patches = lib.optionals enableDocumentation [ ./patches/import-order.patch ];
29
30 propagatedBuildInputs = [
31 babel
32 markupsafe
33 ];
34
35 nativeBuildInputs = lib.optionals enableDocumentation [
36 sphinxHook
37 sphinxcontrib-log-cabinet
38 pallets-sphinx-themes
39 sphinx-issues
40 ];
41
42 # Multiple tests run out of stack space on 32bit systems with python2.
43 # See https://github.com/pallets/jinja/issues/1158
44 doCheck = !stdenv.is32bit;
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 ];
49
50 pytestFlagsArray = [
51 # Avoid failure due to deprecation warning
52 # Fixed in https://github.com/python/cpython/pull/28153
53 # Remove after cpython 3.9.8
54 "-p no:warnings"
55 ];
56
57 meta = with lib; {
58 homepage = "https://jinja.palletsprojects.com/";
59 description = "Stand-alone template engine";
60 license = licenses.bsd3;
61 longDescription = ''
62 Jinja is a fast, expressive, extensible templating engine. Special
63 placeholders in the template allow writing code similar to Python
64 syntax. Then the template is passed data to render the final document.
65 an optional sandboxed environment.
66 '';
67 maintainers = with maintainers; [ pierron ];
68 };
69}