2015-04-13 22:04:51 +02:00
|
|
|
{ stdenv, fetchFromGitHub, writeScript, glibcLocales
|
2014-12-30 22:53:00 +01:00
|
|
|
, buildPythonPackage, pythonPackages, python
|
2014-12-30 03:23:37 +01:00
|
|
|
|
2014-12-30 22:53:00 +01:00
|
|
|
, enableAcoustid ? true
|
|
|
|
, enableDiscogs ? true
|
|
|
|
, enableEchonest ? true
|
|
|
|
, enableFetchart ? true
|
|
|
|
, enableLastfm ? true
|
|
|
|
, enableMpd ? true
|
|
|
|
, enableReplaygain ? true
|
2015-04-13 22:04:51 +02:00
|
|
|
, enableThumbnails ? true
|
2014-12-30 22:53:00 +01:00
|
|
|
, enableWeb ? true
|
|
|
|
|
|
|
|
, bashInteractive, bashCompletion
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert enableAcoustid -> pythonPackages.pyacoustid != null;
|
|
|
|
assert enableDiscogs -> pythonPackages.discogs_client != null;
|
|
|
|
assert enableEchonest -> pythonPackages.pyechonest != null;
|
|
|
|
assert enableFetchart -> pythonPackages.responses != null;
|
|
|
|
assert enableLastfm -> pythonPackages.pylast != null;
|
|
|
|
assert enableMpd -> pythonPackages.mpd != null;
|
|
|
|
assert enableReplaygain -> pythonPackages.audiotools != null;
|
2015-04-14 09:36:12 +02:00
|
|
|
assert enableThumbnails -> pythonPackages.pyxdg != null;
|
2014-12-30 22:53:00 +01:00
|
|
|
assert enableWeb -> pythonPackages.flask != null;
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
optionalPlugins = {
|
|
|
|
chroma = enableAcoustid;
|
|
|
|
discogs = enableDiscogs;
|
|
|
|
echonest = enableEchonest;
|
|
|
|
fetchart = enableFetchart;
|
|
|
|
lastgenre = enableLastfm;
|
|
|
|
lastimport = enableLastfm;
|
|
|
|
mpdstats = enableMpd;
|
|
|
|
mpdupdate = enableMpd;
|
|
|
|
replaygain = enableReplaygain;
|
2015-04-13 22:04:51 +02:00
|
|
|
thumbnails = enableThumbnails;
|
2014-12-30 22:53:00 +01:00
|
|
|
web = enableWeb;
|
|
|
|
};
|
|
|
|
|
|
|
|
pluginsWithoutDeps = [
|
2015-04-14 09:36:12 +02:00
|
|
|
"bench" "bpd" "bpm" "bucket" "convert" "cue" "duplicates" "embedart"
|
|
|
|
"filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy" "ihate"
|
|
|
|
"importadded" "importfeeds" "info" "inline" "keyfinder" "lyrics"
|
|
|
|
"mbcollection" "mbsync" "missing" "permissions" "play" "plexupdate" "random"
|
|
|
|
"rewrite" "scrub" "smartplaylist" "spotify" "the" "types" "zero"
|
2014-12-30 22:53:00 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins);
|
|
|
|
|
|
|
|
allPlugins = pluginsWithoutDeps ++ attrNames optionalPlugins;
|
2014-12-30 23:13:56 +01:00
|
|
|
allEnabledPlugins = pluginsWithoutDeps ++ enabledOptionalPlugins;
|
|
|
|
|
2014-12-30 22:53:00 +01:00
|
|
|
testShell = "${bashInteractive}/bin/bash --norc";
|
|
|
|
completion = "${bashCompletion}/share/bash-completion/bash_completion";
|
|
|
|
|
|
|
|
in buildPythonPackage rec {
|
2014-12-30 22:46:22 +01:00
|
|
|
name = "beets-${version}";
|
2015-04-13 22:04:51 +02:00
|
|
|
version = "1.3.11";
|
2014-12-30 03:23:37 +01:00
|
|
|
namePrefix = "";
|
|
|
|
|
2014-12-30 22:46:22 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sampsyo";
|
|
|
|
repo = "beets";
|
|
|
|
rev = "v${version}";
|
2015-04-13 22:04:51 +02:00
|
|
|
sha256 = "16jb1frds9vl40n9hy18x9xipxfzln3ym823vx8jymhv3by8p62m";
|
2014-12-30 03:23:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2014-12-30 22:53:00 +01:00
|
|
|
pythonPackages.enum34
|
2014-12-30 03:23:37 +01:00
|
|
|
pythonPackages.munkres
|
|
|
|
pythonPackages.musicbrainzngs
|
2014-12-30 22:53:00 +01:00
|
|
|
pythonPackages.mutagen
|
2015-04-13 22:04:51 +02:00
|
|
|
pythonPackages.pathlib
|
2014-12-30 22:53:00 +01:00
|
|
|
pythonPackages.pyyaml
|
|
|
|
pythonPackages.unidecode
|
2014-12-30 03:23:37 +01:00
|
|
|
python.modules.sqlite3
|
|
|
|
python.modules.readline
|
2015-04-13 22:04:51 +02:00
|
|
|
] ++ optional enableAcoustid pythonPackages.pyacoustid
|
|
|
|
++ optional enableFetchart pythonPackages.requests2
|
|
|
|
++ optional enableDiscogs pythonPackages.discogs_client
|
|
|
|
++ optional enableEchonest pythonPackages.pyechonest
|
|
|
|
++ optional enableLastfm pythonPackages.pylast
|
|
|
|
++ optional enableMpd pythonPackages.mpd
|
|
|
|
++ optional enableReplaygain pythonPackages.audiotools
|
2015-04-14 09:36:12 +02:00
|
|
|
++ optional enableThumbnails pythonPackages.pyxdg
|
2015-04-13 22:04:51 +02:00
|
|
|
++ optional enableWeb pythonPackages.flask;
|
2014-12-30 22:53:00 +01:00
|
|
|
|
|
|
|
buildInputs = with pythonPackages; [
|
|
|
|
beautifulsoup4
|
|
|
|
flask
|
|
|
|
mock
|
|
|
|
nose
|
|
|
|
pyechonest
|
|
|
|
pylast
|
|
|
|
rarfile
|
|
|
|
requests2
|
|
|
|
responses
|
2014-12-30 03:23:37 +01:00
|
|
|
];
|
|
|
|
|
2014-12-30 23:06:28 +01:00
|
|
|
patches = [
|
|
|
|
./replaygain-default-audiotools.patch
|
|
|
|
];
|
2014-12-30 22:53:00 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e '/assertIn.*item.*path/d' test/test_info.py
|
|
|
|
echo echo completion tests passed > test/test_completion.sh
|
|
|
|
|
|
|
|
sed -i -e '/^BASH_COMPLETION_PATHS *=/,/^])$/ {
|
|
|
|
/^])$/i u"${completion}"
|
|
|
|
}' beets/ui/commands.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2014-12-30 23:11:57 +01:00
|
|
|
preCheck = ''
|
|
|
|
(${concatMapStrings (s: "echo \"${s}\";") allPlugins}) \
|
|
|
|
| sort -u > plugins_defined
|
|
|
|
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
|
|
|
|
|
|
|
|
if ! mismatches="$(diff -y plugins_defined plugins_available)"; then
|
|
|
|
echo "The the list of defined plugins (left side) doesn't match" \
|
|
|
|
"the list of available plugins (right side):" >&2
|
|
|
|
echo "$mismatches" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2014-12-30 22:53:00 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2015-04-13 22:04:51 +02:00
|
|
|
LANG=en_US.UTF-8 \
|
|
|
|
LOCALE_ARCHIVE=${glibcLocales}/lib/locale/locale-archive \
|
2014-12-30 22:53:00 +01:00
|
|
|
BEETS_TEST_SHELL="${testShell}" \
|
|
|
|
BASH_COMPLETION_SCRIPT="${completion}" \
|
|
|
|
HOME="$(mktemp -d)" \
|
|
|
|
nosetests -v
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2014-12-30 03:23:37 +01:00
|
|
|
|
2014-12-30 23:13:56 +01:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
tmphome="$(mktemp -d)"
|
|
|
|
|
|
|
|
EDITOR="${writeScript "beetconfig.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
cat > "$1" <<CFG
|
2015-01-22 10:33:48 +01:00
|
|
|
plugins: ${concatStringsSep " " allEnabledPlugins}
|
2014-12-30 23:13:56 +01:00
|
|
|
CFG
|
|
|
|
''}" HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2014-12-30 03:23:37 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = http://beets.radbox.org;
|
|
|
|
description = "Music tagger and library organizer";
|
|
|
|
license = stdenv.lib.licenses.mit;
|
2015-04-13 22:04:51 +02:00
|
|
|
maintainers = with stdenv.lib.maintainers; [ iElectric aszlig pjones ];
|
2014-12-30 03:23:37 +01:00
|
|
|
};
|
|
|
|
}
|