Subject: [bug#77788] [PATCH v2 2/2] gnu: beets: Update to 2.2.0.

From: Andrew Wong <[email-masked]>
Date: Sat, 26 Apr 2025 01:57:06 -0400

* gnu/packages/music.scm (beets): Update to 2.2.0.
[source]: Add `beets-future-proof-bucket-test.patch` patch.
[native-inputs]: Add `python-poetry-core`, `python-pytest-flask`.
[inputs]: Add `python-platformdirs`.
* gnu/packages/patches/beets-future-proof-bucket-test.patch: New file.

Change-Id: I417af8761d801e76fa85ca53b6def556d50440d8
---
 gnu/packages/music.scm                        |  9 ++++-
 .../beets-future-proof-bucket-test.patch      | 39 +++++++++++++++++++
 2 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/beets-future-proof-bucket-test.patch

diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index 0991755cd4..db62e6d73f 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -4290,13 +4290,15 @@ (define-public instantmusic
 (define-public beets
   (package
     (name "beets")
-    (version "2.0.0")
+    (version "2.2.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "beets" version))
               (sha256
                (base32
-                "1kzqn6f3iw30lav9cwf653w2ns1n09yrys54dqxf6a9ppjsp449v"))))
+                "05f7sjl6hwarn4d3r5hlsn7gfsx1dlqiy0kl6dg5fi08adzjf2nc"))
+              ;; Fix myopic test. See <https://github.com/beetbox/beets/pull/5566>
+              (patches (search-patches "beets-future-proof-bucket-test.patch"))))
     (build-system pyproject-build-system)
     (arguments
      (list
@@ -4319,9 +4321,11 @@ (define-public beets
      (list gobject-introspection
            python-flask
            python-mock
+           python-poetry-core
            python-py7zr
            python-pytest
            python-pytest-cov
+           python-pytest-flask
            python-setuptools
            python-responses
            python-wheel))
@@ -4335,6 +4339,7 @@ (define-public beets
            python-mediafile
            python-munkres
            python-musicbrainzngs
+           python-platformdirs
            python-pyyaml
            python-typing-extensions
            python-unidecode
diff --git a/gnu/packages/patches/beets-future-proof-bucket-test.patch b/gnu/packages/patches/beets-future-proof-bucket-test.patch
new file mode 100644
index 0000000000..48a640d802
--- /dev/null
+++ b/gnu/packages/patches/beets-future-proof-bucket-test.patch
@@ -0,0 +1,39 @@
+From bcc79a5b09225050ce7c88f63dfa56f49f8782a8 Mon Sep 17 00:00:00 2001
+From: Stefano Rivera <[email-masked]>
+Date: Fri, 27 Dec 2024 16:27:30 -0400
+Subject: [PATCH] Future proof
+ BucketPluginTest.test_year_single_year_last_folder
+
+2025 won't be in the future, forever.
+
+Fixes: https://bugs.debian.org/1091495
+---
+ test/plugins/test_bucket.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/test/plugins/test_bucket.py b/test/plugins/test_bucket.py
+index b075bc4f2..e3611912a 100644
+--- a/test/plugins/test_bucket.py
++++ b/test/plugins/test_bucket.py
+@@ -14,6 +14,8 @@
+ 
+ """Tests for the 'bucket' plugin."""
+ 
++from datetime import datetime
++
+ import pytest
+ 
+ from beets import config, ui
+@@ -51,7 +53,8 @@ class BucketPluginTest(BeetsTestCase):
+         year."""
+         self._setup_config(bucket_year=["1950", "1970"])
+         assert self.plugin._tmpl_bucket("2014") == "1970"
+-        assert self.plugin._tmpl_bucket("2025") == "2025"
++        next_year = datetime.now().year + 1
++        assert self.plugin._tmpl_bucket(str(next_year)) == str(next_year)
+ 
+     def test_year_two_years(self):
+         """Buckets can be named with the 'from-to' syntax."""
+-- 
+2.49.0
+
-- 
2.49.0