3
0
Fork 0
forked from mirrors/nixpkgs

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
This commit is contained in:
aszlig 2018-08-02 01:41:36 +02:00
parent 90e0428d5d
commit 29e89248bf
No known key found for this signature in database
GPG key ID: 684089CE67EBB691
4 changed files with 11 additions and 43 deletions

View file

@ -1,30 +0,0 @@
diff --git a/test/helper.py b/test/helper.py
index c216226..d409c09 100644
--- a/test/helper.py
+++ b/test/helper.py
@@ -11,6 +11,7 @@ import beets
from beets import plugins
from beets import ui
from beets.library import Item
+from beets.util import MoveOperation
from beetsplug import alternatives
from beetsplug import convert
@@ -183,7 +184,7 @@ class TestHelper(Assertions):
item = Item.from_path(os.path.join(self.fixture_dir, 'min.' + ext))
item.add(self.lib)
item.update(values)
- item.move(copy=True)
+ item.move(operation=MoveOperation.COPY)
item.write()
album = self.lib.add_album([item])
album.albumartist = item.artist
@@ -201,7 +202,7 @@ class TestHelper(Assertions):
item = Item.from_path(os.path.join(self.fixture_dir, 'min.mp3'))
item.add(self.lib)
item.update(values)
- item.move(copy=True)
+ item.move(operation=MoveOperation.COPY)
item.write()
return item

View file

@ -6,24 +6,20 @@ pythonPackages.buildPythonApplication rec {
src = fetchFromGitHub {
repo = "beets-alternatives";
owner = "geigerzaehler";
rev = "v${version}";
sha256 = "10za6h59pxa13y8i4amqhc6392csml0dl771lssv6b6a98kamsy7";
owner = "wisp3rwind";
# This is 0.8.2 with fixes against Beets 1.4.6 and Python 3 compatibility.
rev = "331eb406786a2d4dc3dd721a534225b087474b1e";
sha256 = "1avds2x5sp72c89l1j52pszprm85g9sm750jh1dhnyvgcbk91cb5";
};
patches = [ ./alternatives-beets-1.4.6.patch ];
postPatch = ''
sed -i -e '/install_requires/,/\]/{/beets/d}' setup.py
sed -i -e '/test_suite/d' setup.py
sed -i -e '/long_description/d' setup.py
'';
nativeBuildInputs = [ beets pythonPackages.nose ];
checkPhase = "nosetests";
propagatedBuildInputs = with pythonPackages; [ futures ];
meta = {
description = "Beets plugin to manage external files";
homepage = https://github.com/geigerzaehler/beets-alternatives;

View file

@ -6,8 +6,8 @@ pythonPackages.buildPythonApplication rec {
src = fetchFromGitHub {
repo = "beets-copyartifacts";
owner = "sbarakat";
rev = "4a5d347c858d25641c8a0eb7d8cb1a2cac10252a";
sha256 = "0bn6fci480ilghrdhpsjxxq29dxgni22sv1qalz770xy130g1zk3";
rev = "d0bb75c8fc8fe125e8191d73de7ade6212aec0fd";
sha256 = "19b4lqq1p45n348ssmql60jylw2fw7vfj9j22nly5qj5qx51j3g5";
};
postPatch = ''

View file

@ -91,9 +91,11 @@ let
doInstallCheck = false;
});
pluginArgs = externalTestArgs // { inherit pythonPackages; };
plugins = {
alternatives = callPackage ./alternatives-plugin.nix externalTestArgs;
copyartifacts = callPackage ./copyartifacts-plugin.nix externalTestArgs;
alternatives = callPackage ./alternatives-plugin.nix pluginArgs;
copyartifacts = callPackage ./copyartifacts-plugin.nix pluginArgs;
};
in pythonPackages.buildPythonApplication rec {