File python-sympy.spec of Package python-sympy

#
# spec file for package python-sympy
#
# Copyright (c) 2014 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/
#


Name:           python-sympy
Version:        0.7.5
Release:        0
Summary:        Python library for symbolic mathematics
License:        BSD-3-Clause
Group:          Development/Libraries/Python
Url:            http://code.google.com/p/sympy/
Source0:        https://pypi.python.org/packages/source/s/sympy/sympy-%{version}.tar.gz
BuildRequires:  python-devel >= 2.5
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%else
BuildArch:      noarch
%endif

%description
SymPy is a Python library for symbolic mathematics. It 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.

%prep
%setup -q -n sympy-%{version}
# For rpmlint warning: remove shebang from python library:
sed -i '/^#!/d' ./sympy/mpmath/tests/runtests.py

%build
python setup.py build

%install
python setup.py install --root=%{buildroot} --prefix=%{_prefix}
mv %{buildroot}%{_bindir}/isympy %{buildroot}%{_bindir}/isympy-%{py_ver}
ln -s %{_bindir}/isympy-%{py_ver} %{buildroot}%{_bindir}/isympy
mv %{buildroot}%{_mandir}/man1/isympy.1 %{buildroot}%{_mandir}/man1/isympy-%{py_ver}.1
ln -s %{_mandir}/man1/isympy-%{py_ver}.1 %{buildroot}%{_mandir}/man1/isympy.1

%pre
# Since /usr/bin/isympy and /usr/share/man/man1/isympy.1.gz became ghosted to be used
# with update-alternatives, we have to get rid of the old binary resulting from the
# non-update-alternativies-ified package:
[ -h %{_bindir}/isympy ] || rm -f %{_bindir}/isympy
[ -h %{_mandir}/man1/isympy.1.gz ] || rm -f %{_mandir}/man1/isympy.1.gz

%post
update-alternatives \
    --install %{_bindir}/isympy isympy %{_bindir}/isympy-%{py_ver} 20 \
    --slave %{_mandir}/man1/isympy.1.gz isympy.1 %{_mandir}/man1/isympy-%{py_ver}.1.gz

%preun
if [ $1 -eq 0 ] ; then
    update-alternatives --remove isympy %{_bindir}/isympy-%{py_ver}
fi

%files
%defattr(-,root,root,-)
%ghost %{_bindir}/isympy
%{_bindir}/isympy-%{py_ver}
%ghost %{_mandir}/man1/isympy.1.gz
%{_mandir}/man1/isympy-%{py_ver}.1.gz
%{python_sitelib}/sympy
%{python_sitelib}/sympy-%{version}-py%{py_ver}.egg-info

%changelog
openSUSE Build Service is sponsored by