From 4eaf80d58581c937a6b4310c33aea028962309e1 Mon Sep 17 00:00:00 2001 From: wxt <3264117476@qq.com> Date: Sat, 7 Dec 2024 19:16:57 +0800 Subject: [PATCH] python312Packages.mrsqm: fix build --- .../python-modules/mrsqm/default.nix | 48 ++++++++++++++----- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/pkgs/development/python-modules/mrsqm/default.nix b/pkgs/development/python-modules/mrsqm/default.nix index 49afd2593d82..5fc8e9ac6daa 100644 --- a/pkgs/development/python-modules/mrsqm/default.nix +++ b/pkgs/development/python-modules/mrsqm/default.nix @@ -1,47 +1,73 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, pythonOlder, cython, fftw, pandas, scikit-learn, numpy, + pip, + setuptools, + pytestCheckHook, }: buildPythonPackage rec { pname = "mrsqm"; version = "0.0.7"; - format = "setuptools"; + pyproject = true; + + build-system = [ + setuptools + ]; disabled = pythonOlder "3.8"; - src = fetchPypi { - inherit pname version; - hash = "sha256-kZwgRazvPCmARcfhLByh1E8VPurrb8gVZc96hFfDOvs="; + src = fetchFromGitHub { + owner = "mlgig"; + repo = "mrsqm"; + tag = "v.${version}"; + hash = "sha256-5K6vCU0HExnmYNThZNDCbEtII9bUGauxDtKkJXe/85Q="; }; buildInputs = [ fftw ]; nativeBuildInputs = [ cython ]; - propagatedBuildInputs = [ + dependencies = [ pandas scikit-learn numpy + pip ]; - # Package has no tests - doCheck = false; + postPatch = '' + substituteInPlace setup.py \ + --replace-fail "'pytest-runner'" "" + substituteInPlace pyproject.toml \ + --replace-fail "numpy==" "numpy>=" + ''; + + preBuild = '' + export HOME=$(mktemp -d) + ''; + + nativeCheckInputs = [ + pytestCheckHook + ]; + + pytestFlagsArray = [ + "tests/mrsqm" + ]; pythonImportsCheck = [ "mrsqm" ]; - meta = with lib; { + meta = { description = "MrSQM (Multiple Representations Sequence Miner) is a time series classifier"; homepage = "https://pypi.org/project/mrsqm"; changelog = "https://github.com/mlgig/mrsqm/releases/tag/v.${version}"; - license = licenses.gpl3Only; - maintainers = with maintainers; [ mbalatsko ]; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ mbalatsko ]; }; }