From a8f3eea240f2c9d2d7dd3e1beba5dbea50cca0d4 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Aug 03 2020 14:06:19 +0000 Subject: Fix rhbz#1862737 --- diff --git a/0001-compatibility-with-breaking-changes-to-the-ast-modul.patch b/0001-compatibility-with-breaking-changes-to-the-ast-modul.patch new file mode 100644 index 0000000..61a7541 --- /dev/null +++ b/0001-compatibility-with-breaking-changes-to-the-ast-modul.patch @@ -0,0 +1,56 @@ +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 + +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 | 1 + + 2 files changed, 21 insertions(+), 9 deletions(-) + +diff --git a/beets/util/functemplate.py b/beets/util/functemplate.py +index af22b790822b..266534a9b465 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): +-- +2.26.2 + diff --git a/beets.spec b/beets.spec index a12fb5f..f76b907 100644 --- a/beets.spec +++ b/beets.spec @@ -1,10 +1,11 @@ Name: beets Version: 1.4.9 -Release: 5%{?dist} +Release: 6%{?dist} Summary: Music library manager and MusicBrainz tagger License: MIT and ISC URL: http://beets.io Source0: https://github.com/beetbox/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz +Patch0: 0001-compatibility-with-breaking-changes-to-the-ast-modul.patch BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-sphinx @@ -128,6 +129,9 @@ rm -f docs/_build/html/{.buildinfo,objects.inv} %files doc %doc docs/_build/html docs/_build/text %changelog +* Mon Aug 03 2020 Michele Baldessari - 1.4.9-6 +- Fix rhbz#1862737 + * Tue Jan 28 2020 Fedora Release Engineering - 1.4.9-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild