Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

Name:           sympy
Version:        0.7.6
Release:        2%{?dist}
Summary:        A Python library for symbolic mathematics
License:        BSD
URL:            http://sympy.org/
Source0:        https://github.com/%{name}/%{name}/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
# Upstream tried to graft in another project as a private copy; we rip
# it out (rhbz# 551576):
Patch0:         %{name}-0.7.6-strip-internal-mpmath.patch
BuildArch:      noarch

BuildRequires:  gcc-gfortran
BuildRequires:  gettext
BuildRequires:  graphviz
BuildRequires:  ImageMagick
BuildRequires:  librsvg2-tools
BuildRequires:  numpy
BuildRequires:  numpy-f2py
BuildRequires:  python2-devel
BuildRequires:  python-fastcache
BuildRequires:  python-gmpy2
BuildRequires:  python-matplotlib
BuildRequires:  python-mpmath
BuildRequires:  python-sphinx
BuildRequires:  scipy
%if 0%{?with_python3}
BuildRequires:  python3-numpy
BuildRequires:  python3-numpy-f2py
BuildRequires:  python3-devel
BuildRequires:  python3-fastcache
BuildRequires:  python3-gmpy2
BuildRequires:  python3-matplotlib
BuildRequires:  python3-mpmath
BuildRequires:  python3-scipy
%endif
BuildRequires:  tex(latex)
BuildRequires:  tex-dvipng
BuildRequires:  xorg-x11-fonts-Type1
BuildRequires:  xorg-x11-server-Xvfb

Requires:       python-fastcache
Requires:       python-gmpy2
Requires:       python-matplotlib
Requires:       python-mpmath
Requires:       python-pyglet

%if 0%{?fedora} > 21
Recommends:     python-theano
%endif

%description
SymPy aims to become a full-featured computer algebra system (CAS)
while keeping the code as simple as possible in order to be
comprehensible and easily extensible. SymPy is written entirely in
Python and does not require any external libraries.

%if 0%{?with_python3}
%package -n python3-%{name}
Summary:        A Python3 library for symbolic mathematics
Requires:       python3-fastcache
Requires:       python3-gmpy2
Requires:       python3-matplotlib
Requires:       python3-mpmath
Requires:       python3-pyglet

%if 0%{?fedora} > 21
Recommends:     python3-theano
%endif

%description -n python3-%{name}
SymPy aims to become a full-featured computer algebra system (CAS)
while keeping the code as simple as possible in order to be
comprehensible and easily extensible. SymPy is written entirely in
Python and does not require any external libraries.
%endif

%package texmacs
Summary:        TeXmacs integration for sympy
Requires:       %{name} = %{version}-%{release}, TeXmacs

%description texmacs
This package contains a TeXmacs plugin for sympy.

%package examples
Summary:        Sympy examples
Requires:       %{name} = %{version}-%{release}

%description examples
This package contains example input for sympy.

%package doc
Summary:        Documentation for sympy
Requires:       %{name} = %{version}-%{release}
Provides:       bundled(jquery)

%description doc
HTML documentation for sympy.

%prep
%setup -q
%patch0 -b .mpmath
rm -rf sympy/mpmath doc/src/modules/mpmath
rm -rf %{name}-%{version}/sympy/mpmath %{name}-%{version}/doc/src/module/mpmath

%if 0%{?with_python3}
# Make a copy for building the python3 version
rm -rf %{py3dir}
cp -a . %{py3dir}

# One plotting test expects one warning, which happens with python < 3.4, but
# the same warning is triggered in a different spot with python 3.4, leading
# to an assertion failure.
sed -e '/import warnings/ifrom sympy.utilities.pytest import XFAIL' \
    -e '/^def test_matplotlib():/i@XFAIL' \
    -i %{py3dir}/sympy/plotting/tests/test_plot_implicit.py
%endif

%build
# Build the python2 version
python2 setup.py build

