gnu: quodlibet: Fix compatibility with python-3.10.
Reported in #63205. * gnu/packages/music.scm (quodlibet)[source]: Add two backported patches. [arguments]: Adjust 'check phase to change skipped tests. * gnu/packages/patches/quodlibet-fix-invalid-glob.patch, gnu/packages/patches/quodlibet-fix-mtime-tests.patch: New files. * gnu/local.mk (dist_patch_DATA): Register them. Signed-off-by: Efraim Flashner <efraim@flashner.co.il>master
parent
63f8af77ec
commit
b188c41d93
|
@ -1703,6 +1703,8 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/python-typeguard-python3.10.patch \
|
%D%/packages/patches/python-typeguard-python3.10.patch \
|
||||||
%D%/packages/patches/python-w3lib-fix-test-failure.patch \
|
%D%/packages/patches/python-w3lib-fix-test-failure.patch \
|
||||||
%D%/packages/patches/python-wxwidgets-type-errors.patch \
|
%D%/packages/patches/python-wxwidgets-type-errors.patch \
|
||||||
|
%D%/packages/patches/quodlibet-fix-invalid-glob.patch \
|
||||||
|
%D%/packages/patches/quodlibet-fix-mtime-tests.patch \
|
||||||
%D%/packages/patches/scribus-1.5.8-poppler-22.03.0.patch \
|
%D%/packages/patches/scribus-1.5.8-poppler-22.03.0.patch \
|
||||||
%D%/packages/patches/scribus-1.5.8-poppler-22.04.0.patch \
|
%D%/packages/patches/scribus-1.5.8-poppler-22.04.0.patch \
|
||||||
%D%/packages/patches/scribus-1.5.8-poppler-22.09.0.patch \
|
%D%/packages/patches/scribus-1.5.8-poppler-22.09.0.patch \
|
||||||
|
|
|
@ -7154,6 +7154,8 @@ streaming audio server.")
|
||||||
(url "https://github.com/quodlibet/quodlibet")
|
(url "https://github.com/quodlibet/quodlibet")
|
||||||
(commit (string-append "release-" version))))
|
(commit (string-append "release-" version))))
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
|
(patches (search-patches "quodlibet-fix-invalid-glob.patch"
|
||||||
|
"quodlibet-fix-mtime-tests.patch"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "1i5k93k3bfp7hpcwkbr865mbj9jam3jv2a5k1bazcyp4f5vdrb0v"))))
|
(base32 "1i5k93k3bfp7hpcwkbr865mbj9jam3jv2a5k1bazcyp4f5vdrb0v"))))
|
||||||
(build-system python-build-system)
|
(build-system python-build-system)
|
||||||
|
@ -7177,9 +7179,7 @@ streaming audio server.")
|
||||||
"--ignore=tests/test_browsers_iradio.py"
|
"--ignore=tests/test_browsers_iradio.py"
|
||||||
;; broken upstream
|
;; broken upstream
|
||||||
"--disable-warnings"
|
"--disable-warnings"
|
||||||
"--ignore=tests/quality"
|
"--ignore=tests/quality/test_flake8.py")
|
||||||
;; missing legacy icons in adwaita-icon-theme
|
|
||||||
"--ignore=tests/plugin/test_trayicon.py")
|
|
||||||
(format #t "test suite not run~%"))))
|
(format #t "test suite not run~%"))))
|
||||||
(add-after 'install 'glib-or-gtk-wrap ; ensure icons loaded
|
(add-after 'install 'glib-or-gtk-wrap ; ensure icons loaded
|
||||||
(assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
|
(assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
From 5f55431a28509fd4f4f7b40dc246f3d34fa8549e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||||
|
Date: Sun, 26 Jun 2022 23:14:28 +0200
|
||||||
|
Subject: [PATCH] builtin cover: fix handling of invalid glob ranges with
|
||||||
|
Python 3.10.5+ (#4027)
|
||||||
|
|
||||||
|
Previously Python would raise if an invalid range was given
|
||||||
|
to glob, but with 3.10.5 they fixed it to not match anything.
|
||||||
|
https://github.com/python/cpython/issues/89973
|
||||||
|
|
||||||
|
Our tests depended on the previous logic and treating the glob pattern
|
||||||
|
as a literal file name in that case.
|
||||||
|
|
||||||
|
One could argue that this is wrong since a range that doesn't contain anything
|
||||||
|
should also not match anything, so wrap glob() to make it not match for all
|
||||||
|
Python versions in that case and adjust the tests accordingly.
|
||||||
|
|
||||||
|
This should fix the Windows CI, which is currently the only job using 3.10.5
|
||||||
|
---
|
||||||
|
quodlibet/util/cover/built_in.py | 22 +++++++++++-----------
|
||||||
|
tests/test_util_cover.py | 12 +++---------
|
||||||
|
2 files changed, 14 insertions(+), 20 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/quodlibet/util/cover/built_in.py b/quodlibet/util/cover/built_in.py
|
||||||
|
index f2a8791a2..01474c9b6 100644
|
||||||
|
--- a/quodlibet/util/cover/built_in.py
|
||||||
|
+++ b/quodlibet/util/cover/built_in.py
|
||||||
|
@@ -100,6 +100,15 @@ class FilesystemCover(CoverSourcePlugin):
|
||||||
|
base = self.song('~dirname')
|
||||||
|
images = []
|
||||||
|
|
||||||
|
+ def safe_glob(*args, **kwargs):
|
||||||
|
+ try:
|
||||||
|
+ return glob.glob(*args, **kwargs)
|
||||||
|
+ except sre_constants.error:
|
||||||
|
+ # https://github.com/python/cpython/issues/89973
|
||||||
|
+ # old glob would fail with invalid ranges, newer one
|
||||||
|
+ # handles it correctly.
|
||||||
|
+ return []
|
||||||
|
+
|
||||||
|
if config.getboolean("albumart", "force_filename"):
|
||||||
|
score = 100
|
||||||
|
for filename in config.get("albumart", "filename").split(","):
|
||||||
|
@@ -107,17 +116,8 @@ class FilesystemCover(CoverSourcePlugin):
|
||||||
|
filename = filename.strip()
|
||||||
|
|
||||||
|
escaped_path = os.path.join(glob.escape(base), filename)
|
||||||
|
- try:
|
||||||
|
- for path in glob.glob(escaped_path):
|
||||||
|
- images.append((score, path))
|
||||||
|
- except sre_constants.error:
|
||||||
|
- # Use literal filename if globbing causes errors
|
||||||
|
- path = os.path.join(base, filename)
|
||||||
|
-
|
||||||
|
- # We check this here, so we can search for alternative
|
||||||
|
- # files in case no preferred file was found.
|
||||||
|
- if os.path.isfile(path):
|
||||||
|
- images.append((score, path))
|
||||||
|
+ for path in safe_glob(escaped_path):
|
||||||
|
+ images.append((score, path))
|
||||||
|
|
||||||
|
# So names and patterns at the start are preferred
|
||||||
|
score -= 1
|
||||||
|
diff --git a/tests/test_util_cover.py b/tests/test_util_cover.py
|
||||||
|
index db81e4d1f..71a48ad9a 100644
|
||||||
|
--- a/tests/test_util_cover.py
|
||||||
|
+++ b/tests/test_util_cover.py
|
||||||
|
@@ -105,15 +105,9 @@ class TCoverManager(TestCase):
|
||||||
|
config.set("albumart", "force_filename", str(True))
|
||||||
|
config.set("albumart", "filename", "[a-2].jpg")
|
||||||
|
|
||||||
|
- # Should match
|
||||||
|
- f = self.add_file("[a-2].jpg")
|
||||||
|
- assert path_equal(
|
||||||
|
- os.path.abspath(self._find_cover(self.song).name), f)
|
||||||
|
-
|
||||||
|
- # Should not crash
|
||||||
|
- f = self.add_file("test.jpg")
|
||||||
|
- assert not path_equal(
|
||||||
|
- os.path.abspath(self._find_cover(self.song).name), f)
|
||||||
|
+ # Invalid glob range, should not match anything
|
||||||
|
+ self.add_file("a.jpg")
|
||||||
|
+ assert self._find_cover(self.song) is None
|
||||||
|
|
||||||
|
def test_invalid_glob_path(self):
|
||||||
|
config.set("albumart", "force_filename", str(True))
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
From 06a32b319f065550efe0d2a9ff10ca6bdc32b893 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christoph Reiter <reiter.christoph@gmail.com>
|
||||||
|
Date: Sat, 23 Jul 2022 20:15:18 +0200
|
||||||
|
Subject: [PATCH] operon: hopefully better fix for flaky mtime tests
|
||||||
|
|
||||||
|
copy the mtime after we write everything, so there is no chance of
|
||||||
|
it changing before we note the initial value.
|
||||||
|
---
|
||||||
|
quodlibet/operon/commands.py | 8 ++++----
|
||||||
|
1 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/quodlibet/operon/commands.py b/quodlibet/operon/commands.py
|
||||||
|
index e0a5ef33a..af2dcfa8b 100644
|
||||||
|
--- a/quodlibet/operon/commands.py
|
||||||
|
+++ b/quodlibet/operon/commands.py
|
||||||
|
@@ -227,16 +227,16 @@ class EditCommand(Command):
|
||||||
|
# write to tmp file
|
||||||
|
fd, path = tempfile.mkstemp(suffix=".txt")
|
||||||
|
|
||||||
|
- # XXX: copy mtime here so we can test for changes in tests by
|
||||||
|
- # setting a out of date mtime on the source song file
|
||||||
|
- copy_mtime(args[0], path)
|
||||||
|
-
|
||||||
|
try:
|
||||||
|
try:
|
||||||
|
os.write(fd, dump)
|
||||||
|
finally:
|
||||||
|
os.close(fd)
|
||||||
|
|
||||||
|
+ # XXX: copy mtime here so we can test for changes in tests by
|
||||||
|
+ # setting a out of date mtime on the source song file
|
||||||
|
+ copy_mtime(args[0], path)
|
||||||
|
+
|
||||||
|
# only parse the result if the editor returns 0 and the mtime has
|
||||||
|
# changed
|
||||||
|
old_mtime = mtime(path)
|
||||||
|
--
|
||||||
|
2.39.2
|
||||||
|
|
Reference in New Issue