diff --git a/srcpkgs/python3-sympy/patches/00.python3.12.patch b/srcpkgs/python3-sympy/patches/00.python3.12.patch new file mode 100644 index 00000000000..092f7dcab2f --- /dev/null +++ b/srcpkgs/python3-sympy/patches/00.python3.12.patch @@ -0,0 +1,140 @@ +From f517c26fe421f03ea2aa20d7babb4df422753c5f Mon Sep 17 00:00:00 2001 +From: Sangyub Lee +Date: Tue, 30 May 2023 10:38:29 +0900 +Subject: [PATCH 1/3] Fix deprecation issues with python 3.12 ast lib + +--- + sympy/parsing/sympy_parser.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/sympy/parsing/sympy_parser.py b/sympy/parsing/sympy_parser.py +index 7e3a0e8067ce..5cda6b61ad69 100644 +--- a/sympy/parsing/sympy_parser.py ++++ b/sympy/parsing/sympy_parser.py +@@ -1135,7 +1135,7 @@ def visit_Compare(self, node): + new_node = ast.Call( + func=ast.Name(id=sympy_class, ctx=ast.Load()), + args=[left, right], +- keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None + ) +@@ -1168,7 +1168,7 @@ def visit_BinOp(self, node): + right = ast.Call( + func=ast.Name(id='Mul', ctx=ast.Load()), + args=[ast.UnaryOp(op=ast.USub(), operand=ast.Num(1)), right], +- keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None + ) +@@ -1179,7 +1179,7 @@ def visit_BinOp(self, node): + left = ast.Call( + func=ast.Name(id='Pow', ctx=ast.Load()), + args=[left, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))], +- keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None + ) +@@ -1187,7 +1187,7 @@ def visit_BinOp(self, node): + right = ast.Call( + func=ast.Name(id='Pow', ctx=ast.Load()), + args=[right, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))], +- keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None + ) +@@ -1197,7 +1197,7 @@ def visit_BinOp(self, node): + new_node = ast.Call( + func=ast.Name(id=sympy_class, ctx=ast.Load()), + args=[left, right], +- keywords=[ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))], ++ keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None + ) +@@ -1212,7 +1212,7 @@ def visit_BinOp(self, node): + def visit_Call(self, node): + new_node = self.generic_visit(node) + if isinstance(node.func, ast.Name) and node.func.id in self.functions: +- new_node.keywords.append(ast.keyword(arg='evaluate', value=ast.NameConstant(value=False, ctx=ast.Load()))) ++ new_node.keywords.append(ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))) + return new_node + + + +From 34de3853a9486e23294d28b932d5978e237bc19c Mon Sep 17 00:00:00 2001 +From: Sangyub Lee +Date: Tue, 30 May 2023 13:17:17 +0900 +Subject: [PATCH 2/3] Replace ast.Num + +--- + sympy/parsing/sympy_parser.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/sympy/parsing/sympy_parser.py b/sympy/parsing/sympy_parser.py +index 5cda6b61ad69..4a45a9d5bff8 100644 +--- a/sympy/parsing/sympy_parser.py ++++ b/sympy/parsing/sympy_parser.py +@@ -1167,7 +1167,7 @@ def visit_BinOp(self, node): + if isinstance(node.op, ast.Sub): + right = ast.Call( + func=ast.Name(id='Mul', ctx=ast.Load()), +- args=[ast.UnaryOp(op=ast.USub(), operand=ast.Num(1)), right], ++ args=[ast.UnaryOp(op=ast.USub(), operand=ast.Constant(1)), right], + keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None +@@ -1178,7 +1178,7 @@ def visit_BinOp(self, node): + rev = True + left = ast.Call( + func=ast.Name(id='Pow', ctx=ast.Load()), +- args=[left, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))], ++ args=[left, ast.UnaryOp(op=ast.USub(), operand=ast.Constant(1))], + keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None +@@ -1186,7 +1186,7 @@ def visit_BinOp(self, node): + else: + right = ast.Call( + func=ast.Name(id='Pow', ctx=ast.Load()), +- args=[right, ast.UnaryOp(op=ast.USub(), operand=ast.Num(1))], ++ args=[right, ast.UnaryOp(op=ast.USub(), operand=ast.Constant(1))], + keywords=[ast.keyword(arg='evaluate', value=ast.Constant(value=False, ctx=ast.Load()))], + starargs=None, + kwargs=None + +From eae2a0810829682417ba17e30812faa949121cc2 Mon Sep 17 00:00:00 2001 +From: Sangyub Lee +Date: Tue, 30 May 2023 13:53:44 +0900 +Subject: [PATCH 3/3] Fix additional deprecation warnings + +--- + sympy/parsing/ast_parser.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sympy/parsing/ast_parser.py b/sympy/parsing/ast_parser.py +index c828ed31a19b..95a773d5bec6 100644 +--- a/sympy/parsing/ast_parser.py ++++ b/sympy/parsing/ast_parser.py +@@ -23,7 +23,7 @@ + from sympy.core.sympify import SympifyError + + from ast import parse, NodeTransformer, Call, Name, Load, \ +- fix_missing_locations, Str, Tuple ++ fix_missing_locations, Constant, Tuple + + class Transform(NodeTransformer): + +@@ -52,7 +52,7 @@ def visit_Name(self, node): + elif node.id in ['True', 'False']: + return node + return fix_missing_locations(Call(func=Name('Symbol', Load()), +- args=[Str(node.id)], keywords=[])) ++ args=[Constant(node.id)], keywords=[])) + + def visit_Lambda(self, node): + args = [self.visit(arg) for arg in node.args.args] diff --git a/srcpkgs/python3-sympy/patches/01.python3.12.patch b/srcpkgs/python3-sympy/patches/01.python3.12.patch new file mode 100644 index 00000000000..6e1df83e8db --- /dev/null +++ b/srcpkgs/python3-sympy/patches/01.python3.12.patch @@ -0,0 +1,27 @@ +From 4b82eae46164afb468bb8995d87cbc643dc9e7a6 Mon Sep 17 00:00:00 2001 +From: Pablo Galindo +Date: Fri, 9 Jun 2023 11:22:20 +0100 +Subject: [PATCH 1/4] Fix factorial parsing for Python 3.12 + +Signed-off-by: Pablo Galindo +--- + .mailmap | 1 + + sympy/parsing/sympy_parser.py | 5 ++++- + 2 files changed, 5 insertions(+), 1 deletion(-) + +diff --git a/sympy/parsing/sympy_parser.py b/sympy/parsing/sympy_parser.py +index 7e3a0e8067ce..1c89f0d25b9a 100644 +--- a/sympy/parsing/sympy_parser.py ++++ b/sympy/parsing/sympy_parser.py +@@ -627,7 +627,10 @@ def factorial_notation(tokens: List[TOKEN], local_dict: DICT, global_dict: DICT) + result: List[TOKEN] = [] + nfactorial = 0 + for toknum, tokval in tokens: +- if toknum == ERRORTOKEN: ++ if toknum == OP and tokval == "!": ++ # In Python 3.12 "!" are OP instead of ERRORTOKEN ++ nfactorial += 1 ++ elif toknum == ERRORTOKEN: + op = tokval + if op == '!': + nfactorial += 1 diff --git a/srcpkgs/python3-sympy/template b/srcpkgs/python3-sympy/template index cb829715802..e767f7543c3 100644 --- a/srcpkgs/python3-sympy/template +++ b/srcpkgs/python3-sympy/template @@ -1,7 +1,7 @@ # Template file for 'python3-sympy' pkgname=python3-sympy version=1.12 -revision=1 +revision=2 build_style=python3-module hostmakedepends="python3-setuptools" depends="python3-mpmath"