beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
{ stdenv, fetchFromGitHub, beets, pythonPackages, glibcLocales }:
|
2016-09-10 00:43:42 +01:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
pythonPackages.buildPythonApplication {
|
2016-09-10 00:43:42 +01:00
|
|
|
name = "beets-copyartifacts";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
repo = "beets-copyartifacts";
|
|
|
|
owner = "sbarakat";
|
beets: Fix building plugins with Python 3
Since the switch to using python3Packages in commit
72934aa94e322eb3d5be277d667466643f78e706, 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 2e4aded366914d625a2f31208e8ac8548cb43a7e
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 00:41:36 +01:00
|
|
|
rev = "d0bb75c8fc8fe125e8191d73de7ade6212aec0fd";
|
|
|
|
sha256 = "19b4lqq1p45n348ssmql60jylw2fw7vfj9j22nly5qj5qx51j3g5";
|
2016-09-10 00:43:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
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
|
beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
|
|
|
|
# Skip test which is already failing upstream.
|
|
|
|
sed -i -e '1i import unittest' \
|
|
|
|
-e 's/\(^ *\)# failing/\1@unittest.skip/' \
|
|
|
|
tests/test_reimport.py
|
2016-09-10 00:43:42 +01:00
|
|
|
'';
|
|
|
|
|
beets: Run tests for external plugins
In order to run the tests for the external plugins of beets, we need to
have beets itself as a dependency. So in order to do that, we now pass
beets without plugins and tests to the nativeBuildInputs of the plugins
so that we can run them.
As soon as the plugins are built they become part of the final beets,
which also has tests enabled, so disabling the tests for beets
derivation that is used for external plugin tests is a non-issue here
because they're going to be executed anyway.
Enabling tests for the alternatives plugin is pretty straightforward,
but in order to run tests for the copyartifacts plugin, we need to bump
the source code to the latest Git master.
The reason for this is that the version that was in use until now
required to have the beets source directory alongside of the
copyartifacts source code, but we already have beets available as a
normal dependency.
Updating copyartifacts to latest master largely consists of unit test
changes and a few Python 3 compatibility changes. However, one change
has the biggest stat, which is
sbarakat/beets-copyartifacts@1a0c281da0be7251f414397960a83d60dc3a1520.
Fortunately, the last change is just moving the implementation to a
newer API from upstream beets and by the looks of the implementation it
seems to break support for moving files. However, reverting this commit
also reveals that moving files was already broken before, so it wouldn't
matter much whether we have this version bump or not.
Tested with the following command:
nix-build -E '(import ./. {}).beets.override {
enableAlternatives = true;
enableCopyArtifacts = true;
}'
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @domenkozar, @pjones, @Profpatsch, @michalrus
2017-09-02 01:03:03 +01:00
|
|
|
nativeBuildInputs = [ beets pythonPackages.nose glibcLocales ];
|
|
|
|
|
|
|
|
checkPhase = "LANG=en_US.UTF-8 nosetests";
|
|
|
|
|
2016-09-10 00:43:42 +01:00
|
|
|
meta = {
|
|
|
|
description = "Beets plugin to move non-music files during the import process";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/sbarakat/beets-copyartifacts";
|
2016-09-10 00:43:42 +01:00
|
|
|
license = stdenv.lib.licenses.mit;
|
|
|
|
};
|
|
|
|
}
|