From 0c520d6ae7d554e680863d4fad332d3e35f49307 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 8 Jun 2024 21:16:24 +0300 Subject: [PATCH 1/5] beets: 1.6.0 -> 2.0.0 --- pkgs/tools/audio/beets/builtin-plugins.nix | 8 +-- pkgs/tools/audio/beets/common.nix | 2 + pkgs/tools/audio/beets/default.nix | 63 ++----------------- .../bash-completion-always-print.patch | 45 ++++++------- .../fix-embedart-imagick-7.1.1-12.patch | 13 ---- .../beets/patches/fix-pillow10-compat.patch | 13 ---- ...nstable-bash-completion-always-print.patch | 45 ------------- 7 files changed, 33 insertions(+), 156 deletions(-) delete mode 100644 pkgs/tools/audio/beets/patches/fix-embedart-imagick-7.1.1-12.patch delete mode 100644 pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch delete mode 100644 pkgs/tools/audio/beets/patches/unstable-bash-completion-always-print.patch diff --git a/pkgs/tools/audio/beets/builtin-plugins.nix b/pkgs/tools/audio/beets/builtin-plugins.nix index 15d7504ccd6c..87b090d6f6de 100644 --- a/pkgs/tools/audio/beets/builtin-plugins.nix +++ b/pkgs/tools/audio/beets/builtin-plugins.nix @@ -1,6 +1,5 @@ { stdenv , aacgain -, essentia-extractor , ffmpeg , flac , imagemagick @@ -16,6 +15,7 @@ deprecated = true; testPaths = [ ]; }; + acousticbrainz.propagatedBuildInputs = [ python3Packages.requests ]; albumtypes = { }; aura = { @@ -87,7 +87,7 @@ mbcollection.testPaths = [ ]; mbsubmit = { }; mbsync = { }; - metasync = { }; + metasync.testPaths = [ ]; missing.testPaths = [ ]; mpdstats.propagatedBuildInputs = [ python3Packages.mpd2 ]; mpdupdate = { @@ -119,12 +119,10 @@ propagatedBuildInputs = with python3Packages; [ pillow pyxdg ]; wrapperBins = [ imagemagick ]; }; - types.testPaths = [ "test/test_types_plugin.py" ]; + types.testPaths = [ "test/plugins/test_types_plugin.py" ]; unimported.testPaths = [ ]; web.propagatedBuildInputs = [ python3Packages.flask ]; zero = { }; - # NOTE: Condition can be removed once stable beets updates -} // lib.optionalAttrs ((lib.versions.majorMinor version) != "1.6") { limit = { }; substitute = { testPaths = [ ]; diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index fd3adbc26c9d..6f45ece8bd59 100644 --- a/pkgs/tools/audio/beets/common.nix +++ b/pkgs/tools/audio/beets/common.nix @@ -94,6 +94,7 @@ python3Packages.buildPythonApplication { nativeBuildInputs = [ gobject-introspection sphinxHook + python3Packages.pydata-sphinx-theme ] ++ extraNativeBuildInputs; buildInputs = [ @@ -119,6 +120,7 @@ python3Packages.buildPythonApplication { nativeCheckInputs = with python3Packages; [ pytestCheckHook + pytest-cov mock rarfile responses diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 513470b0ffd1..833b071ba6e4 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -18,66 +18,23 @@ ** alternatives = { enable = true; propagatedBuildInputs = [ beetsPackages.alternatives ]; }; ** }; } */ -let - legacyMediafilePython3Packages = python3Packages.override { - overrides = self: super: { - mediafile = super.mediafile.overridePythonAttrs (oldAttrs: rec { - version = "0.10.1"; - format = "pyproject"; - src = fetchPypi { - pname = "mediafile"; - inherit version; - hash = "sha256-kpZCoX7lAjuQhiIc6AzcLFHQYCGokNRDOwvVvTLysp8="; - }; - }); - }; - }; -in lib.makeExtensible (self: { +lib.makeExtensible (self: { beets = self.beets-stable; beets-stable = callPackage ./common.nix rec { - python3Packages = legacyMediafilePython3Packages; + inherit python3Packages; # NOTE: ./builtin-plugins.nix and ./common.nix can have some conditionals # be removed when stable version updates - version = "1.6.0"; + version = "2.0.0"; src = fetchFromGitHub { owner = "beetbox"; repo = "beets"; rev = "v${version}"; - hash = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM="; + hash = "sha256-6pmImyopy0zFBDYoqDyWcBv61FK1kGsZwW2+7fzAnq8="; }; extraPatches = [ # Bash completion fix for Nix ./patches/bash-completion-always-print.patch - - # Fix unidecode>=1.3.5 compat - (fetchpatch { - url = "https://github.com/beetbox/beets/commit/5ae1e0f3c8d3a450cb39f7933aa49bb78c2bc0d9.patch"; - hash = "sha256-gqkrE+U1j3tt1qPRJufTGS/GftaSw/gweXunO/mCVG8="; - }) - - # Fix embedart with ImageMagick 7.1.1-12 - # https://github.com/beetbox/beets/pull/4839 - # The upstream patch does not apply on 1.6.0, as the related code has been refactored since - ./patches/fix-embedart-imagick-7.1.1-12.patch - # Pillow 10 compatibility fix, a backport of - # https://github.com/beetbox/beets/pull/4868, which doesn't apply now - ./patches/fix-pillow10-compat.patch - - # Sphinx 6 compatibility fix. - (fetchpatch { - url = "https://github.com/beetbox/beets/commit/2106f471affd1dab35b4b26187b9c74d034528c5.patch"; - hash = "sha256-V/886dYJW/O55VqU8sd+x/URIFcKhP6j5sUhTGMoxL8="; - }) - ]; - disabledTests = [ - # This issue is present on this version alone, and can be removed on the - # next stable version version bump. Since this is fixed in branch master, - # we don't have a bug ticket open for this. As of writing, it also seems - # hard to find a patch that can be backported to v1.6.0 that would fix - # the failure, as the master branch has gone through too many changes - # now. - "test_get_single_item_by_path" ]; }; @@ -94,17 +51,7 @@ in lib.makeExtensible (self: { }; extraPatches = [ # Bash completion fix for Nix - ./patches/unstable-bash-completion-always-print.patch - ]; - pluginOverrides = { - # unstable has new plugins, so we register them here. - limit = { builtin = true; }; - substitute = { builtin = true; }; - advancedrewrite = { builtin = true; }; - autobpm = { builtin = true; }; - }; - extraNativeBuildInputs = [ - python3Packages.pydata-sphinx-theme + ./patches/bash-completion-always-print.patch ]; }; diff --git a/pkgs/tools/audio/beets/patches/bash-completion-always-print.patch b/pkgs/tools/audio/beets/patches/bash-completion-always-print.patch index 8a31fe22f728..96b175117572 100644 --- a/pkgs/tools/audio/beets/patches/bash-completion-always-print.patch +++ b/pkgs/tools/audio/beets/patches/bash-completion-always-print.patch @@ -1,44 +1,45 @@ diff --git i/beets/ui/commands.py w/beets/ui/commands.py -index 3a337401..d08a6763 100755 +index ad4f7821..5077191d 100755 --- i/beets/ui/commands.py +++ w/beets/ui/commands.py -@@ -1759,21 +1759,6 @@ default_commands.append(config_cmd) +@@ -2381,22 +2381,6 @@ default_commands.append(config_cmd) def print_completion(*args): for line in completion_script(default_commands + plugins.commands()): - print_(line, end='') -- if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)): -- log.warning('Warning: Unable to find the bash-completion package. ' -- 'Command line completion might not work.') + print_(line, end="") +- if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS): +- log.warning( +- "Warning: Unable to find the bash-completion package. " +- "Command line completion might not work." +- ) - - --BASH_COMPLETION_PATHS = map(syspath, [ -- '/etc/bash_completion', -- '/usr/share/bash-completion/bash_completion', -- '/usr/local/share/bash-completion/bash_completion', +-BASH_COMPLETION_PATHS = [ +- b"/etc/bash_completion", +- b"/usr/share/bash-completion/bash_completion", +- b"/usr/local/share/bash-completion/bash_completion", - # SmartOS -- '/opt/local/share/bash-completion/bash_completion', +- b"/opt/local/share/bash-completion/bash_completion", - # Homebrew (before bash-completion2) -- '/usr/local/etc/bash_completion', --]) -- +- b"/usr/local/etc/bash_completion", +-] + def completion_script(commands): - """Yield the full completion shell script as strings. diff --git i/test/test_ui.py w/test/test_ui.py -index 9804b0a1..c3b53243 100644 +index cae86148..faf266a8 100644 --- i/test/test_ui.py +++ w/test/test_ui.py -@@ -1229,12 +1229,7 @@ class CompletionTest(_common.TestCase, TestHelper): - stdout=subprocess.PIPE, env=env) +@@ -1434,12 +1434,7 @@ class CompletionTest(_common.TestCase, TestHelper): + ) # Load bash_completion library. - for path in commands.BASH_COMPLETION_PATHS: -- if os.path.exists(util.syspath(path)): +- if os.path.exists(syspath(path)): - bash_completion = path - break - else: -- self.skipTest('bash-completion script not found') -+ self.skipTest('bash-completion script not found') +- self.skipTest("bash-completion script not found") ++ self.skipTest("bash-completion script not found") try: - with open(util.syspath(bash_completion), 'rb') as f: + with open(util.syspath(bash_completion), "rb") as f: tester.stdin.writelines(f) diff --git a/pkgs/tools/audio/beets/patches/fix-embedart-imagick-7.1.1-12.patch b/pkgs/tools/audio/beets/patches/fix-embedart-imagick-7.1.1-12.patch deleted file mode 100644 index 42ae3526e978..000000000000 --- a/pkgs/tools/audio/beets/patches/fix-embedart-imagick-7.1.1-12.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/beets/art.py b/beets/art.py -index 13d5dfbd..ac1d2fd8 100644 ---- a/beets/art.py -+++ b/beets/art.py -@@ -132,7 +132,7 @@ def check_art_similarity(log, item, imagepath, compare_threshold): - convert_cmd = ['convert', syspath(imagepath, prefix=False), - syspath(art, prefix=False), - '-colorspace', 'gray', 'MIFF:-'] -- compare_cmd = ['compare', '-metric', 'PHASH', '-', 'null:'] -+ compare_cmd = ['compare', '-define', 'phash:colorspaces=sRGB,HCLp', '-metric', 'PHASH', '-', 'null:'] - log.debug('comparing images with pipeline {} | {}', - convert_cmd, compare_cmd) - convert_proc = subprocess.Popen( diff --git a/pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch b/pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch deleted file mode 100644 index f85eec20156c..000000000000 --- a/pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git i/beets/util/artresizer.py w/beets/util/artresizer.py -index 8683e228..6f99c79e 100644 ---- i/beets/util/artresizer.py -+++ w/beets/util/artresizer.py -@@ -72,7 +72,7 @@ def pil_resize(maxwidth, path_in, path_out=None, quality=0, max_filesize=0): - try: - im = Image.open(util.syspath(path_in)) - size = maxwidth, maxwidth -- im.thumbnail(size, Image.ANTIALIAS) -+ im.thumbnail(size, Image.Resampling.LANCZOS) - - if quality == 0: - # Use PIL's default quality. diff --git a/pkgs/tools/audio/beets/patches/unstable-bash-completion-always-print.patch b/pkgs/tools/audio/beets/patches/unstable-bash-completion-always-print.patch deleted file mode 100644 index 96b175117572..000000000000 --- a/pkgs/tools/audio/beets/patches/unstable-bash-completion-always-print.patch +++ /dev/null @@ -1,45 +0,0 @@ -diff --git i/beets/ui/commands.py w/beets/ui/commands.py -index ad4f7821..5077191d 100755 ---- i/beets/ui/commands.py -+++ w/beets/ui/commands.py -@@ -2381,22 +2381,6 @@ default_commands.append(config_cmd) - def print_completion(*args): - for line in completion_script(default_commands + plugins.commands()): - print_(line, end="") -- if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS): -- log.warning( -- "Warning: Unable to find the bash-completion package. " -- "Command line completion might not work." -- ) -- -- --BASH_COMPLETION_PATHS = [ -- b"/etc/bash_completion", -- b"/usr/share/bash-completion/bash_completion", -- b"/usr/local/share/bash-completion/bash_completion", -- # SmartOS -- b"/opt/local/share/bash-completion/bash_completion", -- # Homebrew (before bash-completion2) -- b"/usr/local/etc/bash_completion", --] - - - def completion_script(commands): -diff --git i/test/test_ui.py w/test/test_ui.py -index cae86148..faf266a8 100644 ---- i/test/test_ui.py -+++ w/test/test_ui.py -@@ -1434,12 +1434,7 @@ class CompletionTest(_common.TestCase, TestHelper): - ) - - # Load bash_completion library. -- for path in commands.BASH_COMPLETION_PATHS: -- if os.path.exists(syspath(path)): -- bash_completion = path -- break -- else: -- self.skipTest("bash-completion script not found") -+ self.skipTest("bash-completion script not found") - try: - with open(util.syspath(bash_completion), "rb") as f: - tester.stdin.writelines(f) From 5fb83c75ccd2fd820257336bfac9f1c548e3d486 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 8 Jun 2024 21:18:29 +0300 Subject: [PATCH 2/5] beets-unstable: unstable-2024-03-16 -> 2.0.0-unstable-2024-05-25 Switch to the correct format specified by pkgs/README.md --- pkgs/tools/audio/beets/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 833b071ba6e4..caa160cf1764 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -42,12 +42,12 @@ lib.makeExtensible (self: { beets-unstable = callPackage ./common.nix { inherit python3Packages; - version = "unstable-2024-03-16"; + version = "2.0.0-unstable-2024-05-25"; src = fetchFromGitHub { owner = "beetbox"; repo = "beets"; - rev = "b09806e0df8f01b9155017d3693764ae7beedcd5"; - hash = "sha256-jE6nZLOEFufqclT6p1zK7dW+vt69q2ulaRsUldL7cSQ="; + rev = "2130404217684f22f36de00663428602b3f96d84"; + hash = "sha256-trqF6YVBcv+i5H4Ez3PKnRQ6mV2Ly/cw3UJC7pl19og="; }; extraPatches = [ # Bash completion fix for Nix From 2f947fa39a946250f17737b257126701c63f853f Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 8 Jun 2024 22:48:24 +0300 Subject: [PATCH 3/5] beetsPackages.alternatives: unstable-2021-02-01 -> 0.11.1 --- .../audio/beets/plugins/alternatives.nix | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pkgs/tools/audio/beets/plugins/alternatives.nix b/pkgs/tools/audio/beets/plugins/alternatives.nix index 95740e2d4e42..4b661d896ad6 100644 --- a/pkgs/tools/audio/beets/plugins/alternatives.nix +++ b/pkgs/tools/audio/beets/plugins/alternatives.nix @@ -2,26 +2,30 @@ python3Packages.buildPythonApplication rec { pname = "beets-alternatives"; - version = "unstable-2021-02-01"; + version = "0.11.1"; + pyproject = true; src = fetchFromGitHub { repo = "beets-alternatives"; owner = "geigerzaehler"; - rev = "288299e3aa9a1602717b04c28696fce5ce4259bf"; - sha256 = "sha256-Xl7AHr33hXQqQDuFbWuj8HrIugeipJFPmvNXpCkU/mI="; + rev = "v${version}"; + sha256 = "sha256-ORmF7YOQD4LvKiYo4Rzz+mzppOEvLics58aOK/IKcHc="; }; - postPatch = '' - substituteInPlace setup.cfg \ - --replace "addopts = --cov --cov-report=term --cov-report=html" "" - ''; - - nativeBuildInputs = [ beets ]; + nativeBuildInputs = [ + beets + python3Packages.poetry-core + ]; nativeCheckInputs = with python3Packages; [ pytestCheckHook + pytest-cov mock + typeguard ]; + preCheck = '' + export HOME=$(mktemp -d) + ''; meta = with lib; { description = "Beets plugin to manage external files"; From 10830cf99d6af2e8026ec3a299c082afd6729135 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 8 Jun 2024 22:52:10 +0300 Subject: [PATCH 4/5] beetsPackages.copyartifacts: fix build --- pkgs/tools/audio/beets/plugins/copyartifacts.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/tools/audio/beets/plugins/copyartifacts.nix b/pkgs/tools/audio/beets/plugins/copyartifacts.nix index 132eda28ed30..d9d95a9f25d9 100644 --- a/pkgs/tools/audio/beets/plugins/copyartifacts.nix +++ b/pkgs/tools/audio/beets/plugins/copyartifacts.nix @@ -19,11 +19,13 @@ python3Packages.buildPythonApplication rec { pytestFlagsArray = [ "-r fEs" ]; - nativeCheckInputs = with python3Packages; [ - pytestCheckHook + nativeCheckInputs = [ + python3Packages.pytestCheckHook beets - six ]; + preCheck = '' + export HOME=$(mktemp -d) + ''; meta = { description = "Beets plugin to move non-music files during the import process"; From 3bfa4f50e3b8b80ede4d632c2e58d69cbdfb4079 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Sat, 8 Jun 2024 22:54:00 +0300 Subject: [PATCH 5/5] beetsPackages.extrafiles: mark as broken --- pkgs/tools/audio/beets/plugins/extrafiles.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/tools/audio/beets/plugins/extrafiles.nix b/pkgs/tools/audio/beets/plugins/extrafiles.nix index 80c51dcde522..02ac96c2bb40 100644 --- a/pkgs/tools/audio/beets/plugins/extrafiles.nix +++ b/pkgs/tools/audio/beets/plugins/extrafiles.nix @@ -33,5 +33,7 @@ python3Packages.buildPythonApplication { description = "A plugin for beets that copies additional files and directories during the import process"; license = lib.licenses.mit; inherit (beets.meta) platforms; + # Upstream hasn't had commits since 2020, build is broken since beets 2.0.0 + broken = true; }; }