summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-util/sc-controller/files/sc-controller-0.4.8.15-py12.patch')
-rw-r--r--games-util/sc-controller/files/sc-controller-0.4.8.15-py12.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/games-util/sc-controller/files/sc-controller-0.4.8.15-py12.patch b/games-util/sc-controller/files/sc-controller-0.4.8.15-py12.patch
new file mode 100644
index 000000000000..41851c032811
--- /dev/null
+++ b/games-util/sc-controller/files/sc-controller-0.4.8.15-py12.patch
@@ -0,0 +1,89 @@
+From 51dda4b98aac878bdbf84aa9715f7ecc9802ba1d Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 22 Jun 2024 14:24:01 +0100
+Subject: [PATCH 1/2] Fix parser to handle new non-terminating newline NL token
+ in Python 3.12
+
+---
+ scc/parser.py | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/scc/parser.py b/scc/parser.py
+index 78633f0e..9e77de04 100644
+--- a/scc/parser.py
++++ b/scc/parser.py
+@@ -136,7 +136,7 @@ class ActionParser(object):
+ def _parse_parameter(self):
+ """ Parses single parameter """
+ t = self._next_token()
+- while t.type == TokenType.NEWLINE or t.value == "\n":
++ while t.type in (TokenType.NL, TokenType.NEWLINE) or t.value == "\n":
+ if not self._tokens_left():
+ raise ParseError("Expected parameter at end of string")
+ t = self._next_token()
+@@ -236,7 +236,7 @@ class ActionParser(object):
+ parameters.append(self._parse_parameter())
+ # Check if next token is either ')' or ','
+ t = self._peek_token()
+- while t.type == TokenType.NEWLINE or t.value == "\n":
++ while t.type in (TokenType.NL, TokenType.NEWLINE) or t.value == "\n":
+ self._next_token()
+ if not self._tokens_left():
+ raise ParseError("Expected ',' or end of parameter list after parameter '%s'" % (parameters[-1],))
+@@ -310,8 +310,8 @@ class ActionParser(object):
+ action1 = self._create_action(action_class, *parameters)
+ action2 = self._parse_action()
+ return MultiAction(action1, action2)
+-
+- if t.type == TokenType.NEWLINE or t.value == "\n":
++
++ if t.type in (TokenType.NL, TokenType.NEWLINE) or t.value == "\n":
+ # Newline can be used to join actions instead of 'and'
+ self._next_token()
+ if not self._tokens_left():
+@@ -324,11 +324,11 @@ class ActionParser(object):
+ action1 = self._create_action(action_class, *parameters)
+ action2 = self._parse_action()
+ return MultiAction(action1, action2)
+-
++
+ if t.type == TokenType.OP and t.value == ';':
+ # Two (or more) actions joined by ';'
+ self._next_token()
+- while self._tokens_left() and self._peek_token().type == TokenType.NEWLINE:
++ while self._tokens_left() and self._peek_token().type in (TokenType.NL, TokenType.NEWLINE):
+ self._next_token()
+ if not self._tokens_left():
+ # Having ';' at end of string is not actually error
+--
+2.45.1
+
+
+From e8cc68cb17effa413c3ffde2bce5f8dd1798b0c3 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sat, 22 Jun 2024 14:34:48 +0100
+Subject: [PATCH 2/2] Address Python ast deprecations that will be removed in
+ 3.14
+
+---
+ scc/cheader.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/scc/cheader.py b/scc/cheader.py
+index d151d637..f84319f1 100644
+--- a/scc/cheader.py
++++ b/scc/cheader.py
+@@ -59,8 +59,8 @@ def eval_expr(expr):
+ """ Eval and expression inside a #define using a suppart of python grammar """
+
+ def _eval(node):
+- if isinstance(node, ast.Num):
+- return node.n
++ if isinstance(node, ast.Constant):
++ return node.value
+ elif isinstance(node, ast.BinOp):
+ return OPERATORS[type(node.op)](_eval(node.left), _eval(node.right))
+ elif isinstance(node, ast.UnaryOp):
+--
+2.45.1
+