Merge pull request #263650 from doronbehar/pkg/beets

beets-stable: disable a failing test.
This commit is contained in:
Bernardo Meurer 2023-10-26 20:20:14 -04:00 committed by GitHub
commit b0a5077288
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 76 deletions

View File

@ -26,6 +26,8 @@
, extraPatches ? [ ] , extraPatches ? [ ]
, pluginOverrides ? { } , pluginOverrides ? { }
, disableAllPlugins ? false , disableAllPlugins ? false
, disabledTests ? []
, extraNativeBuildInputs ? []
# tests # tests
, runCommand , runCommand
@ -52,12 +54,6 @@ python3Packages.buildPythonApplication {
patches = extraPatches; patches = extraPatches;
postPatch = ''
# https://github.com/beetbox/beets/pull/4868
substituteInPlace beets/util/artresizer.py \
--replace "Image.ANTIALIAS" "Image.Resampling.LANCZOS"
'';
propagatedBuildInputs = with python3Packages; [ propagatedBuildInputs = with python3Packages; [
confuse confuse
gst-python gst-python
@ -76,7 +72,7 @@ python3Packages.buildPythonApplication {
nativeBuildInputs = [ nativeBuildInputs = [
gobject-introspection gobject-introspection
sphinxHook sphinxHook
]; ] ++ extraNativeBuildInputs;
buildInputs = [ buildInputs = [
] ++ (with gst_all_1; [ ] ++ (with gst_all_1; [
@ -93,24 +89,6 @@ python3Packages.buildPythonApplication {
cp extra/_beet $out/share/zsh/site-functions/ cp extra/_beet $out/share/zsh/site-functions/
''; '';
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
tmphome="$(mktemp -d)"
EDITOR="${writeScript "beetconfig.sh" ''
#!${runtimeShell}
cat > "$1" <<CFG
plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)}
CFG
''}" HOME="$tmphome" "$out/bin/beet" config -e
EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
runHook postInstallCheck
'';
makeWrapperArgs = [ makeWrapperArgs = [
"--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
"--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\""
@ -118,17 +96,17 @@ python3Packages.buildPythonApplication {
]; ];
nativeCheckInputs = with python3Packages; [ nativeCheckInputs = with python3Packages; [
pytest pytestCheckHook
mock mock
rarfile rarfile
responses responses
] ++ pluginWrapperBins; ] ++ pluginWrapperBins;
disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins)); disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (n: v: v.testPaths ++ [ "test/test_${n}.py" ]) disabledPlugins));
inherit disabledTests;
checkPhase = '' # Perform extra "sanity checks", before running pytest tests.
runHook preCheck preCheck = ''
# Check for undefined plugins # Check for undefined plugins
find beetsplug -mindepth 1 \ find beetsplug -mindepth 1 \
\! -path 'beetsplug/__init__.py' -a \ \! -path 'beetsplug/__init__.py' -a \
@ -140,19 +118,13 @@ python3Packages.buildPythonApplication {
export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc" export BEETS_TEST_SHELL="${bashInteractive}/bin/bash --norc"
export HOME="$(mktemp -d)" export HOME="$(mktemp -d)"
args=" -m pytest -r fEs" env EDITOR="${writeScript "beetconfig.sh" ''
eval "disabledTestPaths=($disabledTestPaths)" #!${runtimeShell}
for path in ''${disabledTestPaths[@]}; do cat > "$1" <<CFG
if [ -e "$path" ]; then plugins: ${lib.concatStringsSep " " (attrNames enabledPlugins)}
args+=" --ignore $path" CFG
else ''}" "$out/bin/beet" config -e
echo "Skipping non-existent test path '$path'" env EDITOR=true "$out/bin/beet" config -e
fi
done
python $args
runHook postCheck
''; '';
@ -160,8 +132,7 @@ python3Packages.buildPythonApplication {
passthru.tests.gstreamer = runCommand "beets-gstreamer-test" { passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
meta.timeout = 60; meta.timeout = 60;
} } ''
''
set -euo pipefail set -euo pipefail
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
mkdir $out mkdir $out
@ -171,7 +142,6 @@ replaygain:
backend: gstreamer backend: gstreamer
EOF EOF
echo $out/config.yaml
${beets}/bin/beet -c $out/config.yaml > /dev/null ${beets}/bin/beet -c $out/config.yaml > /dev/null
''; '';

View File

@ -2,6 +2,7 @@
, callPackage , callPackage
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , fetchpatch
, python3Packages
}: }:
/* /*
** To customize the enabled beets plugins, use the pluginOverrides input to the ** To customize the enabled beets plugins, use the pluginOverrides input to the
@ -20,6 +21,7 @@ lib.makeExtensible (self: {
beets = self.beets-stable; beets = self.beets-stable;
beets-stable = callPackage ./common.nix rec { beets-stable = callPackage ./common.nix rec {
inherit python3Packages;
version = "1.6.0"; version = "1.6.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "beetbox"; owner = "beetbox";
@ -41,27 +43,46 @@ lib.makeExtensible (self: {
# https://github.com/beetbox/beets/pull/4839 # 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 # 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 ./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
];
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"
]; ];
}; };
beets-minimal = self.beets.override { disableAllPlugins = true; }; beets-minimal = self.beets.override { disableAllPlugins = true; };
beets-unstable = callPackage ./common.nix { beets-unstable = callPackage ./common.nix {
version = "unstable-2023-07-05"; inherit python3Packages;
version = "unstable-2023-10-26";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "beetbox"; owner = "beetbox";
repo = "beets"; repo = "beets";
rev = "9481402b3c20739ca0b879d19adbfca22ccd6a44"; rev = "6655760732100f5387fad2d2890c015ee5039981";
hash = "sha256-AKmozMNVchysoQcUWd90Ic6bQBKQgylVn0E3i85dGb8="; hash = "sha256-Nz9BHtacYpJMLmB3f9WFg6GvMa+BuUhiNbJ9cyannek=";
}; };
extraPatches = [ extraPatches = [
# Bash completion fix for Nix # Bash completion fix for Nix
./patches/unstable-bash-completion-always-print.patch ./patches/unstable-bash-completion-always-print.patch
]; ];
pluginOverrides = { pluginOverrides = {
# unstable has a new plugin, so we register it here. # unstable has new plugins, so we register them here.
limit = { builtin = true; }; limit = { builtin = true; };
substitute = { builtin = true; };
advancedrewrite = { builtin = true; };
autobpm = { builtin = true; };
}; };
extraNativeBuildInputs = [
python3Packages.pydata-sphinx-theme
];
}; };
alternatives = callPackage ./plugins/alternatives.nix { beets = self.beets-minimal; }; alternatives = callPackage ./plugins/alternatives.nix { beets = self.beets-minimal; };

View File

@ -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.

View File

@ -1,34 +1,36 @@
diff --git a/beets/ui/commands.py b/beets/ui/commands.py diff --git i/beets/ui/commands.py w/beets/ui/commands.py
index 1377ad0c..e178eeae 100755 index ad4f7821..5077191d 100755
--- a/beets/ui/commands.py --- i/beets/ui/commands.py
+++ b/beets/ui/commands.py +++ w/beets/ui/commands.py
@@ -1831,20 +1831,6 @@ default_commands.append(config_cmd) @@ -2381,22 +2381,6 @@ default_commands.append(config_cmd)
def print_completion(*args): def print_completion(*args):
for line in completion_script(default_commands + plugins.commands()): for line in completion_script(default_commands + plugins.commands()):
print_(line, end='') print_(line, end="")
- if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS): - if not any(os.path.isfile(syspath(p)) for p in BASH_COMPLETION_PATHS):
- log.warning('Warning: Unable to find the bash-completion package. ' - log.warning(
- 'Command line completion might not work.') - "Warning: Unable to find the bash-completion package. "
- "Command line completion might not work."
- )
- -
- -
-BASH_COMPLETION_PATHS = [ -BASH_COMPLETION_PATHS = [
- b'/etc/bash_completion', - b"/etc/bash_completion",
- b'/usr/share/bash-completion/bash_completion', - b"/usr/share/bash-completion/bash_completion",
- b'/usr/local/share/bash-completion/bash_completion', - b"/usr/local/share/bash-completion/bash_completion",
- # SmartOS - # SmartOS
- b'/opt/local/share/bash-completion/bash_completion', - b"/opt/local/share/bash-completion/bash_completion",
- # Homebrew (before bash-completion2) - # Homebrew (before bash-completion2)
- b'/usr/local/etc/bash_completion', - b"/usr/local/etc/bash_completion",
-] -]
def completion_script(commands): def completion_script(commands):
diff --git a/test/test_ui.py b/test/test_ui.py diff --git i/test/test_ui.py w/test/test_ui.py
index f66917dc..f3d934c6 100644 index cae86148..faf266a8 100644
--- a/test/test_ui.py --- i/test/test_ui.py
+++ b/test/test_ui.py +++ w/test/test_ui.py
@@ -1310,12 +1310,7 @@ class CompletionTest(_common.TestCase, TestHelper): @@ -1434,12 +1434,7 @@ class CompletionTest(_common.TestCase, TestHelper):
stdout=subprocess.PIPE, env=env) )
# Load bash_completion library. # Load bash_completion library.
- for path in commands.BASH_COMPLETION_PATHS: - for path in commands.BASH_COMPLETION_PATHS:
@ -36,8 +38,8 @@ index f66917dc..f3d934c6 100644
- bash_completion = path - bash_completion = path
- break - break
- else: - 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: try:
with open(util.syspath(bash_completion), 'rb') as f: with open(util.syspath(bash_completion), "rb") as f:
tester.stdin.writelines(f) tester.stdin.writelines(f)