summary refs log tree commit diff
path: root/pkgs/tools/audio
diff options
context:
space:
mode:
authorDoron Behar <doron.behar@gmail.com>2023-10-26 23:31:37 +0300
committerDoron Behar <doron.behar@gmail.com>2023-10-27 00:23:17 +0300
commit425de6e3fe01c5f22517edcf064262e1c7bc8db1 (patch)
treeb9f063545040ddd493af16750d871302e0144e0e /pkgs/tools/audio
parentfa95aced90d018037bada93227f8b4ae8f79df3f (diff)
downloadnixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.tar
nixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.tar.gz
nixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.tar.bz2
nixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.tar.lz
nixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.tar.xz
nixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.tar.zst
nixpkgs-425de6e3fe01c5f22517edcf064262e1c7bc8db1.zip
beets{,-unstable}: use a patch for pillow10 compatibility fix
This patch will fail to apply when a new version comes out, and thus
will force us to remove it, where the `sed` command in `postPatch` may
become abandoned, and not fail the build due to it not doing anything.
Diffstat (limited to 'pkgs/tools/audio')
-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.