Saturday, August 29, 2020

Re: [fix] audio/beets - breakage from move to python 3.8

It's committed upstream, please use the header from the commit rather than
linking to the PR (makes it clear that it can be removed at next version
update) -
https://github.com/beetbox/beets/commit/31855a93949a7b2e2636f709c2678d0efef1dcba.patch


From dab0c1f9abda5b17cc7488f89a6fe08be7bc56a0 Mon Sep 17 00:00:00 2001
From: wisp3rwind <17089248+wisp3rwind@users.noreply.github.com>
Date: Tue, 9 Jun 2020 19:34:31 +0200
Subject: [PATCH] compatibility with breaking changes to the ast module

--
Sent from a phone, apologies for poor formatting.
On 29 August 2020 15:59:01 Aaron Bieber <aaron@bolddaemon.com> wrote:

> Hi,
>
> Currently beets pukes when you try to run it. This is because of changes in the
> python ast module that were backported to 3.8:
>
> https://github.com/beetbox/beets/pull/3621
>
> With this diff, I can run beet as expected.
>
> OK?
>
> Cheers,
> Aaron
>
> diff --git a/audio/beets/Makefile b/audio/beets/Makefile
> index 7cabe18ef67..165afac23e0 100644
> --- a/audio/beets/Makefile
> +++ b/audio/beets/Makefile
> @@ -5,7 +5,7 @@ COMMENT= CLI tools to manage music collections
> MODPY_EGG_VERSION= 1.4.9
> DISTNAME= beets-${MODPY_EGG_VERSION}
> CATEGORIES= audio
> -REVISION= 5
> +REVISION= 6
>
> HOMEPAGE= http://beets.io/
>
> diff --git a/audio/beets/patches/patch-beets_util_functemplate_py
> b/audio/beets/patches/patch-beets_util_functemplate_py
> new file mode 100644
> index 00000000000..3d982a33fdb
> --- /dev/null
> +++ b/audio/beets/patches/patch-beets_util_functemplate_py
> @@ -0,0 +1,44 @@
> +$OpenBSD$
> +
> +Fix for python 3.8:
> + https://github.com/beetbox/beets/pull/3621
> +
> +Index: beets/util/functemplate.py
> +--- beets/util/functemplate.py.orig
> ++++ 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):

No comments:

Post a Comment