From 5b69bffd3ab740aa34651ae672f86d22f0fb72de Mon Sep 17 00:00:00 2001 From: Sigmanificient Date: Tue, 13 Aug 2024 22:04:50 +0200 Subject: [PATCH 1/2] python312Packages.scales: run tests using pytestCheckHook --- .../python-modules/scales/default.nix | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/scales/default.nix b/pkgs/development/python-modules/scales/default.nix index ff9ab853e5c92..c620c23119f1f 100644 --- a/pkgs/development/python-modules/scales/default.nix +++ b/pkgs/development/python-modules/scales/default.nix @@ -2,7 +2,8 @@ lib, buildPythonPackage, fetchPypi, - nose, + pytestCheckHook, + fetchpatch2, six, }: @@ -16,11 +17,24 @@ buildPythonPackage rec { sha256 = "8b6930f7d4bf115192290b44c757af5e254e3fcfcb75ff9a51f5c96a404e2753"; }; - nativeCheckInputs = [ nose ]; - propagatedBuildInputs = [ six ]; + patches = [ + # Use html module in Python 3 and cgi module in Python 2 + # https://github.com/Cue/scales/pull/47 + (fetchpatch2 { + url = "https://github.com/Cue/scales/commit/ee69d45f1a7f928f7b241702e9be06007444115e.patch?full_index=1"; + hash = "sha256-xBlgkh1mf+3J7GtNI0zGb7Sum8UYbTpUmM12sxK/fSU="; + }) + ]; + + postPatch = '' + for file in scales_test formats_test aggregation_test; do + substituteInPlace src/greplin/scales/$file.py \ + --replace-fail "assertEquals" "assertEqual" + done; + ''; - # No tests included - doCheck = false; + nativeCheckInputs = [ pytestCheckHook ]; + propagatedBuildInputs = [ six ]; meta = with lib; { description = "Stats for Python processes"; From 6305fa4849e5a2d9dbee71b46f7bb2253908ee75 Mon Sep 17 00:00:00 2001 From: Pyrox Date: Mon, 14 Oct 2024 12:01:52 -0400 Subject: [PATCH 2/2] python312Packages.scales: modernize; adopt --- .../development/python-modules/scales/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/scales/default.nix b/pkgs/development/python-modules/scales/default.nix index c620c23119f1f..e258bdf045f23 100644 --- a/pkgs/development/python-modules/scales/default.nix +++ b/pkgs/development/python-modules/scales/default.nix @@ -5,16 +5,17 @@ pytestCheckHook, fetchpatch2, six, + setuptools, }: buildPythonPackage rec { pname = "scales"; version = "1.0.9"; - format = "setuptools"; + pyproject = true; src = fetchPypi { inherit pname version; - sha256 = "8b6930f7d4bf115192290b44c757af5e254e3fcfcb75ff9a51f5c96a404e2753"; + hash = "sha256-i2kw99S/EVGSKQtEx1evXiVOP8/Ldf+aUfXJakBOJ1M="; }; patches = [ @@ -33,12 +34,16 @@ buildPythonPackage rec { done; ''; + build-system = [ setuptools ]; + + dependencies = [ six ]; + nativeCheckInputs = [ pytestCheckHook ]; - propagatedBuildInputs = [ six ]; - meta = with lib; { + meta = { description = "Stats for Python processes"; homepage = "https://www.github.com/Cue/scales"; - license = licenses.asl20; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ pyrox0 ]; }; }