Blob Blame History Raw
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}

Name:		python-mpmath
Version:	0.17
Release:	5%{?dist}
Summary:	A pure Python library for multiprecision floating-point arithmetic
Group:		Applications/Engineering
License:	BSD
URL:		http://code.google.com/p/mpmath/
Source0:	http://mpmath.googlecode.com/files/mpmath-all-%{version}.tar.gz
# Patch to fix build, already reported and fixed upstream
Patch0:		python-mpmath-0.17-build.patch
BuildRoot:	%(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildArch:	noarch

BuildRequires:	python-devel
# For building documentation
BuildRequires:	dvipng
BuildRequires:	python-sphinx
BuildRequires:	tex(latex)


%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.

If you require plotting capabilities in mpmath, install python-matplotlib.

%package doc
Summary:	HTML documentation for %{name}
Group:		Documentation
Requires:	%{name} = %{version}-%{release}

%description doc
This package contains the HTML documentation for %{name}.


%prep
%setup -q -n mpmath-all-%{version}
%patch0 -p1 -b .buildfix
# Convert line encodings 
for doc in LICENSE CHANGES PKG-INFO README mpmath/tests/runtests.py; do
 sed "s|\r||g" $doc > $doc.new && \
 touch -r $doc $doc.new && \
 mv $doc.new $doc
done
find doc -name *.txt -exec sed -i "s|\r||g" {} \;

# Get rid of unnecessary shebangs
for lib in mpmath/elliptic.py mpmath/tests/runtests.py; do
 sed '/#!\/usr\/bin\/env/d' $lib > $lib.new && \
 touch -r $lib $lib.new && \
 mv $lib.new $lib
done

%build
python setup.py build
# Build documentation
cd doc
python build.py 

%install
rm -rf %{buildroot}
python setup.py install -O1 --skip-build --root %{buildroot}
# Get rid of python 3 version that fails to byte-compile
rm %{buildroot}%{python_sitelib}/mpmath/libmp/exec_py3.py*

%check
export PYTHONPATH=`pwd`/build/lib
cd build/lib/mpmath/tests/
python runtests.py

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc CHANGES LICENSE PKG-INFO README
%{python_sitelib}/mpmath/
%{python_sitelib}/mpmath-%{version}-*.egg-info

%files doc
%defattr(-,root,root,-)
%doc doc/build/*

%changelog
* Mon Jul 23 2012 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.17-5
- Fix %%check phase.

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.17-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.17-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.17-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sun Feb 06 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.17-1
- Update to 0.17.

* Sun Sep 26 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.16-1
- Update to 0.16.

* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 0.15-2
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Mon Jun 07 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.15-1
- Update to 0.15.

* Tue Apr 27 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.14-1
- Update to 0.14.

* Tue Oct 06 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.13-5
- Removed BR: python-matplotlib, since it didn't actually help in the missing
  image problem.
- Added versioned require in -doc.

* Tue Oct 06 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.13-4
- Replaced R: python-matplotlib with a comment in %%description.
- Added missing BR: python-matplotlib.

* Tue Oct 06 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.13-3
- Added missing BR: dvipng.
- Added %%check phase.

* Wed Sep 23 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.13-2
- Add missing BR: tex(latex).

* Wed Sep 23 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.13-1
- First release.