View | Details | Raw Unified | Return to bug 255732
Collapse All | Expand All

(-)b/audio/beets/Makefile (-1 / +1 lines)
Lines 2-8 Link Here
2
2
3
PORTNAME=	beets
3
PORTNAME=	beets
4
PORTVERSION=	1.4.9
4
PORTVERSION=	1.4.9
5
PORTREVISION=	4
5
PORTREVISION=	5
6
CATEGORIES=	audio python
6
CATEGORIES=	audio python
7
MASTER_SITES=	CHEESESHOP
7
MASTER_SITES=	CHEESESHOP
8
8
(-)b/audio/beets/files/patch-beets_util_functemplate.py (+39 lines)
Added Link Here
1
--- beets/util/functemplate.py.orig	2021-06-08 14:54:08 UTC
2
+++ beets/util/functemplate.py
3
@@ -73,16 +73,26 @@ def ex_literal(val):
4
     """An int, float, long, bool, string, or None literal with the given
5
     value.
6
     """
7
-    if val is None:
8
-        return ast.Name('None', ast.Load())
9
-    elif isinstance(val, six.integer_types):
10
-        return ast.Num(val)
11
-    elif isinstance(val, bool):
12
-        return ast.Name(bytes(val), ast.Load())
13
-    elif isinstance(val, six.string_types):
14
-        return ast.Str(val)
15
-    raise TypeError(u'no literal for {0}'.format(type(val)))
16
-
17
+    if sys.version_info[:2] < (3, 4):
18
+        if val is None:
19
+            return ast.Name('None', ast.Load())
20
+        elif isinstance(val, six.integer_types):
21
+            return ast.Num(val)
22
+        elif isinstance(val, bool):
23
+            return ast.Name(bytes(val), ast.Load())
24
+        elif isinstance(val, six.string_types):
25
+            return ast.Str(val)
26
+        raise TypeError(u'no literal for {0}'.format(type(val)))
27
+    elif sys.version_info[:2] < (3, 6):
28
+        if val in [None, True, False]:
29
+            return ast.NameConstant(val)
30
+        elif isinstance(val, six.integer_types):
31
+            return ast.Num(val)
32
+        elif isinstance(val, six.string_types):
33
+            return ast.Str(val)
34
+        raise TypeError(u'no literal for {0}'.format(type(val)))
35
+    else:
36
+        return ast.Constant(val)
37
 
38
 def ex_varassign(name, expr):
39
     """Assign an expression into a single variable. The expression may

Return to bug 255732