Commit 70a877ad authored by Doron Behar's avatar Doron Behar
Browse files

beets: nixfmt & remove dead code

parent 4efaa7ae
Loading
Loading
Loading
Loading
+38 −17
Original line number Diff line number Diff line
{ aacgain
, ffmpeg
, flac
, imagemagick
, keyfinder-cli
, mp3gain
, mp3val
, python3Packages
, ...
}: {
{
  aacgain,
  ffmpeg,
  flac,
  imagemagick,
  keyfinder-cli,
  mp3gain,
  mp3val,
  python3Packages,
  ...
}:
{
  absubmit = {
    deprecated = true;
    testPaths = [ ];
@@ -17,7 +19,10 @@
  };
  albumtypes = { };
  aura = {
    propagatedBuildInputs = with python3Packages; [ flask pillow ];
    propagatedBuildInputs = with python3Packages; [
      flask
      pillow
    ];
    testPaths = [ ];
  };
  autobpm = {
@@ -30,7 +35,10 @@
  };
  badfiles = {
    testPaths = [ ];
    wrapperBins = [ mp3val flac ];
    wrapperBins = [
      mp3val
      flac
    ];
  };
  bareasc = { };
  beatport.propagatedBuildInputs = [ python3Packages.requests-oauthlib ];
@@ -48,7 +56,10 @@
    propagatedBuildInputs = [ python3Packages.requests ];
    testPaths = [ ];
  };
  discogs.propagatedBuildInputs = with python3Packages; [ discogs-client requests ];
  discogs.propagatedBuildInputs = with python3Packages; [
    discogs-client
    requests
  ];
  duplicates.testPaths = [ ];
  edit = { };
  embedart = {
@@ -58,7 +69,10 @@
  embyupdate.propagatedBuildInputs = [ python3Packages.requests ];
  export = { };
  fetchart = {
    propagatedBuildInputs = with python3Packages; [ requests pillow ];
    propagatedBuildInputs = with python3Packages; [
      requests
      pillow
    ];
    wrapperBins = [ imagemagick ];
  };
  filefilter = { };
@@ -110,7 +124,11 @@
  playlist.propagatedBuildInputs = [ python3Packages.requests ];
  plexupdate = { };
  random = { };
  replaygain.wrapperBins = [ aacgain ffmpeg mp3gain ];
  replaygain.wrapperBins = [
    aacgain
    ffmpeg
    mp3gain
  ];
  rewrite.testPaths = [ ];
  scrub.testPaths = [ ];
  smartplaylist = { };
@@ -129,7 +147,10 @@
  };
  the = { };
  thumbnails = {
    propagatedBuildInputs = with python3Packages; [ pillow pyxdg ];
    propagatedBuildInputs = with python3Packages; [
      pillow
      pyxdg
    ];
    wrapperBins = [ imagemagick ];
  };
  types.testPaths = [ "test/plugins/test_types_plugin.py" ];
+133 −106
Original line number Diff line number Diff line
{ fetchpatch
, bashInteractive
, diffPlugins
, glibcLocales
, gobject-introspection
, gst_all_1
, lib
, python3Packages
, sphinxHook
, runtimeShell
, writeScript

  # plugin deps
, aacgain
, essentia-extractor
, ffmpeg
, flac
, imagemagick
, keyfinder-cli
, mp3gain
, mp3val

, src
, version
, extraPatches ? [ ]
, pluginOverrides ? { }
, disableAllPlugins ? false
, disabledTests ? []
, extraNativeBuildInputs ? []
{
  lib,
  src,
  version,
  bashInteractive,
  diffPlugins,
  gobject-introspection,
  gst_all_1,
  python3Packages,
  sphinxHook,
  runtimeShell,
  writeScript,

  # plugin deps, used indirectly by the @inputs when we `import ./builtin-plugins.nix`
  aacgain,
  essentia-extractor,
  ffmpeg,
  flac,
  imagemagick,
  keyfinder-cli,
  mp3gain,
  mp3val,

  extraPatches ? [ ],
  pluginOverrides ? { },
  disableAllPlugins ? false,
  disabledTests ? [ ],
  extraNativeBuildInputs ? [ ],

  # tests
, runCommand
, beets
  runCommand,
  beets,
}@inputs:
let
  inherit (lib) attrNames attrValues concatMap;

  mkPlugin = { name
  , enable ? !disableAllPlugins
  , builtin ? false
  , propagatedBuildInputs ? [ ]
  , testPaths ? [
    # NOTE: This conditional can be removed when beets-stable is updated and
    # the default plugins test path is changed
    (if (lib.versions.majorMinor version) == "1.6" then
      "test/test_${name}.py"
    else
  mkPlugin =
    {
      name,
      enable ? !disableAllPlugins,
      builtin ? false,
      propagatedBuildInputs ? [ ],
      testPaths ? [
        "test/plugins/test_${name}.py"
    )
  ]
  , wrapperBins ? [ ]
  }: {
    inherit name enable builtin propagatedBuildInputs testPaths wrapperBins;
      ],
      wrapperBins ? [ ],
    }:
    {
      inherit
        name
        enable
        builtin
        propagatedBuildInputs
        testPaths
        wrapperBins
        ;
    };

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

  allPlugins = lib.mapAttrs ( n: a: mkPlugin { name = n; } // a) (lib.recursiveUpdate basePlugins pluginOverrides');
  allPlugins = lib.mapAttrs (n: a: mkPlugin { name = n; } // a) (
    lib.recursiveUpdate basePlugins pluginOverrides'
  );
  builtinPlugins = lib.filterAttrs (_: p: p.builtin) allPlugins;
  enabledPlugins = lib.filterAttrs (_: p: p.enable) allPlugins;
  disabledPlugins = lib.filterAttrs (_: p: !p.enable) allPlugins;
  disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins));

  pluginWrapperBins = concatMap (p: p.wrapperBins) (attrValues enabledPlugins);
in
@@ -75,7 +79,9 @@ python3Packages.buildPythonApplication {

  patches = extraPatches;

  propagatedBuildInputs = with python3Packages; [
  propagatedBuildInputs =
    with python3Packages;
    [
      confuse
      gst-python
      jellyfish
@@ -88,7 +94,8 @@ python3Packages.buildPythonApplication {
      reflink
      unidecode
      typing-extensions
  ] ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins));
    ]
    ++ (concatMap (p: p.propagatedBuildInputs) (attrValues enabledPlugins));

  nativeBuildInputs = [
    gobject-introspection
@@ -96,15 +103,24 @@ python3Packages.buildPythonApplication {
    python3Packages.pydata-sphinx-theme
  ] ++ extraNativeBuildInputs;

  buildInputs = [
  ] ++ (with gst_all_1; [
  buildInputs =
    [
    ]
    ++ (with gst_all_1; [
      gst-plugins-base
      gst-plugins-good
      gst-plugins-ugly
    ]);

  outputs = [ "out" "doc" "man" ];
  sphinxBuilders = [ "html" "man" ];
  outputs = [
    "out"
    "doc"
    "man"
  ];
  sphinxBuilders = [
    "html"
    "man"
  ];

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

  nativeCheckInputs = with python3Packages; [
  nativeCheckInputs =
    with python3Packages;
    [
      pytestCheckHook
      pytest-cov
      mock
      rarfile
      responses
  ] ++ pluginWrapperBins;
    ]
    ++ pluginWrapperBins;

  __darwinAllowLocalNetworking = true;

  disabledTestPaths = lib.flatten (attrValues (lib.mapAttrs (_: v: v.testPaths) disabledPlugins));
  inherit disabledTestPaths;
  inherit disabledTests;

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


  passthru.plugins = allPlugins;

  passthru.tests.gstreamer = runCommand "beets-gstreamer-test" {
  passthru.tests.gstreamer =
    runCommand "beets-gstreamer-test"
      {
        meta.timeout = 60;
  } ''
      }
      ''
            set -euo pipefail
            export HOME=$(mktemp -d)
            mkdir $out
@@ -170,12 +191,18 @@ EOF
            ${beets}/bin/beet -c $out/config.yaml > /dev/null
      '';

  meta = with lib; {
  meta = {
    description = "Music tagger and library organizer";
    homepage = "https://beets.io";
    license = licenses.mit;
    maintainers = with maintainers; [ aszlig doronbehar lovesegfault montchr pjones ];
    platforms = platforms.linux ++ platforms.darwin;
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      aszlig
      doronbehar
      lovesegfault
      montchr
      pjones
    ];
    platforms = lib.platforms.linux ++ lib.platforms.darwin;
    mainProgram = "beet";
  };
}
+16 −15
Original line number Diff line number Diff line
{ lib
, callPackage
, fetchFromGitHub
, python3Packages
{
  lib,
  callPackage,
  fetchFromGitHub,
  python3Packages,
}:
/*
  ** To customize the enabled beets plugins, use the pluginOverrides input to the
+12 −4
Original line number Diff line number Diff line
{ lib, fetchFromGitHub, beets, python3Packages }:
{
  lib,
  fetchFromGitHub,
  beets,
  python3Packages,
}:

python3Packages.buildPythonApplication rec {
  pname = "beets-alternatives";
@@ -27,10 +32,13 @@ python3Packages.buildPythonApplication rec {
    export HOME=$(mktemp -d)
  '';

  meta = with lib; {
  meta = {
    description = "Beets plugin to manage external files";
    homepage = "https://github.com/geigerzaehler/beets-alternatives";
    maintainers = with maintainers; [ aszlig lovesegfault ];
    license = licenses.mit;
    maintainers = with lib.maintainers; [
      aszlig
      lovesegfault
    ];
    license = lib.licenses.mit;
  };
}
+6 −1
Original line number Diff line number Diff line
{ lib, fetchFromGitHub, beets, python3Packages }:
{
  lib,
  fetchFromGitHub,
  beets,
  python3Packages,
}:

python3Packages.buildPythonApplication rec {
  pname = "beets-copyartifacts";