python3-sympy: update to 1.12.1.

This commit is contained in:
Gonzalo Tornaría 2024-03-29 16:03:47 -03:00 committed by cinerea0
parent e1f55f1642
commit 7f338ce602
3 changed files with 11 additions and 173 deletions

View file

@ -1,140 +0,0 @@
From f517c26fe421f03ea2aa20d7babb4df422753c5f Mon Sep 17 00:00:00 2001
From: Sangyub Lee <sylee957@gmail.com>
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 <sylee957@gmail.com>
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 <sylee957@gmail.com>
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]

View file

@ -1,27 +0,0 @@
From 4b82eae46164afb468bb8995d87cbc643dc9e7a6 Mon Sep 17 00:00:00 2001
From: Pablo Galindo <pablogsal@gmail.com>
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 <pablogsal@gmail.com>
---
.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

View file

@ -1,18 +1,23 @@
# Template file for 'python3-sympy'
pkgname=python3-sympy
version=1.12
revision=2
build_style=python3-module
hostmakedepends="python3-setuptools"
version=1.12.1
revision=1
build_style=python3-pep517
hostmakedepends="python3-setuptools python3-wheel"
depends="python3-mpmath"
checkdepends="python3-mpmath"
checkdepends="$depends python3-pytest python3-pytest-xdist gcc-fortran
python3-Cython python3-devel python3-ipython python3-lxml python3-matplotlib
python3-numexpr python3-numpy python3-scipy"
short_desc="Computer algebra system for Python3"
maintainer="Gonzalo Tornaría <tornaria@cmat.edu.uy>"
license="BSD-3-Clause"
homepage="https://sympy.org/"
changelog="https://github.com/sympy/sympy/wiki/Release-Notes"
distfiles="${PYPI_SITE}/s/sympy/sympy-${version}.tar.gz"
checksum=ebf595c8dac3e0fdc4152c51878b498396ec7f30e7a914d6071e674d49420fb8
checksum=2877b03f998cd8c08f07cd0de5b767119cd3ef40d09f41c30d722f6686b0fb88
# slow tests are broken
make_check_args="-m not(slow)"
post_install() {
vman doc/man/isympy.1