%if 0%{?with_python3}
# Build the python3 version
pushd %{py3dir}
python3 setup.py build
popd
%endif

# Build the documentation
cd doc
make html
make cheatsheet
%if 0%{?with_python3}
pushd %{py3dir}/doc
make cheatsheet
popd
%endif

%install
%if 0%{?with_python3}
# Install the python3 version
pushd %{py3dir}
python3 setup.py install -O1 --skip-build --root %{buildroot}
sed -i 's/env python/python3/' %{buildroot}%{_bindir}/isympy
touch -r bin/isympy %{buildroot}%{_bindir}/isympy
mv %{buildroot}%{_bindir}/isympy %{buildroot}%{_bindir}/python3-isympy
mv %{buildroot}%{_mandir}/man1/isympy.1 \
   %{buildroot}%{_mandir}/man1/python3-isympy.1
popd
%endif

# Install the python2 version
python2 setup.py install -O1 --skip-build --root %{buildroot}
sed -i 's/env python/python2/' %{buildroot}%{_bindir}/isympy
touch -r bin/isympy %{buildroot}%{_bindir}/isympy

## Remove extra files
rm -f %{buildroot}%{_bindir}/{,doc}test

## Install the TeXmacs integration
sed 's/python/python2/' data/TeXmacs/bin/tm_sympy > \
  %{buildroot}%{_bindir}/tm_sympy
chmod a+x %{buildroot}%{_bindir}/tm_sympy
touch -r data/TeXmacs/bin/tm_sympy %{buildroot}%{_bindir}/tm_sympy
mkdir -p %{buildroot}%{_datadir}/TeXmacs/plugins/sympy
cp -a data/TeXmacs/progs %{buildroot}%{_datadir}/TeXmacs/plugins/sympy

# Don't let an executable script go into the documentation
chmod a-x examples/all.py

# Install the HTML documentation
mkdir -p %{buildroot}%{_docdir}/%{name}-doc
cp -a doc/_build/html %{buildroot}%{_docdir}/%{name}-doc
rm -f %{buildroot}%{_docdir}/%{name}-doc/html/.buildinfo
rm -fr %{buildroot}%{_docdir}/%{name}-doc/i18n

%if 0%{?with_python3}
# Stash the python3 build of the cheatsheet where %%doc can find it
cp -p %{py3dir}/doc/_build/cheatsheet/combinatoric_cheatsheet.pdf .
%endif

%check
# The python3 tests fail with Unicode errors without this
export LC_ALL=en_US.UTF-8

let "dnum = $RANDOM % 90 + 10"
xvfb-run -n $dnum python2 setup.py test
%if 0%{?with_python3}
pushd %{py3dir}
xvfb-run -n $dnum python3 setup.py test
popd
%endif
 
%files
%doc AUTHORS README.rst doc/_build/cheatsheet/combinatoric_cheatsheet.pdf
%license LICENSE
%{python2_sitelib}/sympy/
%{python2_sitelib}/sympy-%{version}-*.egg-info
%{_bindir}/isympy
%{_mandir}/man1/isympy.1*

%if 0%{?with_python3}
%files -n python3-%{name}
%doc AUTHORS README.rst combinatoric_cheatsheet.pdf
%license LICENSE
%{python3_sitelib}/sympy/
%{python3_sitelib}/sympy-%{version}-*.egg-info
%{_bindir}/python3-isympy
%{_mandir}/man1/python3-isympy.1*
%endif

%files texmacs
%license data/TeXmacs/LICENSE
%{_bindir}/tm_sympy
%{_datadir}/TeXmacs/plugins/sympy/

%files examples
%doc examples

%files doc
%docdir %{_docdir}/%{name}-doc/html
%{_docdir}/%{name}-doc/html

%changelog
* Wed Jun 24 2015 Orion Poplawski <orion@cora.nwra.com> - 0.7.6-2
- No python3 in EPEL

