1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 14:11:36 +00:00
nixpkgs/pkgs/tools/audio/beets/copyartifacts-plugin.nix
aszlig 29e89248bf
beets: Fix building plugins with Python 3
Since the switch to using python3Packages in commit
72934aa94e, the plugins no longer build
because they end up with a mix of Python 2 and Python 3 packages.

The reason for this is that the Beets package itself uses callPackage to
reference the plugins, however the overrides are not applied there and
thus the plugins end up getting pythonPackages from the top-level which
is Python 2 and beets with Python 3 dependencies.

Unfortunately this is not the only reason for the builds to fail,
because both plugins did not actually support Python 3.

For the copyartifacts plugin, the fix is rather easy because we only
need to advance to two more recent commits from upstream, which already
contain fixes for Python 3.

The alternatives plugin on the other hand is not maintained anymore, but
there is a fork at https://github.com/wisp3rwind/beets-alternatives
which has a bunch of fixes. In 2e4aded366
I already backported one of these fixes to the version from
https://github.com/geigerzaehler/beets-alternatives, but for Python 3
support it's a bit more complicated than just one little fix.

So instead of adding another series of patches which replicate the code
base of the fork and become a maintenance burden, I opted to directly
switch to the fork and remove the patch on our side.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @domenkozar, @pjones, @Profpatsch
2018-08-02 01:41:36 +02:00

34 lines
1.1 KiB
Nix

{ stdenv, fetchFromGitHub, beets, pythonPackages, glibcLocales }:
pythonPackages.buildPythonApplication rec {
name = "beets-copyartifacts";
src = fetchFromGitHub {
repo = "beets-copyartifacts";
owner = "sbarakat";
rev = "d0bb75c8fc8fe125e8191d73de7ade6212aec0fd";
sha256 = "19b4lqq1p45n348ssmql60jylw2fw7vfj9j22nly5qj5qx51j3g5";
};
postPatch = ''
sed -i -e '/install_requires/,/\]/{/beets/d}' setup.py
sed -i -e '/namespace_packages/d' setup.py
printf 'from pkgutil import extend_path\n__path__ = extend_path(__path__, __name__)\n' >beetsplug/__init__.py
# Skip test which is already failing upstream.
sed -i -e '1i import unittest' \
-e 's/\(^ *\)# failing/\1@unittest.skip/' \
tests/test_reimport.py
'';
nativeBuildInputs = [ beets pythonPackages.nose glibcLocales ];
checkPhase = "LANG=en_US.UTF-8 nosetests";
meta = {
description = "Beets plugin to move non-music files during the import process";
homepage = https://github.com/sbarakat/beets-copyartifacts;
license = stdenv.lib.licenses.mit;
};
}