diff options
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/staticjinja')
4 files changed, 82 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/staticjinja/default.nix b/nixpkgs/pkgs/development/python-modules/staticjinja/default.nix new file mode 100644 index 000000000000..a0e6659d0d25 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/staticjinja/default.nix @@ -0,0 +1,69 @@ +{ lib +, fetchFromGitHub +, buildPythonPackage +, poetry-core +, docopt-ng +, easywatch +, jinja2 +, pytestCheckHook +, pytest-check +, pythonOlder +, markdown +, testers +, tomlkit +, typing-extensions +, staticjinja +, callPackage +}: + +buildPythonPackage rec { + pname = "staticjinja"; + version = "5.0.0"; + format = "pyproject"; + + disabled = pythonOlder "3.6"; + + # No tests in pypi + src = fetchFromGitHub { + owner = "staticjinja"; + repo = pname; + rev = version; + hash = "sha256-LfJTQhZtnTOm39EWF1m2MP5rxz/5reE0G1Uk9L7yx0w="; + }; + + nativeBuildInputs = [ + poetry-core + ]; + + propagatedBuildInputs = [ + jinja2 + docopt-ng + easywatch + ]; + + nativeCheckInputs = [ + pytestCheckHook + pytest-check + markdown + tomlkit + typing-extensions + ]; + + # The tests need to find and call the installed staticjinja executable + preCheck = '' + export PATH="$PATH:$out/bin"; + ''; + + passthru.tests = { + version = testers.testVersion { package = staticjinja; }; + minimal-template = callPackage ./test-minimal-template {}; + }; + + meta = with lib; { + description = "A library and cli tool that makes it easy to build static sites using Jinja2"; + mainProgram = "staticjinja"; + homepage = "https://staticjinja.readthedocs.io/en/latest/"; + license = licenses.mit; + maintainers = with maintainers; [ fgaz ]; + }; +} diff --git a/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/default.nix b/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/default.nix new file mode 100644 index 000000000000..e51a619c9e90 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/default.nix @@ -0,0 +1,11 @@ +{ stdenv, staticjinja }: + +stdenv.mkDerivation { + name = "staticjinja-test-minimal-template"; + meta.timeout = 30; + buildCommand = '' + ${staticjinja}/bin/staticjinja build --srcpath ${./templates} + grep 'Hello World!' index + touch $out + ''; +} diff --git a/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/templates/include b/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/templates/include new file mode 100644 index 000000000000..216e97ce0822 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/templates/include @@ -0,0 +1 @@ +World diff --git a/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/templates/index b/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/templates/index new file mode 100644 index 000000000000..03e1043180d8 --- /dev/null +++ b/nixpkgs/pkgs/development/python-modules/staticjinja/test-minimal-template/templates/index @@ -0,0 +1 @@ +Hello {% include './include' %}! |