Commit 425de6e3 authored by Doron Behar's avatar Doron Behar
Browse files

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.
parent fa95aced
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -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
+11 −0
Original line number Diff line number Diff line
@@ -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.
+13 −0
Original line number Diff line number Diff line
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.