File python3-scipy.spec of Package python-scipy

#
# spec file for package python3-scipy
#
# Copyright (c) 2012 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/
#

%define modname scipy
Name:           python3-%{modname}
Version:        0.10.1
Release:        0
License:        BSD-3-Clause and LGPL-2.0+
Summary:        Scientific Tools for Python
Url:            http://www.scipy.org
Group:          Development/Libraries/Python
Source0:        %{modname}-%{version}.tar.gz
Patch0:         qhull-bufferoverflowstrncat.patch
Patch1:         rboxlib-bufferoverflowstrncat.patch
Patch2:         integrate_dop-no-return-in-non-void.patch
BuildRequires:  fdupes
BuildRequires:  fftw-devel
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  python3-2to3
BuildRequires:  python3-devel
BuildRequires:  python3-numpy-devel
BuildRequires:  blas-devel
BuildRequires:  lapack-devel
BuildRequires:  swig
%if 0%{?suse_version} > 1140
BuildRequires:  suitesparse-devel-static
%endif
%if 0%{?suse_version} <= 1210
BuildRequires:  libatlas3-devel
%endif
Requires:       python3-numpy
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} <= 1140
%{!?python3_sitearch: %global python3_sitearch %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%{!?py3_ver: %global py3_ver %(python3 -c "import sys; version=str(sys.version_info[0]) + '.' + str(sys.version_info[1]); print(version)" 2>/dev/null || echo PYTHON-NOT-FOUND)}
%endif

%description
Scipy is open-source software for mathematics, science, and
engineering. The core library is NumPy which provides convenient and
fast N-dimensional array manipulation. The SciPy library is built to
work with NumPy arrays, and provides many user-friendly and efficient
numerical routines such as routines for numerical integration and
optimization. Together, they run on all popular operating systems, are
quick to install, and are free of charge. NumPy and SciPy are easy to
use, but powerful enough to be depended upon by some of the world's
leading scientists and engineers.

%package weave
Summary:        Scientific Tools for Python - Weave
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Provides:       python3-%{modname}-devel = %{version}

%description weave
Scipy is open-source software for mathematics, science, and
engineering. The core library is NumPy which provides convenient and
fast N-dimensional array manipulation. The SciPy library is built to
work with NumPy arrays, and provides many user-friendly and efficient
numerical routines such as routines for numerical integration and
optimization. Together, they run on all popular operating systems, are
quick to install, and are free of charge. NumPy and SciPy are easy to
use, but powerful enough to be depended upon by some of the world's
leading scientists and engineers.

%prep
%setup -q -n %{modname}-%{version}
%patch0 -p1 -b .bufferoverflowstrncat
%patch1 -p1 -b .bufferoverflowstrncat
%patch2 -p1
find . -type f -name "*.py" -exec sed -i "s|#!/usr/bin/env python||" {} \;

cat > site.cfg << EOF
[amd]
library_dirs = %{_libdir}
include_dirs = /usr/include/suitesparse:/usr/include/ufsparse
amd_libs = amd

[umfpack]
library_dirs = %{_libdir}
include_dirs = /usr/include/suitesparse:/usr/include/ufsparse
umfpack_libs = umfpack
EOF

%build
CFLAGS="%{optflags} -fno-strict-aliasing" \
ATLAS=%{_libdir}/atlas \
FFTW=%{_libdir}
BLAS=%{_libdir} \
LAPACK=%{_libdir} \
python3 setup.py config_fc --fcompiler=gnu95 --noarch build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
find %{buildroot}%{python3_sitearch}/%{modname} -type d -name tests | xargs rm -rf # Don't ship tests
# Don't ship weave examples, they're marked as documentation:
find %{buildroot}%{python3_sitearch}/scipy/weave -type d -name examples | xargs rm -rf
%fdupes %{buildroot}%{python3_sitearch}
# fix executability issue
chmod +x %{buildroot}%{python3_sitearch}/%{modname}/io/arff/arffread.py
chmod +x %{buildroot}%{python3_sitearch}/%{modname}/io/arff/utils.py
chmod +x %{buildroot}%{python3_sitearch}/%{modname}/special/spfun_stats.py

%files
%defattr(-,root,root,-)
%doc LICENSE.txt
%{python3_sitearch}/%{modname}/
%{python3_sitearch}/%{modname}-%{version}-py%{py3_ver}.egg-info
%exclude %{python3_sitearch}/%{modname}/weave

%files weave
%defattr(-,root,root,-)
%doc %{modname}/weave/examples
%{python3_sitearch}/%{modname}/weave

%changelog
openSUSE Build Service is sponsored by