2017-06-14 10:29:31 +01:00
|
|
|
{ stdenv, fetchFromGitHub, writeScript, glibcLocales, diffPlugins
|
2017-02-19 22:35:24 +00:00
|
|
|
, pythonPackages, imagemagick, gobjectIntrospection, gst_all_1
|
2014-12-30 02:23:37 +00:00
|
|
|
|
beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
# Attributes needed for tests of the external plugins
|
|
|
|
, callPackage, beets
|
|
|
|
|
2016-02-09 20:43:50 +00:00
|
|
|
, enableAcousticbrainz ? true
|
|
|
|
, enableAcoustid ? true
|
|
|
|
, enableBadfiles ? true, flac ? null, mp3val ? null
|
2016-05-02 16:18:07 +01:00
|
|
|
, enableConvert ? true, ffmpeg ? null
|
2016-02-09 20:43:50 +00:00
|
|
|
, enableDiscogs ? true
|
|
|
|
, enableEmbyupdate ? true
|
|
|
|
, enableFetchart ? true
|
2017-06-28 21:27:17 +01:00
|
|
|
, enableGmusic ? true
|
2016-09-10 00:44:10 +01:00
|
|
|
, enableKeyfinder ? true, keyfinder-cli ? null
|
2017-06-28 21:27:17 +01:00
|
|
|
, enableKodiupdate ? true
|
2016-02-09 20:43:50 +00:00
|
|
|
, enableLastfm ? true
|
|
|
|
, enableMpd ? true
|
|
|
|
, enableReplaygain ? true, bs1770gain ? null
|
|
|
|
, enableThumbnails ? true
|
|
|
|
, enableWeb ? true
|
2014-12-30 21:53:00 +00:00
|
|
|
|
2015-12-18 04:34:46 +00:00
|
|
|
# External plugins
|
2016-09-10 00:43:42 +01:00
|
|
|
, enableAlternatives ? false
|
|
|
|
, enableCopyArtifacts ? false
|
2015-12-18 04:34:46 +00:00
|
|
|
|
2016-09-28 16:46:29 +01:00
|
|
|
, bashInteractive, bash-completion
|
2014-12-30 21:53:00 +00:00
|
|
|
}:
|
|
|
|
|
2016-12-03 04:21:00 +00:00
|
|
|
assert enableAcoustid -> pythonPackages.pyacoustid != null;
|
2015-10-26 09:26:48 +00:00
|
|
|
assert enableBadfiles -> flac != null && mp3val != null;
|
2016-05-02 16:18:07 +01:00
|
|
|
assert enableConvert -> ffmpeg != null;
|
2016-12-03 04:21:00 +00:00
|
|
|
assert enableDiscogs -> pythonPackages.discogs_client != null;
|
|
|
|
assert enableFetchart -> pythonPackages.responses != null;
|
2017-06-28 21:27:17 +01:00
|
|
|
assert enableGmusic -> pythonPackages.gmusicapi != null;
|
2016-09-10 00:44:10 +01:00
|
|
|
assert enableKeyfinder -> keyfinder-cli != null;
|
2016-12-03 04:21:00 +00:00
|
|
|
assert enableLastfm -> pythonPackages.pylast != null;
|
2017-06-28 21:27:17 +01:00
|
|
|
assert enableMpd -> pythonPackages.mpd2 != null;
|
2015-12-18 01:03:00 +00:00
|
|
|
assert enableReplaygain -> bs1770gain != null;
|
2016-12-03 04:21:00 +00:00
|
|
|
assert enableThumbnails -> pythonPackages.pyxdg != null;
|
|
|
|
assert enableWeb -> pythonPackages.flask != null;
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
optionalPlugins = {
|
2016-02-09 20:43:50 +00:00
|
|
|
acousticbrainz = enableAcousticbrainz;
|
2015-10-26 09:26:48 +00:00
|
|
|
badfiles = enableBadfiles;
|
2014-12-30 21:53:00 +00:00
|
|
|
chroma = enableAcoustid;
|
2016-05-02 16:18:07 +01:00
|
|
|
convert = enableConvert;
|
2014-12-30 21:53:00 +00:00
|
|
|
discogs = enableDiscogs;
|
2016-02-02 15:07:25 +00:00
|
|
|
embyupdate = enableEmbyupdate;
|
2014-12-30 21:53:00 +00:00
|
|
|
fetchart = enableFetchart;
|
2017-06-28 21:27:17 +01:00
|
|
|
gmusic = enableGmusic;
|
2016-09-10 00:44:10 +01:00
|
|
|
keyfinder = enableKeyfinder;
|
2017-06-28 21:27:17 +01:00
|
|
|
kodiupdate = enableKodiupdate;
|
2014-12-30 21:53:00 +00:00
|
|
|
lastgenre = enableLastfm;
|
|
|
|
lastimport = enableLastfm;
|
|
|
|
mpdstats = enableMpd;
|
|
|
|
mpdupdate = enableMpd;
|
|
|
|
replaygain = enableReplaygain;
|
2015-04-13 21:04:51 +01:00
|
|
|
thumbnails = enableThumbnails;
|
2014-12-30 21:53:00 +00:00
|
|
|
web = enableWeb;
|
|
|
|
};
|
|
|
|
|
|
|
|
pluginsWithoutDeps = [
|
2017-01-10 06:34:55 +00:00
|
|
|
"absubmit" "beatport" "bench" "bpd" "bpm" "bucket" "cue" "duplicates"
|
|
|
|
"edit" "embedart" "export" "filefilter" "freedesktop" "fromfilename"
|
|
|
|
"ftintitle" "fuzzy" "hook" "ihate" "importadded" "importfeeds" "info"
|
|
|
|
"inline" "ipfs" "lyrics" "mbcollection" "mbsubmit" "mbsync" "metasync"
|
|
|
|
"missing" "permissions" "play" "plexupdate" "random" "rewrite" "scrub"
|
|
|
|
"smartplaylist" "spotify" "the" "types" "zero"
|
2014-12-30 21:53:00 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins);
|
|
|
|
|
|
|
|
allPlugins = pluginsWithoutDeps ++ attrNames optionalPlugins;
|
2014-12-30 22:13:56 +00:00
|
|
|
allEnabledPlugins = pluginsWithoutDeps ++ enabledOptionalPlugins;
|
|
|
|
|
2014-12-30 21:53:00 +00:00
|
|
|
testShell = "${bashInteractive}/bin/bash --norc";
|
2016-09-28 16:46:29 +01:00
|
|
|
completion = "${bash-completion}/share/bash-completion/bash_completion";
|
2014-12-30 21:53:00 +00:00
|
|
|
|
beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
# This is a stripped down beets for testing of the external plugins.
|
|
|
|
externalTestArgs.beets = (beets.override {
|
|
|
|
enableAlternatives = false;
|
|
|
|
enableCopyArtifacts = false;
|
|
|
|
}).overrideAttrs (stdenv.lib.const {
|
|
|
|
doInstallCheck = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
plugins = {
|
|
|
|
alternatives = callPackage ./alternatives-plugin.nix externalTestArgs;
|
|
|
|
copyartifacts = callPackage ./copyartifacts-plugin.nix externalTestArgs;
|
|
|
|
};
|
|
|
|
|
2016-12-03 04:21:00 +00:00
|
|
|
in pythonPackages.buildPythonApplication rec {
|
2014-12-30 21:46:22 +00:00
|
|
|
name = "beets-${version}";
|
2018-01-01 11:51:05 +00:00
|
|
|
version = "1.4.6";
|
2014-12-30 02:23:37 +00:00
|
|
|
|
2014-12-30 21:46:22 +00:00
|
|
|
src = fetchFromGitHub {
|
2016-11-28 07:52:26 +00:00
|
|
|
owner = "beetbox";
|
2014-12-30 21:46:22 +00:00
|
|
|
repo = "beets";
|
|
|
|
rev = "v${version}";
|
2018-01-01 11:51:05 +00:00
|
|
|
sha256 = "0m8macydkn1fp4ymig0rg7bzw77rrm454q763gxdpq2kg08yl5py";
|
2014-12-30 02:23:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2016-12-06 15:47:17 +00:00
|
|
|
pythonPackages.six
|
2016-12-03 04:21:00 +00:00
|
|
|
pythonPackages.enum34
|
|
|
|
pythonPackages.jellyfish
|
|
|
|
pythonPackages.munkres
|
|
|
|
pythonPackages.musicbrainzngs
|
|
|
|
pythonPackages.mutagen
|
|
|
|
pythonPackages.pathlib
|
|
|
|
pythonPackages.pyyaml
|
|
|
|
pythonPackages.unidecode
|
2017-02-19 22:35:24 +00:00
|
|
|
pythonPackages.gst-python
|
|
|
|
pythonPackages.pygobject3
|
|
|
|
gobjectIntrospection
|
beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
] ++ optional enableAcoustid pythonPackages.pyacoustid
|
2016-02-02 15:07:25 +00:00
|
|
|
++ optional (enableFetchart
|
2016-02-09 20:43:50 +00:00
|
|
|
|| enableEmbyupdate
|
2017-06-28 21:27:17 +01:00
|
|
|
|| enableKodiupdate
|
2016-02-09 20:43:50 +00:00
|
|
|
|| enableAcousticbrainz)
|
beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
pythonPackages.requests
|
|
|
|
++ optional enableConvert ffmpeg
|
|
|
|
++ optional enableDiscogs pythonPackages.discogs_client
|
|
|
|
++ optional enableGmusic pythonPackages.gmusicapi
|
|
|
|
++ optional enableKeyfinder keyfinder-cli
|
|
|
|
++ optional enableLastfm pythonPackages.pylast
|
|
|
|
++ optional enableMpd pythonPackages.mpd2
|
|
|
|
++ optional enableThumbnails pythonPackages.pyxdg
|
|
|
|
++ optional enableWeb pythonPackages.flask
|
|
|
|
++ optional enableAlternatives plugins.alternatives
|
|
|
|
++ optional enableCopyArtifacts plugins.copyartifacts;
|
2014-12-30 21:53:00 +00:00
|
|
|
|
2016-12-03 04:21:00 +00:00
|
|
|
buildInputs = with pythonPackages; [
|
2014-12-30 21:53:00 +00:00
|
|
|
beautifulsoup4
|
2015-06-01 04:51:04 +01:00
|
|
|
imagemagick
|
2014-12-30 21:53:00 +00:00
|
|
|
mock
|
|
|
|
nose
|
|
|
|
rarfile
|
|
|
|
responses
|
2017-02-19 22:35:24 +00:00
|
|
|
] ++ (with gst_all_1; [
|
|
|
|
gst-plugins-base
|
|
|
|
gst-plugins-good
|
|
|
|
gst-plugins-ugly
|
|
|
|
]);
|
2014-12-30 02:23:37 +00:00
|
|
|
|
2014-12-30 22:06:28 +00:00
|
|
|
patches = [
|
2015-12-18 01:03:00 +00:00
|
|
|
./replaygain-default-bs1770gain.patch
|
2016-09-10 00:44:10 +01:00
|
|
|
./keyfinder-default-bin.patch
|
2014-12-30 22:06:28 +00:00
|
|
|
];
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e '/assertIn.*item.*path/d' test/test_info.py
|
2016-02-10 01:41:15 +00:00
|
|
|
echo echo completion tests passed > test/rsrc/test_completion.sh
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
sed -i -e '/^BASH_COMPLETION_PATHS *=/,/^])$/ {
|
|
|
|
/^])$/i u"${completion}"
|
|
|
|
}' beets/ui/commands.py
|
2015-10-26 09:26:48 +00:00
|
|
|
'' + optionalString enableBadfiles ''
|
|
|
|
sed -i -e '/self\.run_command(\[/ {
|
2016-02-01 18:46:02 +00:00
|
|
|
s,"flac","${flac.bin}/bin/flac",
|
2015-10-26 09:26:48 +00:00
|
|
|
s,"mp3val","${mp3val}/bin/mp3val",
|
|
|
|
}' beetsplug/badfiles.py
|
2016-05-02 16:18:07 +01:00
|
|
|
'' + optionalString enableConvert ''
|
2017-06-28 21:27:17 +01:00
|
|
|
sed -i -e 's,\(util\.command_output(\)\([^)]\+\)),\1[b"${ffmpeg.bin}/bin/ffmpeg" if args[0] == b"ffmpeg" else args[0]] + \2[1:]),' beetsplug/convert.py
|
2015-12-18 01:03:00 +00:00
|
|
|
'' + optionalString enableReplaygain ''
|
|
|
|
sed -i -re '
|
|
|
|
s!^( *cmd *= *b?['\'''"])(bs1770gain['\'''"])!\1${bs1770gain}/bin/\2!
|
|
|
|
' beetsplug/replaygain.py
|
|
|
|
sed -i -e 's/if has_program.*bs1770gain.*:/if True:/' \
|
|
|
|
test/test_replaygain.py
|
2014-12-30 21:53:00 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2014-12-30 22:11:57 +00:00
|
|
|
preCheck = ''
|
|
|
|
find beetsplug -mindepth 1 \
|
|
|
|
\! -path 'beetsplug/__init__.py' -a \
|
|
|
|
\( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \
|
|
|
|
| sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \
|
|
|
|
| sort -u > plugins_available
|
|
|
|
|
2017-06-14 10:29:31 +01:00
|
|
|
${diffPlugins allPlugins "plugins_available"}
|
2014-12-30 22:11:57 +00:00
|
|
|
'';
|
|
|
|
|
2014-12-30 21:53:00 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2015-04-13 21:04:51 +01:00
|
|
|
LANG=en_US.UTF-8 \
|
2015-09-26 08:29:13 +01:00
|
|
|
LOCALE_ARCHIVE=${assert stdenv.isLinux; glibcLocales}/lib/locale/locale-archive \
|
2014-12-30 21:53:00 +00:00
|
|
|
BEETS_TEST_SHELL="${testShell}" \
|
|
|
|
BASH_COMPLETION_SCRIPT="${completion}" \
|
|
|
|
HOME="$(mktemp -d)" \
|
2018-01-01 11:51:05 +00:00
|
|
|
# Exclude failing test https://github.com/beetbox/beets/issues/2652
|
2018-01-27 09:47:19 +00:00
|
|
|
nosetests -v --exclude=test_single_month_nonmatch_ --exclude=test_asciify_variable --exclude=test_asciify_character_expanding_to_slash
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2014-12-30 02:23:37 +00:00
|
|
|
|
2014-12-30 22:13:56 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
tmphome="$(mktemp -d)"
|
|
|
|
|
|
|
|
EDITOR="${writeScript "beetconfig.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
cat > "$1" <<CFG
|
2015-01-22 09:33:48 +00:00
|
|
|
plugins: ${concatStringsSep " " allEnabledPlugins}
|
2014-12-30 22:13:56 +00:00
|
|
|
CFG
|
|
|
|
''}" HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2014-12-30 02:23:37 +00:00
|
|
|
|
2017-02-19 22:35:24 +00:00
|
|
|
makeWrapperArgs = [ "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" ];
|
|
|
|
|
2014-12-30 02:23:37 +00:00
|
|
|
meta = {
|
|
|
|
description = "Music tagger and library organizer";
|
2015-06-01 04:51:04 +01:00
|
|
|
homepage = http://beets.radbox.org;
|
|
|
|
license = licenses.mit;
|
2016-05-17 12:57:28 +01:00
|
|
|
maintainers = with maintainers; [ aszlig domenkozar pjones profpatsch ];
|
2015-09-26 08:29:13 +01:00
|
|
|
platforms = platforms.linux;
|
2014-12-30 02:23:37 +00:00
|
|
|
};
|
|
|
|
}
|