From 425de6e3fe01c5f22517edcf064262e1c7bc8db1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 26 Oct 2023 23:31:37 +0300 Subject: 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. --- pkgs/tools/audio/beets/common.nix | 6 ------ pkgs/tools/audio/beets/default.nix | 11 +++++++++++ pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch | 13 +++++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 pkgs/tools/audio/beets/patches/fix-pillow10-compat.patch (limited to 'pkgs') diff --git a/pkgs/tools/audio/beets/common.nix b/pkgs/tools/audio/beets/common.nix index 3fdf8381dc594..3678fd81fa892 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 7f5c3bbceae9b..1168afbe747fe 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 0000000000000..f85eec20156cc --- /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. -- cgit 1.4.1