diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/jinja2/default.nix')
-rw-r--r-- | nixpkgs/pkgs/development/python-modules/jinja2/default.nix | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/jinja2/default.nix b/nixpkgs/pkgs/development/python-modules/jinja2/default.nix index 1fb7b26db5b3..1b154f90d386 100644 --- a/nixpkgs/pkgs/development/python-modules/jinja2/default.nix +++ b/nixpkgs/pkgs/development/python-modules/jinja2/default.nix @@ -1,5 +1,6 @@ { lib , stdenv +, python , buildPythonPackage , pythonOlder , fetchPypi @@ -10,13 +11,11 @@ , pallets-sphinx-themes , sphinxcontrib-log-cabinet , sphinx-issues -, enableDocumentation ? false }: buildPythonPackage rec { pname = "Jinja2"; version = "3.1.2"; - outputs = [ "out" ] ++ lib.optional enableDocumentation "doc"; disabled = pythonOlder "3.7"; @@ -25,20 +24,11 @@ buildPythonPackage rec { hash = "sha256-MTUacCpAip51laj8YVD8P0O7a/fjGXcMvA2535Q36FI="; }; - patches = lib.optionals enableDocumentation [ ./patches/import-order.patch ]; - propagatedBuildInputs = [ babel markupsafe ]; - nativeBuildInputs = lib.optionals enableDocumentation [ - sphinxHook - sphinxcontrib-log-cabinet - pallets-sphinx-themes - sphinx-issues - ]; - # Multiple tests run out of stack space on 32bit systems with python2. # See https://github.com/pallets/jinja/issues/1158 doCheck = !stdenv.is32bit; @@ -54,6 +44,35 @@ buildPythonPackage rec { "-p no:warnings" ]; + passthru = { + doc = stdenv.mkDerivation { + # Forge look and feel of multi-output derivation as best as we can. + # + # Using 'outputs = [ "doc" ];' breaks a lot of assumptions. + name = "${pname}-${version}-doc"; + inherit src pname version; + + patches = [ + # Fix import of "sphinxcontrib-log-cabinet" + ./patches/import-order.patch + ]; + + postInstallSphinx = '' + mv $out/share/doc/* $out/share/doc/python$pythonVersion-$pname-$version + ''; + + nativeBuildInputs = [ + sphinxHook + sphinxcontrib-log-cabinet + pallets-sphinx-themes + sphinx-issues + ]; + + inherit (python) pythonVersion; + inherit meta; + }; + }; + meta = with lib; { homepage = "https://jinja.palletsprojects.com/"; description = "Stand-alone template engine"; |