Skip to content

Commit 70a877a

Browse files
committed
beets: nixfmt & remove dead code
1 parent 4efaa7a commit 70a877a

File tree

5 files changed

+205
-143
lines changed

5 files changed

+205
-143
lines changed

pkgs/tools/audio/beets/builtin-plugins.nix

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
{ aacgain
2-
, ffmpeg
3-
, flac
4-
, imagemagick
5-
, keyfinder-cli
6-
, mp3gain
7-
, mp3val
8-
, python3Packages
9-
, ...
10-
}: {
1+
{
2+
aacgain,
3+
ffmpeg,
4+
flac,
5+
imagemagick,
6+
keyfinder-cli,
7+
mp3gain,
8+
mp3val,
9+
python3Packages,
10+
...
11+
}:
12+
{
1113
absubmit = {
1214
deprecated = true;
1315
testPaths = [ ];
@@ -17,7 +19,10 @@
1719
};
1820
albumtypes = { };
1921
aura = {
20-
propagatedBuildInputs = with python3Packages; [ flask pillow ];
22+
propagatedBuildInputs = with python3Packages; [
23+
flask
24+
pillow
25+
];
2126
testPaths = [ ];
2227
};
2328
autobpm = {
@@ -30,7 +35,10 @@
3035
};
3136
badfiles = {
3237
testPaths = [ ];
33-
wrapperBins = [ mp3val flac ];
38+
wrapperBins = [
39+
mp3val
40+
flac
41+
];
3442
};
3543
bareasc = { };
3644
beatport.propagatedBuildInputs = [ python3Packages.requests-oauthlib ];
@@ -48,7 +56,10 @@
4856
propagatedBuildInputs = [ python3Packages.requests ];
4957
testPaths = [ ];
5058
};
51-
discogs.propagatedBuildInputs = with python3Packages; [ discogs-client requests ];
59+
discogs.propagatedBuildInputs = with python3Packages; [
60+
discogs-client
61+
requests
62+
];
5263
duplicates.testPaths = [ ];
5364
edit = { };
5465
embedart = {
@@ -58,7 +69,10 @@
5869
embyupdate.propagatedBuildInputs = [ python3Packages.requests ];
5970
export = { };
6071
fetchart = {
61-
propagatedBuildInputs = with python3Packages; [ requests pillow ];
72+
propagatedBuildInputs = with python3Packages; [
73+
requests
74+
pillow
75+
];
6276
wrapperBins = [ imagemagick ];
6377
};
6478
filefilter = { };
@@ -110,8 +124,12 @@
110124
playlist.propagatedBuildInputs = [ python3Packages.requests ];
111125
plexupdate = { };
112126
random = { };
113-
replaygain.wrapperBins = [ aacgain ffmpeg mp3gain ];
114-
rewrite.testPaths= [ ];
127+
replaygain.wrapperBins = [
128+
aacgain
129+
ffmpeg
130+
mp3gain
131+
];
132+
rewrite.testPaths = [ ];
115133
scrub.testPaths = [ ];
116134
smartplaylist = { };
117135
sonosupdate = {
@@ -129,7 +147,10 @@
129147
};
130148
the = { };
131149
thumbnails = {
132-
propagatedBuildInputs = with python3Packages; [ pillow pyxdg ];
150+
propagatedBuildInputs = with python3Packages; [
151+
pillow
152+
pyxdg
153+
];
133154
wrapperBins = [ imagemagick ];
134155
};
135156
types.testPaths = [ "test/plugins/test_types_plugin.py" ];

pkgs/tools/audio/beets/common.nix

Lines changed: 133 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,75 @@
1-
{ fetchpatch
2-
, bashInteractive
3-
, diffPlugins
4-
, glibcLocales
5-
, gobject-introspection
6-
, gst_all_1
7-
, lib
8-
, python3Packages
9-
, sphinxHook
10-
, runtimeShell
11-
, writeScript
12-
13-
# plugin deps
14-
, aacgain
15-
, essentia-extractor
16-
, ffmpeg
17-
, flac
18-
, imagemagick
19-
, keyfinder-cli
20-
, mp3gain
21-
, mp3val
22-
23-
, src
24-
, version
25-
, extraPatches ? [ ]
26-
, pluginOverrides ? { }
27-
, disableAllPlugins ? false
28-
, disabledTests ? []
29-
, extraNativeBuildInputs ? []
1+
{
2+
lib,
3+
src,
4+
version,
5+
bashInteractive,
6+
diffPlugins,
7+
gobject-introspection,
8+
gst_all_1,
9+
python3Packages,
10+
sphinxHook,
11+
runtimeShell,
12+
writeScript,
13+
14+
# plugin deps, used indirectly by the @inputs when we `import ./builtin-plugins.nix`
15+
aacgain,
16+
essentia-extractor,
17+
ffmpeg,
18+
flac,
19+
imagemagick,
20+
keyfinder-cli,
21+
mp3gain,
22+
mp3val,
23+
24+
extraPatches ? [ ],
25+
pluginOverrides ? { },
26+
disableAllPlugins ? false,
27+
disabledTests ? [ ],
28+
extraNativeBuildInputs ? [ ],
3029

3130
# tests
32-
, runCommand
33-
, beets
31+
runCommand,
32+
beets,
3433
}@inputs:
3534
let
3635
inherit (lib) attrNames attrValues concatMap;
3736

38-
mkPlugin = { name
39-
, enable ? !disableAllPlugins
40-
, builtin ? false
41-
, propagatedBuildInputs ? [ ]
42-
, testPaths ? [
43-
# NOTE: This conditional can be removed when beets-stable is updated and
44-
# the default plugins test path is changed
45-
(if (lib.versions.majorMinor version) == "1.6" then
46-
"test/test_${name}.py"
47-
else
48-
"test/plugins/test_${name}.py"
49-
)
50-
]
51-
, wrapperBins ? [ ]
52-
}: {
53-
inherit name enable builtin propagatedBuildInputs testPaths wrapperBins;
54-
};
37+
mkPlugin =
38+
{
39+
name,
40+
enable ? !disableAllPlugins,
41+
builtin ? false,
42+
propagatedBuildInputs ? [ ],
43+
testPaths ? [
44+
"test/plugins/test_${name}.py"
45+
],
46+
wrapperBins ? [ ],
47+
}:
48+
{
49+
inherit
50+
name
51+
enable
52+
builtin
53+
propagatedBuildInputs
54+
testPaths
55+
wrapperBins
56+
;
57+
};
5558

5659
basePlugins = lib.mapAttrs (_: a: { builtin = true; } // a) (import ./builtin-plugins.nix inputs);
57-
pluginOverrides' = lib.mapAttrs
58-
(plugName: lib.throwIf
59-
(basePlugins.${plugName}.deprecated or false)
60+
pluginOverrides' = lib.mapAttrs (
61+
plugName:
62+
lib.throwIf (basePlugins.${plugName}.deprecated or false)
6063
"beets evaluation error: Plugin ${plugName} was enabled in pluginOverrides, but it has been removed. Remove the override to fix evaluation."
61-
)
62-
pluginOverrides
63-
;
64+
) pluginOverrides;
6465

65-
allPlugins = lib.mapAttrs ( n: a: mkPlugin { name = n; } // a) (lib.recursiveUpdate basePlugins pluginOverrides');
66+
allPlugins = lib.mapAttrs (n: a: mkPlugin { name = n; } // a) (
67+
lib.recursiveUpdate basePlugins pluginOverrides'
68+
);
6669
builtinPlugins = lib.filterAttrs (_: p: p.builtin) allPlugins;
6770
enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins;
6871
disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins;
72+
disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins));
6973

7074
pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins);
7175
in
@@ -75,36 +79,48 @@ python3Packages.buildPythonApplication {
7579

7680
patches = extraPatches;
7781

78-
propagatedBuildInputs = with python3Packages; [
79-
confuse
80-
gst-python
81-
jellyfish
82-
mediafile
83-
munkres
84-
musicbrainzngs
85-
mutagen
86-
pygobject3
87-
pyyaml
88-
reflink
89-
unidecode
90-
typing-extensions
91-
] ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins));
82+
propagatedBuildInputs =
83+
with python3Packages;
84+
[
85+
confuse
86+
gst-python
87+
jellyfish
88+
mediafile
89+
munkres
90+
musicbrainzngs
91+
mutagen
92+
pygobject3
93+
pyyaml
94+
reflink
95+
unidecode
96+
typing-extensions
97+
]
98+
++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins));
9299

