f6df99a
Name:           python-mpmath
6e6893b
Version:        1.3.0
22d2a2c
Release:        %autorelease
f6df99a
Summary:        A pure Python library for multiprecision floating-point arithmetic
1627cf4
License:        BSD-3-Clause
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
70c284e
BuildRequires:  python3-devel
d27eea4
BuildRequires:  python3-setuptools
70c284e
BuildRequires:  xorg-x11-server-Xvfb
f6df99a
6f8291f
# For building documentation
f6df99a
BuildRequires:  dvipng
1627cf4
BuildRequires:  latexmk
6e6893b
BuildRequires:  make
1627cf4
BuildRequires:  tex(latex)
1627cf4
BuildRequires:  tex(capt-of.sty)
1627cf4
BuildRequires:  tex(ellipse.sty)
1627cf4
BuildRequires:  tex(fncychap.sty)
1627cf4
BuildRequires:  tex(framed.sty)
1627cf4
BuildRequires:  tex(needspace.sty)
1627cf4
BuildRequires:  tex(pict2e.sty)
1627cf4
BuildRequires:  tex(tabulary.sty)
1627cf4
BuildRequires:  tex(tgtermes.sty)
1627cf4
BuildRequires:  tex(txtt.tfm)
1627cf4
BuildRequires:  tex(upquote.sty)
1627cf4
BuildRequires:  tex(wrapfig.sty)
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
9f4fbe5
Recommends:     python3-matplotlib
7ed126f
%endif
8ce444b
b1b26cf
%description -n python3-mpmath %_description
8ce444b
8ce444b
If you require plotting capabilities in mpmath, install python3-matplotlib.
8ce444b
1627cf4
%package doc
1627cf4
Summary:        HTML documentation for %{name}
1627cf4
Requires:       python3-mpmath = %{version}-%{release}
1627cf4
1627cf4
# BSD-3-Clause: the content
1627cf4
# BSD-2-Clause: files in html/_static and html/searchindex.js, added by Sphinx
1627cf4
License:        BSD-3-Clause AND BSD-2-Clause
1627cf4
1627cf4
%description doc
1627cf4
This package contains the HTML documentation for %{name}.
1627cf4
1627cf4
%pyproject_extras_subpkg -n python3-mpmath gmpy
8ce444b
6f8291f
%prep
326f185
%setup -q -n mpmath-%{version}
1627cf4
%if 0%{?rhel} == 7
1627cf4
%patch -P0 -p1 -b .sphinx
9b92674
%endif
9b92674
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
1627cf4
%generate_buildrequires
1627cf4
%pyproject_buildrequires -x docs,gmpy,tests
d27eea4
6f8291f
%build
1627cf4
%pyproject_wheel
1627cf4
1627cf4
# Build documentation
1627cf4
export PYTHONPATH=$PWD/build/lib
1627cf4
mkdir -p docs/latex
1627cf4
sphinx-build -b latex %{?_smp_mflags} docs docs/latex
1627cf4
%make_build -C docs/latex
1627cf4
mkdir -p docs/html
1627cf4
sphinx-build -b html %{?_smp_mflags} docs docs/html
1627cf4
rm -rf docs/html/.{buildinfo,doctrees}
62d4dbe
6f8291f
%install
1627cf4
%pyproject_install
1627cf4
%pyproject_save_files mpmath
6f8291f
6f8291f
%check
6f8291f
cd build/lib/mpmath/tests/
70c284e
xvfb-run -a pytest-3 -v
6f8291f
1627cf4
%files -n python3-mpmath -f %{pyproject_files}
6e6893b
%doc CHANGES README.rst
1627cf4
1627cf4
%files doc
1627cf4
%doc docs/latex/mpmath.pdf docs/html
8ce444b
6f8291f
%changelog
22d2a2c
%autochangelog