File python-mpmath.spec of Package python-mpmath

#
# spec file for package python-mpmath
#
# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-mpmath
Version:        0.19
Release:        1
License:        BSD-3-Clause
Summary:        Python library for arbitrary-precision floating-point arithmetic
Url:            https://github.com/fredrik-johansson/mpmath
Group:          Development/Libraries/Python
Source:         https://files.pythonhosted.org/packages/source/m/mpmath/mpmath-all-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module gmpy >= 1.03}
BuildRequires:  %{python_module six}
BuildRequires:  python3-Sphinx
%if %{with test}
BuildRequires:  %{python_module nose}
%endif
Requires:       python-gmpy  >= 1.03
Requires:       python-six
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
%python_subpackages

%description
Mpmath is a pure-Python library for multiprecision floating-point 
arithmetic. It provides an extensive set of transcendental functions, 
unlimited exponent sizes, complex numbers, interval arithmetic,
numerical integration and differentiation, root-finding, linear 
algebra, and much more. Almost any calculation can be performed just 
as well at 10-digit or 1000-digit precision, and in many cases mpmath
implements asymptotically fast algorithms that scale well for
extremely high precision work. If available, mpmath will (optionally) 
use gmpy to speed up high precision operations.

%package -n %{name}-doc
Summary:        Documentation for %{name}
Group:          Documentation/Other
Provides:       %{python_module mpmath-doc = %{version}}

%description -n %{name}-doc
Documentation, help files, and demos for %{name}.

%prep
%setup -q -n mpmath-all-%{version}
sed -i 's/\r//' mpmath/tests/runtests.py  # fix wrong-script-end-of-line-encoding rpmlint warning
sed -i '1d' mpmath/tests/runtests.py  # fix non-executable-script rpmlint warning

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

pushd doc
python3 build.py
rm -r build/.{doctrees,buildinfo}
popd

%if %{with test}
%check
pushd demo
%{python_expand export PYTHONPATH="%{buildroot}%{$python_sitelib}" 
$python -B -c "import mpmath;mpmath.runtests()"
}
popd
%endif

%files %{python_files}
%defattr(-,root,root)
%doc CHANGES LICENSE README.rst
%{python_sitelib}/*

%files -n %{name}-doc
%defattr(-,root,root)
%doc demo/
%doc doc/build


%changelog