93100
nativeBuildInputs = [
94101
gobject-introspection
95102
sphinxHook
96103
python3Packages.pydata-sphinx-theme
97104
] ++ extraNativeBuildInputs;
98105

99-
buildInputs = [
100-
] ++ (with gst_all_1; [
101-
gst-plugins-base
102-
gst-plugins-good
103-
gst-plugins-ugly
104-
]);
105-
106-
outputs = [ "out" "doc" "man" ];
107-
sphinxBuilders = [ "html" "man" ];
106+
buildInputs =
107+
[
108+
]
109+
++ (with gst_all_1; [
110+
gst-plugins-base
111+
gst-plugins-good
112+
gst-plugins-ugly
113+
]);
114+
115+
outputs = [
116+
"out"
117+
"doc"
118+
"man"
119+
];
120+
sphinxBuilders = [
121+
"html"
122+
"man"
123+
];
108124

109125
postInstall = ''
110126
mkdir -p $out/share/zsh/site-functions
@@ -117,17 +133,20 @@ python3Packages.buildPythonApplication {
117133
"--prefix PATH : ${lib.makeBinPath pluginWrapperBins}"
118134
];
119135

120-
nativeCheckInputs = with python3Packages; [
121-
pytestCheckHook
122-
pytest-cov
123-
mock
124-
rarfile
125-
responses
126-
] ++ pluginWrapperBins;
136+
nativeCheckInputs =
137+
with python3Packages;
138+
[
139+
pytestCheckHook
140+
pytest-cov
141+
mock
142+
rarfile
143+
responses
144+
]
145+
++ pluginWrapperBins;
127146

