Adapt to more changes in python 3.7.
This commit is contained in:
parent
be6d2913d6
commit
16724183cd
|
@ -0,0 +1,24 @@
|
|||
--- sympy-sympy-1.1.1/sympy/core/tests/test_sympify.py.orig 2017-07-26 16:46:51.000000000 -0600
|
||||
+++ sympy-sympy-1.1.1/sympy/core/tests/test_sympify.py 2018-06-27 08:19:06.815713759 -0600
|
||||
@@ -582,8 +582,6 @@ def test_numpy():
|
||||
assert equal(sympify(np.float32(1.123456)), Float(1.123456, precision=24))
|
||||
assert equal(sympify(np.float64(1.1234567891234)),
|
||||
Float(1.1234567891234, precision=53))
|
||||
- assert equal(sympify(np.longdouble(1.123456789)),
|
||||
- Float(1.123456789, precision=80))
|
||||
assert equal(sympify(np.complex64(1 + 2j)), S(1.0 + 2.0*I))
|
||||
assert equal(sympify(np.complex128(1 + 2j)), S(1.0 + 2.0*I))
|
||||
assert equal(sympify(np.longcomplex(1 + 2j)), S(1.0 + 2.0*I))
|
||||
@@ -594,12 +592,6 @@ def test_numpy():
|
||||
except AttributeError: #float96 does not exist on all platforms
|
||||
pass
|
||||
|
||||
- try:
|
||||
- assert equal(sympify(np.float128(1.123456789123)),
|
||||
- Float(1.123456789123, precision=80))
|
||||
- except AttributeError: #float128 does not exist on all platforms
|
||||
- pass
|
||||
-
|
||||
|
||||
@XFAIL
|
||||
def test_sympify_rational_numbers_set():
|
|
@ -9,3 +9,180 @@
|
|||
|
||||
from sympy.core import (Add, Mul, Pow, Integer, Number, NumberSymbol,)
|
||||
from sympy.core.numbers import ImaginaryUnit
|
||||
--- python3/sympy/physics/mechanics/linearize.py.orig 2017-07-26 16:46:12.000000000 -0600
|
||||
+++ python3/sympy/physics/mechanics/linearize.py 2018-06-27 18:50:27.377496377 -0600
|
||||
@@ -8,6 +8,7 @@ from sympy.utilities.iterables import fl
|
||||
from sympy.physics.vector import dynamicsymbols
|
||||
from sympy.physics.mechanics.functions import msubs
|
||||
import collections
|
||||
+import collections.abc
|
||||
|
||||
|
||||
class Linearizer(object):
|
||||
@@ -262,7 +263,7 @@ class Linearizer(object):
|
||||
# Compose dict of operating conditions
|
||||
if isinstance(op_point, dict):
|
||||
op_point_dict = op_point
|
||||
- elif isinstance(op_point, collections.Iterable):
|
||||
+ elif isinstance(op_point, collections.abc.Iterable):
|
||||
op_point_dict = {}
|
||||
for op in op_point:
|
||||
op_point_dict.update(op)
|
||||
--- python3/sympy/physics/units/util.py.orig 2017-07-26 16:46:12.000000000 -0600
|
||||
+++ python3/sympy/physics/units/util.py 2018-06-27 18:48:35.345734211 -0600
|
||||
@@ -6,7 +6,7 @@ Several methods to simplify expressions
|
||||
|
||||
from __future__ import division
|
||||
|
||||
-import collections
|
||||
+import collections.abc
|
||||
|
||||
from sympy.physics.units.quantities import Quantity
|
||||
from sympy import Add, Mul, Pow, Function, Rational, Tuple, sympify
|
||||
@@ -110,7 +110,7 @@ def convert_to(expr, target_units):
|
||||
7.62950196312651e-20*gravitational_constant**(-0.5)*hbar**0.5*speed_of_light**0.5
|
||||
|
||||
"""
|
||||
- if not isinstance(target_units, (collections.Iterable, Tuple)):
|
||||
+ if not isinstance(target_units, (collections.abc.Iterable, Tuple)):
|
||||
target_units = [target_units]
|
||||
|
||||
if isinstance(expr, Add):
|
||||
--- python3/sympy/printing/conventions.py.orig 2017-07-26 16:46:12.000000000 -0600
|
||||
+++ python3/sympy/printing/conventions.py 2018-06-27 18:49:32.873611416 -0600
|
||||
@@ -5,7 +5,7 @@ A few practical conventions common to al
|
||||
from __future__ import print_function, division
|
||||
|
||||
import re
|
||||
-import collections
|
||||
+import collections.abc
|
||||
|
||||
|
||||
_name_with_digits_p = re.compile(r'^([a-zA-Z]+)([0-9]+)$')
|
||||
@@ -77,7 +77,7 @@ def requires_partial(expr):
|
||||
get the context of the expression.
|
||||
"""
|
||||
|
||||
- if not isinstance(expr.free_symbols, collections.Iterable):
|
||||
+ if not isinstance(expr.free_symbols, collections.abc.Iterable):
|
||||
return len(set(expr.variables)) > 1
|
||||
|
||||
return sum(not s.is_integer for s in expr.free_symbols) > 1
|
||||
--- python3/sympy/tensor/array/arrayop.py.orig 2017-07-26 16:46:12.000000000 -0600
|
||||
+++ python3/sympy/tensor/array/arrayop.py 2018-06-27 18:51:28.657367034 -0600
|
||||
@@ -1,6 +1,6 @@
|
||||
import itertools
|
||||
|
||||
-import collections
|
||||
+import collections.abc
|
||||
|
||||
from sympy import S, Tuple, diff
|
||||
|
||||
@@ -103,7 +103,7 @@ def tensorcontraction(array, *contractio
|
||||
# Verify contraction_axes:
|
||||
taken_dims = set([])
|
||||
for axes_group in contraction_axes:
|
||||
- if not isinstance(axes_group, collections.Iterable):
|
||||
+ if not isinstance(axes_group, collections.abc.Iterable):
|
||||
raise ValueError("collections of contraction axes expected")
|
||||
|
||||
dim = array.shape[axes_group[0]]
|
||||
@@ -190,7 +190,7 @@ def derive_by_array(expr, dx):
|
||||
|
||||
"""
|
||||
from sympy.matrices import MatrixBase
|
||||
- array_types = (collections.Iterable, MatrixBase, NDimArray)
|
||||
+ array_types = (collections.abc.Iterable, MatrixBase, NDimArray)
|
||||
|
||||
if isinstance(dx, array_types):
|
||||
dx = ImmutableDenseNDimArray(dx)
|
||||
--- python3/sympy/tensor/array/ndim_array.py.orig 2017-07-26 16:46:12.000000000 -0600
|
||||
+++ python3/sympy/tensor/array/ndim_array.py 2018-06-27 18:47:21.848896952 -0600
|
||||
@@ -1,5 +1,5 @@
|
||||
from __future__ import print_function, division
|
||||
-import collections
|
||||
+import collections.abc
|
||||
|
||||
from sympy import Basic
|
||||
|
||||
@@ -100,13 +100,13 @@ class NDimArray(object):
|
||||
|
||||
def _setter_iterable_check(self, value):
|
||||
from sympy.matrices.matrices import MatrixBase
|
||||
- if isinstance(value, (collections.Iterable, MatrixBase, NDimArray)):
|
||||
+ if isinstance(value, (collections.abc.Iterable, MatrixBase, NDimArray)):
|
||||
raise NotImplementedError
|
||||
|
||||
@classmethod
|
||||
def _scan_iterable_shape(cls, iterable):
|
||||
def f(pointer):
|
||||
- if not isinstance(pointer, collections.Iterable):
|
||||
+ if not isinstance(pointer, collections.abc.Iterable):
|
||||
return [pointer], ()
|
||||
|
||||
result = []
|
||||
@@ -131,7 +131,7 @@ class NDimArray(object):
|
||||
shape = iterable.shape
|
||||
iterable = list(iterable)
|
||||
# Construct N-dim array from an iterable (numpy arrays included):
|
||||
- elif shape is None and isinstance(iterable, collections.Iterable):
|
||||
+ elif shape is None and isinstance(iterable, collections.abc.Iterable):
|
||||
iterable, shape = cls._scan_iterable_shape(iterable)
|
||||
|
||||
# Construct N-dim array from a Matrix:
|
||||
@@ -310,7 +310,7 @@ class NDimArray(object):
|
||||
def __mul__(self, other):
|
||||
from sympy.matrices.matrices import MatrixBase
|
||||
|
||||
- if isinstance(other, (collections.Iterable,NDimArray, MatrixBase)):
|
||||
+ if isinstance(other, (collections.abc.Iterable,NDimArray, MatrixBase)):
|
||||
raise ValueError("scalar expected, use tensorproduct(...) for tensorial product")
|
||||
other = sympify(other)
|
||||
result_list = [i*other for i in self]
|
||||
@@ -319,7 +319,7 @@ class NDimArray(object):
|
||||
def __rmul__(self, other):
|
||||
from sympy.matrices.matrices import MatrixBase
|
||||
|
||||
- if isinstance(other, (collections.Iterable,NDimArray, MatrixBase)):
|
||||
+ if isinstance(other, (collections.abc.Iterable,NDimArray, MatrixBase)):
|
||||
raise ValueError("scalar expected, use tensorproduct(...) for tensorial product")
|
||||
other = sympify(other)
|
||||
result_list = [other*i for i in self]
|
||||
@@ -328,7 +328,7 @@ class NDimArray(object):
|
||||
def __div__(self, other):
|
||||
from sympy.matrices.matrices import MatrixBase
|
||||
|
||||
- if isinstance(other, (collections.Iterable,NDimArray, MatrixBase)):
|
||||
+ if isinstance(other, (collections.abc.Iterable,NDimArray, MatrixBase)):
|
||||
raise ValueError("scalar expected")
|
||||
other = sympify(other)
|
||||
result_list = [i/other for i in self]
|
||||
--- python3/sympy/tensor/indexed.py.orig 2017-07-26 16:46:12.000000000 -0600
|
||||
+++ python3/sympy/tensor/indexed.py 2018-06-27 18:48:03.513804692 -0600
|
||||
@@ -107,7 +107,7 @@ matrix element ``M[i, j]`` as in the fol
|
||||
|
||||
from __future__ import print_function, division
|
||||
|
||||
-import collections
|
||||
+import collections.abc
|
||||
|
||||
from sympy.core.sympify import _sympify
|
||||
from sympy.functions.special.tensor_functions import KroneckerDelta
|
||||
@@ -153,7 +153,7 @@ class Indexed(Expr):
|
||||
raise TypeError(filldedent("""
|
||||
Indexed expects string, Symbol, or IndexedBase as base."""))
|
||||
args = list(map(sympify, args))
|
||||
- if isinstance(base, (NDimArray, collections.Iterable, Tuple, MatrixBase)) and all([i.is_number for i in args]):
|
||||
+ if isinstance(base, (NDimArray, collections.abc.Iterable, Tuple, MatrixBase)) and all([i.is_number for i in args]):
|
||||
if len(args) == 1:
|
||||
return base[args[0]]
|
||||
else:
|
||||
@@ -376,7 +376,7 @@ class IndexedBase(Expr, NotIterable):
|
||||
pass
|
||||
elif isinstance(label, (MatrixBase, NDimArray)):
|
||||
return label
|
||||
- elif isinstance(label, collections.Iterable):
|
||||
+ elif isinstance(label, collections.abc.Iterable):
|
||||
return _sympify(label)
|
||||
else:
|
||||
label = _sympify(label)
|
||||
|
|
13
sympy.spec
13
sympy.spec
|
@ -5,8 +5,10 @@ Summary: A Python library for symbolic mathematics
|
|||
License: BSD
|
||||
URL: http://sympy.org/
|
||||
Source0: https://github.com/%{name}/%{name}/archive/%{name}-%{version}.tar.gz
|
||||
# Remove tests that fail on non-x86 architectures
|
||||
Patch0: %{name}-float.patch
|
||||
# Adapt to changes in python 3.7
|
||||
Patch0: %{name}-python3.patch
|
||||
Patch1: %{name}-python3.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
|
@ -103,6 +105,7 @@ HTML documentation for sympy.
|
|||
|
||||
%prep
|
||||
%setup -q -c
|
||||
%patch0
|
||||
|
||||
# If running on a 32-bit system, disable a test that requires 64-bit integers.
|
||||
%global maxpyint %(python3 -c 'import sys;print("%x" % sys.maxsize)')
|
||||
|
@ -111,18 +114,12 @@ if [ "%{maxpyint}" = "7fffffff" ]; then
|
|||
%{sympydir}/sympy/polys/tests/test_rootoftools.py
|
||||
fi
|
||||
|
||||
# If not running on x86 with a floating point coprocessor, disable a test that
|
||||
# requires 80-bit long doubles.
|
||||
%ifnarch i686
|
||||
sed -i '585,586d' %{sympydir}/sympy/core/tests/test_sympify.py
|
||||
%endif
|
||||
|
||||
# Allow building with a numpy that has a release candidate version number
|
||||
sed -i 's/StrictVersion/LooseVersion/g' %{sympydir}/sympy/external/importtools.py
|
||||
|
||||
# Make a copy for building the python3 version
|
||||
cp -a %{sympydir} python3
|
||||
%patch0
|
||||
%patch1
|
||||
|
||||
# One test gets an extra warning with python3
|
||||
sed -i '/Adaptive meshing could not be applied/d' \
|
||||
|
|
Loading…
Reference in New Issue