From 47ae218d9e88339552b01be270af2269183e6c6a Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 20 Nov 2020 19:17:56 +0100 Subject: [PATCH 1/2] pythonPackages.staticjinja: enable tests and: * fetch from github (tests on pypi get somehow disabled) * formatting --- .../python-modules/staticjinja/default.nix | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/staticjinja/default.nix b/pkgs/development/python-modules/staticjinja/default.nix index cba55e5aca28..d49bae2eab91 100644 --- a/pkgs/development/python-modules/staticjinja/default.nix +++ b/pkgs/development/python-modules/staticjinja/default.nix @@ -1,24 +1,45 @@ { lib -, fetchPypi +, fetchFromGitHub , buildPythonPackage +, isPy27 , docopt , easywatch , jinja2 +, pytestCheckHook +, markdown }: buildPythonPackage rec { pname = "staticjinja"; version = "0.4.0"; - src = fetchPypi { - inherit pname version; - sha256 = "597837899008409359680ee9cd04779639b9c0eb3380b6545025d26a702ba36c"; + disabled = isPy27; # 0.4.0 drops python2 support + + # For some reason, in pypi the tests get disabled when using + # PY_IGNORE_IMPORTMISMATCH, so we just fetch from GitHub + src = fetchFromGitHub { + owner = "staticjinja"; + repo = pname; + rev = version; + sha256 = "0pysk8pzmcg1nfxz8m4i6bvww71w2zg6xp33zgg5vrf8yd2dfx9i"; }; - propagatedBuildInputs = [ jinja2 docopt easywatch ]; + propagatedBuildInputs = [ + jinja2 + docopt + easywatch + ]; - # There are no tests on pypi - doCheck = false; + checkInputs = [ + pytestCheckHook + markdown + ]; + + # Import paths differ by a "build/lib" subdirectory, but the files are + # the same, so we ignore import mismatches. + preCheck = '' + export PY_IGNORE_IMPORTMISMATCH=1 + ''; meta = with lib; { description = "A library and cli tool that makes it easy to build static sites using Jinja2"; @@ -27,4 +48,3 @@ buildPythonPackage rec { maintainers = with maintainers; [ fgaz ]; }; } - From 52228daa3a9ecd4badc07792ea8c6508ff90ed12 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Fri, 20 Nov 2020 19:20:09 +0100 Subject: [PATCH 2/2] staticjinja: lift to top level Most user will probably use the cli tool --- pkgs/top-level/all-packages.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 4dfdcfd3ae0a..3df684c91c09 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7621,6 +7621,8 @@ in stabber = callPackage ../misc/stabber { }; + staticjinja = with python3.pkgs; toPythonApplication staticjinja; + stress = callPackage ../tools/system/stress { }; stress-ng = callPackage ../tools/system/stress-ng { };