128147
__darwinAllowLocalNetworking = true;
129148

130-
disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins));
149+
inherit disabledTestPaths;
131150
inherit disabledTests;
132151

133152
# Perform extra "sanity checks", before running pytest tests.
@@ -152,30 +171,38 @@ python3Packages.buildPythonApplication {
152171
env EDITOR=true "$out/bin/beet" config -e
153172
'';
154173

155-
156174
passthru.plugins = allPlugins;
157175

158-
passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
159-
meta.timeout = 60;
160-
} ''
161-
set -euo pipefail
162-
export HOME=$(mktemp -d)
163-
mkdir $out
164-
165-
cat << EOF > $out/config.yaml
166-
replaygain:
167-
backend: gstreamer
168-
EOF
169-
170-
${beets}/bin/beet -c $out/config.yaml > /dev/null
171-
'';
172-
173-
meta = with lib; {
176+
passthru.tests.gstreamer =
177+
runCommand "beets-gstreamer-test"
178+
{
179+
meta.timeout = 60;
180+
}
181+
''
182+
set -euo pipefail
183+
export HOME=$(mktemp -d)
184+
mkdir $out
185+
186+
cat << EOF > $out/config.yaml
187+
replaygain:
188+
backend: gstreamer
189+
EOF
190+
191+
${beets}/bin/beet -c $out/config.yaml > /dev/null
192+
'';
193+
194+
meta = {
174195
description = "Music tagger and library organizer";
175196
homepage = "https://beets.io";
176-
license = licenses.mit;
177-
maintainers = with maintainers; [ aszlig doronbehar lovesegfault montchr pjones ];
178-
platforms = platforms.linux ++ platforms.darwin;
197+
license = lib.licenses.mit;
198+
maintainers = with lib.maintainers; [
199+
aszlig
200+
doronbehar
201+
lovesegfault
202+
montchr
203+
pjones
204+
];
205+
platforms = lib.platforms.linux ++ lib.platforms.darwin;
179206
mainProgram = "beet";
180207
};
181208
}

0 commit comments

Comments
 (0)