From 3338a93f448c158069981917a7a95549c92f6f38 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Thu, 27 Feb 2025 17:48:24 +0100 Subject: [PATCH 1/5] beets: modernize --- pkgs/tools/audio/beets/common.nix | 7 +++++-- pkgs/tools/audio/beets/default.nix | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 07db91eba091..989796bdbfdc 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -8,6 +8,7 @@ gst_all_1, python3Packages, sphinxHook, + writableTmpDirAsHomeHook, runtimeShell, writeScript, @@ -145,6 +146,9 @@ python3Packages.buildPythonApplication { rarfile responses ] + ++ [ + writableTmpDirAsHomeHook + ] ++ pluginWrapperBins; __darwinAllowLocalNetworking = true; @@ -170,8 +174,7 @@ python3Packages.buildPythonApplication { | sort -u > plugins_available ${diffPlugins (attrNames builtinPlugins) "plugins_available"} - export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc" - export HOME="$(mktemp -d)" + export BEETS_TEST_SHELL="${lib.getExe bashInteractive} --norc" env EDITOR="${writeScript "beetconfig.sh" '' #!${runtimeShell} diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 74abd34e13b7..a9cd1a9bdfb9 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -38,7 +38,7 @@ lib.makeExtensible (self: { src = fetchFromGitHub { owner = "beetbox"; repo = "beets"; - rev = "v${version}"; + tag = "v${version}"; hash = "sha256-jhwXRgUUQJgQ/PLwvY1UfHCJ9UC8DcdBpE/janao0RM="; }; }; From 5f8ae668ae2cf9f3bfaac5d2fad441ef87a713a3 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 28 Feb 2025 00:06:36 +0100 Subject: [PATCH 2/5] beets: fetch patch to fix IMBackend --- pkgs/tools/audio/beets/common.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 989796bdbfdc..145055caf6e0 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -2,6 +2,7 @@ lib, src, version, + fetchpatch, bashInteractive, diffPlugins, gobject-introspection, @@ -79,7 +80,19 @@ python3Packages.buildPythonApplication { inherit src version; pyproject = true; - patches = extraPatches; + patches = [ + (fetchpatch { + # Already on master. TODO: remove when updating to the next release + # Issue: https://github.com/beetbox/beets/issues/5527 + # PR: https://github.com/beetbox/beets/pull/5650 + name = "fix-im-backend"; + url = "https://github.com/beetbox/beets/commit/1f938674015ee71431fe9bd97c2214f58473efd2.patch"; + hash = "sha256-koCYeiUhk1ifo6CptOSu3p7Nz0FFUeiuArTknM/tpVQ="; + excludes = [ + "docs/changelog.rst" + ]; + }) + ] ++ extraPatches; build-system = [ python3Packages.poetry-core From 75bddc6a8fb8257d4397837b0f07385167fb5758 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 28 Feb 2025 01:08:52 +0100 Subject: [PATCH 3/5] beets: disable flaky tests on darwin --- pkgs/tools/audio/beets/common.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 145055caf6e0..ed070d8fb4d5 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -1,5 +1,6 @@ { lib, + stdenv, src, version, fetchpatch, @@ -166,10 +167,19 @@ python3Packages.buildPythonApplication { __darwinAllowLocalNetworking = true; - disabledTestPaths = disabledTestPaths ++ [ - # touches network - "test/plugins/test_aura.py" - ]; + disabledTestPaths = + disabledTestPaths + ++ [ + # touches network + "test/plugins/test_aura.py" + ] + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + # Flaky: several tests fail randomly with: + # if not self._poll(timeout): + # raise Empty + # _queue.Empty + "test/plugins/test_player.py" + ]; disabledTests = disabledTests ++ [ # beets.ui.UserError: unknown command 'autobpm' "test/plugins/test_autobpm.py::TestAutoBPMPlugin::test_import" From f3060e1468dbeafeb46f0455ea9ae9de4faee925 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 28 Feb 2025 09:11:01 +0100 Subject: [PATCH 4/5] beetsPackages.alternatives: modernize --- .../audio/beets/plugins/alternatives.nix | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/pkgs/tools/audio/beets/plugins/alternatives.nix b/pkgs/tools/audio/beets/plugins/alternatives.nix index d2520fcaca63..bcd35f8de701 100644 --- a/pkgs/tools/audio/beets/plugins/alternatives.nix +++ b/pkgs/tools/audio/beets/plugins/alternatives.nix @@ -3,6 +3,7 @@ fetchFromGitHub, beets, python3Packages, + writableTmpDirAsHomeHook, }: python3Packages.buildPythonApplication rec { @@ -13,28 +14,34 @@ python3Packages.buildPythonApplication rec { src = fetchFromGitHub { repo = "beets-alternatives"; owner = "geigerzaehler"; - rev = "refs/tags/v${version}"; - sha256 = "sha256-i67Bzdh84TuVwcgwo5SgHFp1W04KF3VA6cbrFz82je0="; + tag = "v${version}"; + hash = "sha256-i67Bzdh84TuVwcgwo5SgHFp1W04KF3VA6cbrFz82je0="; }; nativeBuildInputs = [ beets + ]; + + dependencies = [ python3Packages.poetry-core ]; - nativeCheckInputs = with python3Packages; [ - pytestCheckHook - pytest-cov - mock - typeguard - ]; - preCheck = '' - export HOME=$(mktemp -d) - ''; + nativeCheckInputs = + with python3Packages; + [ + pytestCheckHook + pytest-cov-stub + mock + typeguard + ] + ++ [ + writableTmpDirAsHomeHook + ]; meta = { description = "Beets plugin to manage external files"; homepage = "https://github.com/geigerzaehler/beets-alternatives"; + changelog = "https://github.com/geigerzaehler/beets-alternatives/blob/v${version}/CHANGELOG.md"; maintainers = with lib.maintainers; [ aszlig lovesegfault From 2b3b74c58e51fd92161ef4a9416f7cb2897bab1e Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Fri, 28 Feb 2025 09:18:47 +0100 Subject: [PATCH 5/5] beetsPackages.alternatives: 0.13.0 -> 0.13.1 Diff: https://github.com/geigerzaehler/beets-alternatives/compare/refs/tags/v0.13.0...v0.13.1 Changelog: https://github.com/geigerzaehler/beets-alternatives/blob/v0.13.1/CHANGELOG.md --- pkgs/tools/audio/beets/plugins/alternatives.nix | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/audio/beets/plugins/alternatives.nix b/pkgs/tools/audio/beets/plugins/alternatives.nix index bcd35f8de701..4df52d61d45c 100644 --- a/pkgs/tools/audio/beets/plugins/alternatives.nix +++ b/pkgs/tools/audio/beets/plugins/alternatives.nix @@ -8,14 +8,14 @@ python3Packages.buildPythonApplication rec { pname = "beets-alternatives"; - version = "0.13.0"; + version = "0.13.1"; pyproject = true; src = fetchFromGitHub { repo = "beets-alternatives"; owner = "geigerzaehler"; tag = "v${version}"; - hash = "sha256-i67Bzdh84TuVwcgwo5SgHFp1W04KF3VA6cbrFz82je0="; + hash = "sha256-+LvQC7hYtbJeWJiDEKtSFZaEtnuXZ+4mI75rrX9Sd64="; }; nativeBuildInputs = [ @@ -38,6 +38,12 @@ python3Packages.buildPythonApplication rec { writableTmpDirAsHomeHook ]; + disabledTests = [ + # ValueError: too many values to unpack (expected 2) + # https://github.com/geigerzaehler/beets-alternatives/issues/122 + "test_embed_art" + ]; + meta = { description = "Beets plugin to manage external files"; homepage = "https://github.com/geigerzaehler/beets-alternatives";