f6df99a
Name:           python-mpmath
48c50ef
Version:        1.2.1
22d2a2c
Release:        %autorelease
f6df99a
Summary:        A pure Python library for multiprecision floating-point arithmetic
f6df99a
License:        BSD
70c284e
URL:            https://mpmath.org
f6df99a
# Source code
326f185
Source0:        https://github.com/fredrik-johansson/mpmath/archive/%{version}/%{name}-%{version}.tar.gz
1d0bd03
9b92674
# Switch to 'traditional' theme in RHEL since 'classic' isn't available
9b92674
Patch0:         python-mpmath-1.0.0-sphinx.patch
9b92674
dfc517c
# #1974835 - CVE-2021-29063 python-mpmath: Regular expression denial of service in the mpmathify function
dfc517c
Patch1:         https://github.com/fredrik-johansson/mpmath/pull/570.patch
dfc517c
70c284e
BuildRequires:  python3-devel
d27eea4
BuildRequires:  python3-pip
d27eea4
BuildRequires:  python3-setuptools
d27eea4
BuildRequires:  python3-setuptools_scm
70c284e
BuildRequires:  python3-pytest
70c284e
BuildRequires:  python3-sphinx
70c284e
BuildRequires:  xorg-x11-server-Xvfb
f6df99a
6f8291f
# For building documentation
f6df99a
BuildRequires:  dvipng
f6df99a
BuildRequires:  tex(latex)
6f8291f
70c284e
BuildArch:      noarch
6f8291f
70c284e
%global _description %{expand:
70c284e
Mpmath is a pure-Python library for multiprecision floating-point
70c284e
arithmetic. It provides an extensive set of transcendental functions,
70c284e
unlimited exponent sizes, complex numbers, interval arithmetic,
70c284e
numerical integration and differentiation, root-finding, linear
70c284e
algebra, and much more. Almost any calculation can be performed just
70c284e
as well at 10-digit or 1000-digit precision, and in many cases mpmath
70c284e
implements asymptotically fast algorithms that scale well for
70c284e
extremely high precision work. If available, mpmath will (optionally)
70c284e
use gmpy to speed up high precision operations.}
6f8291f
8f3f072
%description %_description
6f8291f
8ce444b
%package -n python3-mpmath
f6df99a
Summary:        A pure Python library for multiprecision floating-point arithmetic
7ed126f
%if 0%{?fedora} || 0%{?rhel} > 7
e91a6db
Recommends: python3-matplotlib
7ed126f
%endif
e91a6db
%{?python_provide:%python_provide python3-mpmath}
8ce444b
b1b26cf
%description -n python3-mpmath %_description
8ce444b
8ce444b
If you require plotting capabilities in mpmath, install python3-matplotlib.
8ce444b
8ce444b
6f8291f
%package doc
f6df99a
Summary:        HTML documentation for %{name}
b1b26cf
Requires:       python3-mpmath = %{version}-%{release}
6f8291f
6f8291f
%description doc
6f8291f
This package contains the HTML documentation for %{name}.
6f8291f
6f8291f
6f8291f
%prep
326f185
%setup -q -n mpmath-%{version}
9b92674
%if 0%{?rhel} == 6 || 0%{?rhel} == 7
9b92674
%patch0 -p1 -b .sphinx
9b92674
%endif
dfc517c
%patch1 -p1
9b92674
270d7cb
# Convert line encodings
6278204
for doc in CHANGES LICENSE README.rst TODO mpmath/tests/runtests.py; do
6f8291f
 sed "s|\r||g" $doc > $doc.new && \
6f8291f
 touch -r $doc $doc.new && \
6f8291f
 mv $doc.new $doc
6f8291f
done
6f8291f
find doc -name *.txt -exec sed -i "s|\r||g" {} \;
6f8291f
a22a1af
shebangs="mpmath/matrices/eigen.py mpmath/matrices/eigen_symmetric.py mpmath/tests/runtests.py mpmath/tests/test_eigen.py mpmath/tests/test_eigen_symmetric.py mpmath/tests/test_levin.py"
6f8291f
# Get rid of unnecessary shebangs
a22a1af
for lib in $shebangs; do
a22a1af
 sed '/^#!.*/d; 1q' $lib > $lib.new && \
6f8291f
 touch -r $lib $lib.new && \
6f8291f
 mv $lib.new $lib
6f8291f
done
6f8291f
d27eea4
sed -i -r 's/use_scm_version=True/version="%{version}"/' setup.py
d27eea4
6f8291f
%build
62d4dbe
%py3_build
62d4dbe
6f8291f
# Build documentation
6f8291f
cd doc
b1b26cf
%{__python3} build.py
6f8291f
6f8291f
%install
e91a6db
%py3_install
6f8291f
6f8291f
%check
6f8291f
cd build/lib/mpmath/tests/
70c284e
xvfb-run -a pytest-3 -v
6f8291f
8ce444b
%files -n python3-mpmath
70c284e
%license LICENSE
70c284e
%doc CHANGES README.rst TODO
8ce444b
%{python3_sitelib}/mpmath/
8ce444b
%{python3_sitelib}/mpmath-%{version}-*.egg-info
8ce444b
6f8291f
%files doc
6f8291f
%doc doc/build/*
6f8291f
6f8291f
%changelog
22d2a2c
%autochangelog