From a5afd9b6b71408ed83b0892e8c212349d48cc38f Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Wed, 19 Jun 2024 01:51:56 +0200 Subject: [PATCH] python312Packages.hdmedians: modernize, fix testing, adopt --- .../python-modules/hdmedians/default.nix | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/pkgs/development/python-modules/hdmedians/default.nix b/pkgs/development/python-modules/hdmedians/default.nix index c36314947e10b..2d7143a9a9be7 100644 --- a/pkgs/development/python-modules/hdmedians/default.nix +++ b/pkgs/development/python-modules/hdmedians/default.nix @@ -1,40 +1,65 @@ { lib, buildPythonPackage, + pythonOlder, fetchPypi, - nose, cython, + oldest-supported-numpy, + setuptools, numpy, + nose, }: buildPythonPackage rec { - version = "0.14.2"; - format = "setuptools"; pname = "hdmedians"; + version = "0.14.2"; + pyproject = true; src = fetchPypi { inherit pname version; sha256 = "b47aecb16771e1ba0736557255d80ae0240b09156bff434321de559b359ac2d6"; }; - # nose was specified in setup.py as a build dependency... - buildInputs = [ + # nose was marked as a build-time dependency, but is only used for testing + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "'nose>=1.0', " "" + ''; + + build-system = [ cython - nose + oldest-supported-numpy + setuptools ]; - propagatedBuildInputs = [ numpy ]; - # cannot resolve path for packages in tests - doCheck = false; + dependencies = [ numpy ]; + + # nose no longer builds on python >=3.12 + doCheck = pythonOlder "3.12"; + + nativeCheckInputs = [ nose ]; checkPhase = '' - nosetests + runHook preCheck + + # force python to resolve the package from $out, where the cython ext files actually exist + mv hdmedians/tests tests + rm -r hdmedians + + nosetests tests + + runHook postCheck ''; - meta = with lib; { + pythonImportsCheck = [ + "hdmedians" + "hdmedians.geomedian" # ext + ]; + + meta = { homepage = "https://github.com/daleroberts/hdmedians"; description = "High-dimensional medians"; - license = licenses.gpl3; - maintainers = [ ]; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ tomasajt ]; }; }