summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/tools/audio/beets/common.nix6
-rw-r--r--pkgs/tools/audio/beets/default.nix11
-rw-r--r--pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch13
3 files changed, 24 insertions, 6 deletions
diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix
index 3fdf8381dc5..3678fd81fa8 100644
--- a/pkgs/tools/audio/beets/common.nix
+++ b/pkgs/tools/audio/beets/common.nix
@@ -52,12 +52,6 @@ python3Packages.buildPythonApplication {
 
   patches = extraPatches;
 
-  postPatch = ''
-    # https://github.com/beetbox/beets/pull/4868
-    substituteInPlace beets/util/artresizer.py \
-      --replace "Image.ANTIALIAS" "Image.Resampling.LANCZOS"
-  '';
-
   propagatedBuildInputs = with python3Packages; [
     confuse
     gst-python
diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix
index 7f5c3bbceae..1168afbe747 100644
--- a/pkgs/tools/audio/beets/default.nix
+++ b/pkgs/tools/audio/beets/default.nix
@@ -41,6 +41,9 @@ lib.makeExtensible (self: {
       # 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
     ];
   };
 
@@ -57,6 +60,14 @@ lib.makeExtensible (self: {
     extraPatches = [
       # Bash completion fix for Nix
       ./patches/unstable-bash-completion-always-print.patch
+      # Pillow 10 compatibility fix, see:
+      # https://github.com/beetbox/beets/pull/4868
+      (fetchpatch {
+        url = "https://github.com/beetbox/beets/commit/c2118a8b9cd8c9c91135c6e178830b89b40867be.patch";
+        hash = "sha256-HWf940WrF10Jnu9iyoHovFDcvj9LY8p7zIlJg1TfKxQ=";
+        # Doesn't apply on this file, and it we don't care.
+        excludes = [ "docs/changelog.rst" ];
+      })
     ];
     pluginOverrides = {
       # unstable has a new plugin, so we register it here.
diff --git a/pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch b/pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch
new file mode 100644
index 00000000000..f85eec20156
--- /dev/null
+++ b/pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch
@@ -0,0 +1,13 @@
+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.