summaryrefslogtreecommitdiffstats
path: root/pkgs/tools/audio
diff options
context:
space:
mode:
authorMartin Weinelt <hexa@darmstadt.ccc.de>2020-08-05 02:20:23 +0200
committerMartin Weinelt <hexa@darmstadt.ccc.de>2020-08-07 00:45:40 +0200
commitd55276d7c6c708512454c29bf6d8f733eed29208 (patch)
treeff3a35c6164f63662d295ab62ac1d4d59d99dfe2 /pkgs/tools/audio
parent8a78890a08dfa697be21891619f799738b956aa5 (diff)
beets: apply patch to fix incompatibilites with python 3.8
https://github.com/beetbox/beets/pull/3621 https://github.com/python/cpython/pull/20649
Diffstat (limited to 'pkgs/tools/audio')
-rw-r--r--pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch55
-rw-r--r--pkgs/tools/audio/beets/default.nix5
2 files changed, 60 insertions, 0 deletions
diff --git a/pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch b/pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch
new file mode 100644
index 000000000000..4865b6f62341
--- /dev/null
+++ b/pkgs/tools/audio/beets/compatibility-with-breaking-changes-to-the-ast-module.patch
@@ -0,0 +1,55 @@
+From 771ce704ebeac4cd9bd74b3ddde9fb01f3dc7eb4 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 ++++++++++++++++++++---------
+ 1 file changed, 20 insertions(+), 9 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):
+--
+2.27.0
+
diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix
index 0f73b353169e..776eca999989 100644
--- a/pkgs/tools/audio/beets/default.nix
+++ b/pkgs/tools/audio/beets/default.nix
@@ -190,6 +190,11 @@ in pythonPackages.buildPythonApplication rec {
url = "https://github.com/beetbox/beets/commit/d43d54e21cde97f57f19486925ab56b419254cc8.patch";
sha256 = "13n2gzmcgfi0m2ycl2r1hpczgksplnkc3y6b66vg57rx5y8nnv5c";
})
+
+ # Fixes 548 tests due to breaking changes to the ast module
+ # https://github.com/beetbox/beets/pull/3621
+ # Can be dropped after 1.4.9
+ ./compatibility-with-breaking-changes-to-the-ast-module.patch
];
postPatch = ''