beets: 1.6.0 -> 2.0.0

This commit is contained in:
Doron Behar 2024-06-08 21:16:24 +03:00
parent 3eeeea0fef
commit 0c520d6ae7
7 changed files with 33 additions and 156 deletions

View File

@ -1,6 +1,5 @@
{ stdenv
, aacgain
, essentia-extractor
, ffmpeg
, flac
, imagemagick
@ -16,6 +15,7 @@
deprecated = true;
testPaths = [ ];
};
acousticbrainz.propagatedBuildInputs = [ python3Packages.requests ];
albumtypes = { };
aura = {
@ -87,7 +87,7 @@
mbcollection.testPaths = [ ];
mbsubmit = { };
mbsync = { };
metasync = { };
metasync.testPaths = [ ];
missing.testPaths = [ ];
mpdstats.propagatedBuildInputs = [ python3Packages.mpd2 ];
mpdupdate = {
@ -119,12 +119,10 @@
propagatedBuildInputs = with python3Packages; [ pillow pyxdg ];
wrapperBins = [ imagemagick ];
};
types.testPaths = [ "test/test_types_plugin.py" ];
types.testPaths = [ "test/plugins/test_types_plugin.py" ];
unimported.testPaths = [ ];
web.propagatedBuildInputs = [ python3Packages.flask ];
zero = { };
# NOTE: Condition can be removed once stable beets updates
} // lib.optionalAttrs ((lib.versions.majorMinor version) != "1.6") {
limit = { };
substitute = {
testPaths = [ ];

View File

@ -94,6 +94,7 @@ python3Packages.buildPythonApplication {
nativeBuildInputs = [
gobject-introspection
sphinxHook
python3Packages.pydata-sphinx-theme
] ++ extraNativeBuildInputs;
buildInputs = [
@ -119,6 +120,7 @@ python3Packages.buildPythonApplication {
nativeCheckInputs = with python3Packages; [
pytestCheckHook
pytest-cov
mock
rarfile
responses

View File

@ -18,66 +18,23 @@
** alternatives = { enable = true; propagatedBuildInputs = [ beetsPackages.alternatives ]; };
** }; }
*/
let
legacyMediafilePython3Packages = python3Packages.override {
overrides = self: super: {
mediafile = super.mediafile.overridePythonAttrs (oldAttrs: rec {
version = "0.10.1";
format = "pyproject";
src = fetchPypi {
pname = "mediafile";
inherit version;
hash = "sha256-kpZCoX7lAjuQhiIc6AzcLFHQYCGokNRDOwvVvTLysp8=";
};
});
};
};
in lib.makeExtensible (self: {
lib.makeExtensible (self: {
beets = self.beets-stable;
beets-stable = callPackage ./common.nix rec {
python3Packages = legacyMediafilePython3Packages;
inherit python3Packages;
# NOTE: ./builtin-plugins.nix and ./common.nix can have some conditionals
# be removed when stable version updates
version = "1.6.0";
version = "2.0.0";
src = fetchFromGitHub {
owner = "beetbox";
repo = "beets";
rev = "v${version}";
hash = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM=";
hash = "sha256-6pmImyopy0zFBDYoqDyWcBv61FK1kGsZwW2+7fzAnq8=";
};
extraPatches = [
# Bash completion fix for Nix
./patches/bash-completion-always-print.patch
# Fix unidecode>=1.3.5 compat
(fetchpatch {
url = "https://github.com/beetbox/beets/commit/5ae1e0f3c8d3a450cb39f7933aa49bb78c2bc0d9.patch";
hash = "sha256-gqkrE+U1j3tt1qPRJufTGS/GftaSw/gweXunO/mCVG8=";
})
# Fix embedart with ImageMagick 7.1.1-12
# 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
# Sphinx 6 compatibility fix.
(fetchpatch {
url = "https://github.com/beetbox/beets/commit/2106f471affd1dab35b4b26187b9c74d034528c5.patch";
hash = "sha256-V/886dYJW/O55VqU8sd+x/URIFcKhP6j5sUhTGMoxL8=";
})
];
disabledTests = [
# This issue is present on this version alone, and can be removed on the
# next stable version version bump. Since this is fixed in branch master,
# we don't have a bug ticket open for this. As of writing, it also seems
# hard to find a patch that can be backported to v1.6.0 that would fix
# the failure, as the master branch has gone through too many changes
# now.
"test_get_single_item_by_path"
];
};
@ -94,17 +51,7 @@ in lib.makeExtensible (self: {
};
extraPatches = [
# Bash completion fix for Nix
./patches/unstable-bash-completion-always-print.patch
];
pluginOverrides = {
# unstable has new plugins, so we register them here.
limit = { builtin = true; };
substitute = { builtin = true; };
advancedrewrite = { builtin = true; };
autobpm = { builtin = true; };
};
extraNativeBuildInputs = [
python3Packages.pydata-sphinx-theme
./patches/bash-completion-always-print.patch
];
};

View File

@ -1,44 +1,45 @@
diff --git i/beets/ui/commands.py w/beets/ui/commands.py
index 3a337401..d08a6763 100755
index ad4f7821..5077191d 100755
--- i/beets/ui/commands.py
+++ w/beets/ui/commands.py
@@ -1759,21 +1759,6 @@ default_commands.append(config_cmd)
@@ -2381,22 +2381,6 @@ default_commands.append(config_cmd)
def print_completion(*args):
for line in completion_script(default_commands + plugins.commands()):
print_(line, end='')
- if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)):
- log.warning('Warning: Unable to find the bash-completion package. '
- 'Command line completion might not work.')
print_(line, end="")
- if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS):
- log.warning(
- "Warning: Unable to find the bash-completion package. "
- "Command line completion might not work."
- )
-
-
-BASH_COMPLETION_PATHS = map(syspath, [
- '/etc/bash_completion',
- '/usr/share/bash-completion/bash_completion',
- '/usr/local/share/bash-completion/bash_completion',
-BASH_COMPLETION_PATHS = [
- b"/etc/bash_completion",
- b"/usr/share/bash-completion/bash_completion",
- b"/usr/local/share/bash-completion/bash_completion",
- # SmartOS
- '/opt/local/share/bash-completion/bash_completion',
- b"/opt/local/share/bash-completion/bash_completion",
- # Homebrew (before bash-completion2)
- '/usr/local/etc/bash_completion',
-])
-
- b"/usr/local/etc/bash_completion",
-]
def completion_script(commands):
"""Yield the full completion shell script as strings.
diff --git i/test/test_ui.py w/test/test_ui.py
index 9804b0a1..c3b53243 100644
index cae86148..faf266a8 100644
--- i/test/test_ui.py
+++ w/test/test_ui.py
@@ -1229,12 +1229,7 @@ class CompletionTest(_common.TestCase, TestHelper):
stdout=subprocess.PIPE, env=env)
@@ -1434,12 +1434,7 @@ class CompletionTest(_common.TestCase, TestHelper):
)
# Load bash_completion library.
- for path in commands.BASH_COMPLETION_PATHS:
- if os.path.exists(util.syspath(path)):
- if os.path.exists(syspath(path)):
- bash_completion = path
- break
- else:
- self.skipTest('bash-completion script not found')
+ self.skipTest('bash-completion script not found')
- self.skipTest("bash-completion script not found")
+ self.skipTest("bash-completion script not found")
try:
with open(util.syspath(bash_completion), 'rb') as f:
with open(util.syspath(bash_completion), "rb") as f:
tester.stdin.writelines(f)

View File

@ -1,13 +0,0 @@
diff --git a/beets/art.py b/beets/art.py
index 13d5dfbd..ac1d2fd8 100644
--- a/beets/art.py
+++ b/beets/art.py
@@ -132,7 +132,7 @@ def check_art_similarity(log, item, imagepath, compare_threshold):
convert_cmd = ['convert', syspath(imagepath, prefix=False),
syspath(art, prefix=False),
'-colorspace', 'gray', 'MIFF:-']
- compare_cmd = ['compare', '-metric', 'PHASH', '-', 'null:']
+ compare_cmd = ['compare', '-define', 'phash:colorspaces=sRGB,HCLp', '-metric', 'PHASH', '-', 'null:']
log.debug('comparing images with pipeline {} | {}',
convert_cmd, compare_cmd)
convert_proc = subprocess.Popen(

View File

@ -1,13 +0,0 @@
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.

View File

@ -1,45 +0,0 @@
diff --git i/beets/ui/commands.py w/beets/ui/commands.py
index ad4f7821..5077191d 100755
--- i/beets/ui/commands.py
+++ w/beets/ui/commands.py
@@ -2381,22 +2381,6 @@ default_commands.append(config_cmd)
def print_completion(*args):
for line in completion_script(default_commands + plugins.commands()):
print_(line, end="")
- if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS):
- log.warning(
- "Warning: Unable to find the bash-completion package. "
- "Command line completion might not work."
- )
-
-
-BASH_COMPLETION_PATHS = [
- b"/etc/bash_completion",
- b"/usr/share/bash-completion/bash_completion",
- b"/usr/local/share/bash-completion/bash_completion",
- # SmartOS
- b"/opt/local/share/bash-completion/bash_completion",
- # Homebrew (before bash-completion2)
- b"/usr/local/etc/bash_completion",
-]
def completion_script(commands):
diff --git i/test/test_ui.py w/test/test_ui.py
index cae86148..faf266a8 100644
--- i/test/test_ui.py
+++ w/test/test_ui.py
@@ -1434,12 +1434,7 @@ class CompletionTest(_common.TestCase, TestHelper):
)
# Load bash_completion library.
- for path in commands.BASH_COMPLETION_PATHS:
- if os.path.exists(syspath(path)):
- bash_completion = path
- break
- else:
- self.skipTest("bash-completion script not found")
+ self.skipTest("bash-completion script not found")
try:
with open(util.syspath(bash_completion), "rb") as f:
tester.stdin.writelines(f)