From a536753815ff3daecea40dc14892ebee63533031 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sun, 29 Dec 2024 14:13:52 +0100 Subject: [PATCH] python312Packages.librosa: clean and fix tests --- .../python-modules/librosa/default.nix | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/pkgs/development/python-modules/librosa/default.nix b/pkgs/development/python-modules/librosa/default.nix index 2c9e2447e33c..3d005ad8efe1 100644 --- a/pkgs/development/python-modules/librosa/default.nix +++ b/pkgs/development/python-modules/librosa/default.nix @@ -8,7 +8,7 @@ # build-system setuptools, - # runtime + # dependencies audioread, decorator, joblib, @@ -41,12 +41,12 @@ buildPythonPackage rec { src = fetchFromGitHub { owner = "librosa"; repo = "librosa"; - rev = "refs/tags/${version}"; + tag = version; fetchSubmodules = true; # for test data hash = "sha256-0FbKVAFWmcFTW2dR27nif6hPZeIxFWYF1gTm4BEJZ/Q="; }; - nativeBuildInputs = [ setuptools ]; + build-system = [ setuptools ]; patches = [ (fetchpatch2 { @@ -55,6 +55,13 @@ buildPythonPackage rec { url = "https://github.com/librosa/librosa/commit/d0a12c87cdff715ffb8ac1c7383bba1031aa71e4.patch"; hash = "sha256-NHuGo4U1FRikb5OIkycQBvuZ+0OdG/VykTcuhXkLUug="; }) + # Fix numpy2 test incompatibilities + # TODO: remove when updating to the next release + (fetchpatch2 { + name = "numpy2-support-tests"; + url = "https://github.com/librosa/librosa/commit/7eb0a09e703a72a5979049ec546a522c70285aff.patch"; + hash = "sha256-m9UpSDKOAr7qzTtahVQktu259cp8QDYjDChpQV0xuY0="; + }) ]; postPatch = '' @@ -62,7 +69,7 @@ buildPythonPackage rec { --replace-fail "--cov-report term-missing --cov librosa --cov-report=xml " "" ''; - propagatedBuildInputs = [ + dependencies = [ audioread decorator joblib @@ -93,7 +100,7 @@ buildPythonPackage rec { ] ++ optional-dependencies.matplotlib; preCheck = '' - export HOME=$TMPDIR + export HOME=$(mktemp -d) ''; disabledTests = @@ -117,13 +124,19 @@ buildPythonPackage rec { "test_unknown_axis" "test_axis_bound_warning" "test_auto_aspect" + ] + ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [ + # Flaky (numerical comparison fails) + "test_istft_multi" + "test_pitch_shift_multi" + "test_time_stretch_multi" ]; - meta = with lib; { + meta = { description = "Python library for audio and music analysis"; homepage = "https://github.com/librosa/librosa"; changelog = "https://github.com/librosa/librosa/releases/tag/${version}"; - license = licenses.isc; - maintainers = with maintainers; [ GuillaumeDesforges ]; + license = lib.licenses.isc; + maintainers = with lib.maintainers; [ GuillaumeDesforges ]; }; }