commit:     76a4fe776209a5c8282ac1e354b8d9bb1d81831e
Author:     Guillaume Seren <guillaumeseren <AT> gmail <DOT> com>
AuthorDate: Mon Jun  1 23:37:42 2020 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 12:27:04 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76a4fe77

media-sound/beets: Fix tests + cors/audioread support

Closes: https://bugs.gentoo.org/693164
Signed-off-by: Guillaume Seren <guillaumeseren <AT> gmail.com>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 media-sound/beets/beets-1.4.9-r3.ebuild            | 161 +++++++++++++++++++++
 ...ty-with-breaking-changes-to-the-ast-modul.patch |  53 +++++++
 .../files/1.4.9-0002-Disable-test_completion.patch |  74 ++++++++++
 media-sound/beets/metadata.xml                     |   5 +-
 4 files changed, 292 insertions(+), 1 deletion(-)

diff --git a/media-sound/beets/beets-1.4.9-r3.ebuild 
b/media-sound/beets/beets-1.4.9-r3.ebuild
new file mode 100644
index 00000000000..fe7c12adf3a
--- /dev/null
+++ b/media-sound/beets/beets-1.4.9-r3.ebuild
@@ -0,0 +1,161 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_SINGLE_IMPL=1
+PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_REQ_USE="sqlite"
+DISTUTILS_USE_SETUPTOOLS=rdepend
+
+inherit distutils-r1 bash-completion-r1
+
+if [[ ${PV} == "9999" ]]; then
+       EGIT_REPO_URI="https://github.com/beetbox/beets.git";
+       inherit git-r3
+else
+       MY_PV=${PV/_beta/-beta.}
+       MY_P=${PN}-${MY_PV}
+       SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+       KEYWORDS="~amd64 ~x86"
+       S="${WORKDIR}/${MY_P}"
+fi
+
+DESCRIPTION="Media library management system for obsessive-compulsive music 
geeks"
+HOMEPAGE="https://beets.io/ https://pypi.org/project/beets/";
+
+LICENSE="MIT"
+SLOT="0"
+IUSE="badfiles chromaprint cors discogs doc ffmpeg gstreamer icu lastfm mpd 
replaygain test thumbnail webserver"
+
+RDEPEND="
+       $(python_gen_cond_dep '
+               >=dev-python/jellyfish-0.7.1[${PYTHON_MULTI_USEDEP}]
+               dev-python/munkres[${PYTHON_MULTI_USEDEP}]
+               >=media-libs/mutagen-1.33[${PYTHON_MULTI_USEDEP}]
+               >=dev-python/python-musicbrainz-ngs-0.4[${PYTHON_MULTI_USEDEP}]
+               dev-python/pyyaml[${PYTHON_MULTI_USEDEP}]
+               dev-python/requests-oauthlib[${PYTHON_MULTI_USEDEP}]
+               dev-python/requests[${PYTHON_MULTI_USEDEP}]
+               >=dev-python/six-1.9[${PYTHON_MULTI_USEDEP}]
+               dev-python/unidecode[${PYTHON_MULTI_USEDEP}]
+               badfiles? (
+                       media-libs/flac
+                       media-sound/mp3val
+               )
+               chromaprint? (
+                       dev-python/pyacoustid[${PYTHON_MULTI_USEDEP}]
+                       media-libs/chromaprint[tools]
+               )
+               discogs? (
+                       dev-python/discogs-client[${PYTHON_MULTI_USEDEP}]
+               )
+               ffmpeg? (
+                       media-video/ffmpeg:0[encode]
+               )
+               gstreamer? (
+                       media-libs/gst-plugins-bad:1.0
+                       media-libs/gst-plugins-good:1.0
+               )
+               icu? (
+                       dev-db/sqlite[icu]
+               )
+               lastfm? (
+                       dev-python/pylast[${PYTHON_MULTI_USEDEP}]
+               )
+               mpd? (
+                       dev-python/bluelet[${PYTHON_MULTI_USEDEP}]
+                       dev-python/python-mpd[${PYTHON_MULTI_USEDEP}]
+               )
+               replaygain? (
+                       gstreamer? (
+                               dev-python/pygobject:3[${PYTHON_MULTI_USEDEP}]
+                               media-plugins/gst-plugins-libav:1.0
+                       )
+                       !gstreamer? ( media-sound/mp3gain )
+               )
+               thumbnail? (
+                       dev-python/pyxdg[${PYTHON_MULTI_USEDEP}]
+                       || (
+                               dev-python/pillow[${PYTHON_MULTI_USEDEP}]
+                               media-gfx/imagemagick
+                       )
+               )
+               webserver? (
+                       dev-python/flask[${PYTHON_MULTI_USEDEP}]
+                       cors? (
+                               dev-python/flask-cors[${PYTHON_MULTI_USEDEP}]
+                       )
+               )
+       ')"
+DEPEND="
+       ${RDEPEND}
+"
+BDEPEND="
+       dev-python/sphinx
+       $(python_gen_cond_dep '
+               test? (
+                       dev-python/beautifulsoup[${PYTHON_MULTI_USEDEP}]
+                       dev-python/flask[${PYTHON_MULTI_USEDEP}]
+                       dev-python/mock[${PYTHON_MULTI_USEDEP}]
+                       dev-python/pyxdg[${PYTHON_MULTI_USEDEP}]
+                       dev-python/rarfile[${PYTHON_MULTI_USEDEP}]
+                       dev-python/responses[${PYTHON_MULTI_USEDEP}]
+                       dev-python/wheel[${PYTHON_MULTI_USEDEP}]
+               )
+       ')"
+
+PATCHES=(
+       
"${FILESDIR}/${PV}-0001-compatibility-with-breaking-changes-to-the-ast-modul.patch"
+       "${FILESDIR}/${PV}-0002-Disable-test_completion.patch"
+)
+
+DOCS=( README.rst docs/changelog.rst )
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+       distutils-r1_python_prepare_all
+
+       rm test/test_art.py || die "Failed to remove test_art.py"
+       rm test/test_discogs.py || die "Failed to remove test_discogs.py"
+       rm test/test_embyupdate.py || die "Failed to remove test_embyupdate.py"
+       rm test/test_lastgenre.py || die "Failed to remove test_lastgenre.py"
+       rm test/test_spotify.py || die "Failed to remove test_spotify.py"
+       # Not working and dropped in master
+       rm test/test_mediafile.py || die "Failed to remove test_mediafile.py"
+       if ! use ffmpeg; then
+               rm test/test_convert.py || die "Failed to remove 
test_convert.py"
+       fi
+       if ! use mpd; then
+               rm test/test_player.py || die "Failed to remove test_player.py"
+               rm test/test_mpdstats.py || die "Failed to remove 
test_mpdstats.py"
+       fi
+       if ! use replaygain; then
+               rm test/test_replaygain.py || die "Failed to remove 
test_replaygain.py"
+       fi
+       if ! use thumbnail; then
+               rm test/test_thumbnails.py || die "Failed to remove 
test_thumbnails.py"
+       fi
+       if ! use webserver; then
+               rm test/test_web.py || die "Failed to remove test_web.py"
+       fi
+}
+
+python_compile_all() {
+       esetup.py build_sphinx -b man --build-dir=docs/build
+       use doc && esetup.py build_sphinx -b html --build-dir=docs/build
+}
+
+python_install_all() {
+       distutils-r1_python_install_all
+
+       doman docs/build/man/*
+       use doc && local HTML_DOCS=( docs/build/html/. )
+       einstalldocs
+
+       ${PYTHON} "${ED}/usr/bin/beet" completion > "${T}/beet.bash" || die
+       newbashcomp "${T}/beet.bash" beet
+       insinto /usr/share/zsh/site-functions
+       newins "${WORKDIR}/${P}/extra/_beet" _beet
+}

diff --git 
a/media-sound/beets/files/1.4.9-0001-compatibility-with-breaking-changes-to-the-ast-modul.patch
 
b/media-sound/beets/files/1.4.9-0001-compatibility-with-breaking-changes-to-the-ast-modul.patch
new file mode 100644
index 00000000000..f9268b17ca6
--- /dev/null
+++ 
b/media-sound/beets/files/1.4.9-0001-compatibility-with-breaking-changes-to-the-ast-modul.patch
@@ -0,0 +1,53 @@
+From 86af366abab51b45ad1b06d330d384bc810e45c9 Mon Sep 17 00:00:00 2001
+From: wisp3rwind <[email protected]>
+Date: Tue, 9 Jun 2020 19:34:31 +0200
+Subject: [PATCH] compatibility with breaking changes to the ast module
+
+new in 3.10, also backported to 3.8 and 3.9: 
https://github.com/python/cpython/pull/20649
+In fact, our generation of some Literals has been invalid since Python
+3.4, fix that too.
+---
+ beets/util/functemplate.py |  29 ++--
+ docs/changelog.rst         | 275 ++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 294 insertions(+), 10 deletions(-)
+
+diff --git a/beets/util/functemplate.py b/beets/util/functemplate.py
+index af22b790..266534a9 100644
+--- a/beets/util/functemplate.py
++++ b/beets/util/functemplate.py
+@@ -73,15 +73,26 @@ def ex_literal(val):
+     """An int, float, long, bool, string, or None literal with the given
+     value.
+     """
+-    if val is None:
+-        return ast.Name('None', ast.Load())
+-    elif isinstance(val, six.integer_types):
+-        return ast.Num(val)
+-    elif isinstance(val, bool):
+-        return ast.Name(bytes(val), ast.Load())
+-    elif isinstance(val, six.string_types):
+-        return ast.Str(val)
+-    raise TypeError(u'no literal for {0}'.format(type(val)))
++    if sys.version_info[:2] < (3, 4):
++        if val is None:
++            return ast.Name('None', ast.Load())
++        elif isinstance(val, six.integer_types):
++            return ast.Num(val)
++        elif isinstance(val, bool):
++            return ast.Name(bytes(val), ast.Load())
++        elif isinstance(val, six.string_types):
++            return ast.Str(val)
++        raise TypeError(u'no literal for {0}'.format(type(val)))
++    elif sys.version_info[:2] < (3, 6):
++        if val in [None, True, False]:
++            return ast.NameConstant(val)
++        elif isinstance(val, six.integer_types):
++            return ast.Num(val)
++        elif isinstance(val, six.string_types):
++            return ast.Str(val)
++        raise TypeError(u'no literal for {0}'.format(type(val)))
++    else:
++        return ast.Constant(val)
+ 
+ 
+ def ex_varassign(name, expr):

diff --git a/media-sound/beets/files/1.4.9-0002-Disable-test_completion.patch 
b/media-sound/beets/files/1.4.9-0002-Disable-test_completion.patch
new file mode 100644
index 00000000000..c60e24d6589
--- /dev/null
+++ b/media-sound/beets/files/1.4.9-0002-Disable-test_completion.patch
@@ -0,0 +1,74 @@
+From f6258c2ff3f3f979d72c149e44f4eecb02cb10a2 Mon Sep 17 00:00:00 2001
+From: Guillaume Seren <[email protected]>
+Date: Tue, 29 Sep 2020 16:46:06 +0200
+Subject: [PATCH] Disable test_completion
+
+Know issue by upstream https://github.com/beetbox/beets/issues/1876
+---
+ test/test_ui.py | 50 -------------------------------------------------
+ 1 file changed, 50 deletions(-)
+
+diff --git a/test/test_ui.py b/test/test_ui.py
+index 8267c9be..bcb6c3bf 100644
+--- a/test/test_ui.py
++++ b/test/test_ui.py
+@@ -1167,56 +1167,6 @@ class PluginTest(_common.TestCase, TestHelper):
+         self.run_command('test', lib=None)
+ 
+ 
+-@_common.slow_test()
+-class CompletionTest(_common.TestCase, TestHelper):
+-    def test_completion(self):
+-        # Load plugin commands
+-        config['pluginpath'] = [_common.PLUGINPATH]
+-        config['plugins'] = ['test']
+-
+-        # Do not load any other bash completion scripts on the system.
+-        env = dict(os.environ)
+-        env['BASH_COMPLETION_DIR'] = os.devnull
+-        env['BASH_COMPLETION_COMPAT_DIR'] = os.devnull
+-
+-        # Open a `bash` process to run the tests in. We'll pipe in bash
+-        # commands via stdin.
+-        cmd = os.environ.get('BEETS_TEST_SHELL', '/bin/bash --norc').split()
+-        if not has_program(cmd[0]):
+-            self.skipTest(u'bash not available')
+-        tester = subprocess.Popen(cmd, stdin=subprocess.PIPE,
+-                                  stdout=subprocess.PIPE, env=env)
+-
+-        # Load bash_completion library.
+-        for path in commands.BASH_COMPLETION_PATHS:
+-            if os.path.exists(util.syspath(path)):
+-                bash_completion = path
+-                break
+-        else:
+-            self.skipTest(u'bash-completion script not found')
+-        try:
+-            with open(util.syspath(bash_completion), 'rb') as f:
+-                tester.stdin.writelines(f)
+-        except IOError:
+-            self.skipTest(u'could not read bash-completion script')
+-
+-        # Load completion script.
+-        self.io.install()
+-        self.run_command('completion', lib=None)
+-        completion_script = self.io.getoutput().encode('utf-8')
+-        self.io.restore()
+-        tester.stdin.writelines(completion_script.splitlines(True))
+-
+-        # Load test suite.
+-        test_script_name = os.path.join(_common.RSRC, b'test_completion.sh')
+-        with open(test_script_name, 'rb') as test_script_file:
+-            tester.stdin.writelines(test_script_file)
+-        out, err = tester.communicate()
+-        if tester.returncode != 0 or out != b'completion tests passed\n':
+-            print(out.decode('utf-8'))
+-            self.fail(u'test/test_completion.sh did not execute properly')
+-
+-
+ class CommonOptionsParserCliTest(unittest.TestCase, TestHelper):
+     """Test CommonOptionsParser and formatting LibModel formatting on 'list'
+     command.
+-- 
+2.26.2
+

diff --git a/media-sound/beets/metadata.xml b/media-sound/beets/metadata.xml
index 54468263575..421001fc2f4 100644
--- a/media-sound/beets/metadata.xml
+++ b/media-sound/beets/metadata.xml
@@ -34,8 +34,11 @@
   <use>
     <flag name="badfiles">Validate MP3 &amp; FLAC files</flag>
     <flag name="chromaprint">Enable support for acoustic fingerprinting plugin 
using <pkg>media-libs/chromaprint</pkg></flag>
-    <flag name="ffmpeg">Enable support for the convert plugin to transcode 
files via <pkg>media-video/ffmpeg</pkg></flag>
+    <flag name="cors">Enable cors support for the webserver 
<pkg>dev-python/flask-cors</pkg></flag>
     <flag name="discogs">Enable support for the discogs API plugin</flag>
+    <flag name="ffmpeg">Enable support for the convert plugin to transcode 
files via <pkg>media-video/ffmpeg</pkg></flag>
+    <flag name="gstreamer">Enable support for the gstreamer backend</flag>
+    <flag name="icu">Enable support for the icu plugin to support non-ASCII 
characters in <pkg>dev-db/sqlite</pkg></flag>
     <flag name="lastfm">Enable support for importing personal last.fm 
playcounts and music genres from last.fm tags</flag>
     <flag name="mpd">Enable support for <pkg>media-sound/mpd</pkg> server 
emulation and statistic gathered from <pkg>media-sound/mpd</pkg></flag>
     <flag name="replaygain">Enable support for Replay Gain metadata 
calculation during import</flag>

Reply via email to