* Fri May 22 2015 Susi Lehtola <jussilehtola@fedoraproject.org> - 0.7.6-2
- Conditionalize recommends.

* Fri Dec  5 2014 Jerry James <loganjerry@gmail.com> - 0.7.6-1
- Update to 0.7.6
- Drop upstreamed -test and -is-tangent patches
- Drop obsolete bug workarounds
- Add python(3)-fastcache BR and R
- Recommend python-theano
- Fix executable bits on tm_sympy

* Tue Sep 16 2014 Jerry James <loganjerry@gmail.com> - 0.7.5-4
- Drop python3-six BR and R now that bz 1140413 is fixed
- Use gmpy2

* Wed Sep  3 2014 Jerry James <loganjerry@gmail.com> - 0.7.5-3
- Install both isympy and python3-isympy to comply with packaging standards
- Add -is-tangent patch (bz 1135677)
- Temporarily disable tests that fail due to mpmath bugs (bz 1127796)
- Fix license handling
- Add python3-six BR and R; see bz 1140413 for details

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Mon May 19 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 0.7.5-2
- Rebuilt for https://fedoraproject.org/wiki/Changes/Python_3.4

* Thu Mar 13 2014 Jerry James <loganjerry@gmail.com> - 0.7.5-1
- Update to 0.7.5 (bz 1066951)
- Binaries now default to using python3
- Use py3dir macro to simplify python3 build
- Add BRs for more comprehensive testing
- Workaround bz 1075826
- Add -test patch to fix Unicode problem in the tests

* Mon Dec  9 2013 Jerry James <loganjerry@gmail.com> - 0.7.4-1
- Update to 0.7.4
- Python 2 and 3 sources are now in the same tarball

* Fri Oct 18 2013 Jerry James <loganjerry@gmail.com> - 0.7.3-2
- Build a python3 subpackage (bz 982759)

* Fri Aug  2 2013 Jerry James <loganjerry@gmail.com> - 0.7.3-1
- Update to 0.7.3
- Upstream dropped all tutorial translations
- Add graphviz BR for documentation
- Sources now distributed from github instead of googlecode
- Adapt to versionless _docdir in Rawhide

* Mon Jun 17 2013 Jerry James <loganjerry@gmail.com> - 0.7.2-1
- Update to 0.7.2 (bz 866044)
- Add python-pyglet R (bz 890312)
- Package the TeXmacs integration
- Build and provide documentation
- Provide examples
- Minor spec file cleanups

* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

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

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

* Tue Oct 11 2011 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.7.1-1
- Update to 0.7.1.

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.7-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Aug 30 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.6.7-5
- Patch around BZ #564504.

* Sat Jul 31 2010 David Malcolm <dmalcolm@redhat.com> - 0.6.7-4
- fix a python 2.7 incompatibility

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

* Tue Apr 27 2010 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.6.7-2
- Added %%check phase.

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

* Mon Feb 15 2010 Conrad Meyer <konrad@tylerc.org> - 0.6.6-3
- Patch around private copy nicely; avoid breakage from trying to replace
  a directory with a symlink.

* Mon Feb 15 2010 Conrad Meyer <konrad@tylerc.org> - 0.6.6-2
- Remove private copy of system lib 'mpmath' (rhbz #551576).

* Sun Dec 27 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.6.6-1
- Update to 0.6.6.

* Sat Nov 07 2009 Jussi Lehtola <jussilehtola@fedoraproject.org> - 0.6.5-1
- Update to 0.6.5.

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Dec 4 2008 Conrad Meyer <konrad@tylerc.org> - 0.6.3-1
- Bump to 0.6.3, supports python 2.6.

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.6.2-3
- Rebuild for Python 2.6

* Mon Oct 13 2008 Conrad Meyer <konrad@tylerc.org> - 0.6.2-2
- Patch to remove extraneous shebangs.

* Sun Oct 12 2008 Conrad Meyer <konrad@tylerc.org> - 0.6.2-1
- Initial package.