File python-scipy.spec of Package python-scipy

#
# spec file for package python-scipy
#
# Copyright (c) 2018 SUSE LINUX 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-%{**}}
%if 0%{?is_opensuse} == 0
  %bcond_with openblas
%else
  %ifarch armv6l s390 s390x m68k riscv64
    %bcond_with openblas
  %else
    %if 0%{?sle_version} == 120200
      %ifarch i586
        %bcond_with openblas
      %else
        %bcond_without openblas
      %endif
    %else
      %bcond_without openblas
    %endif
  %endif
%endif
%if 0%{?is_opensuse} == 0
  %bcond_with suitesparse
%else
  %bcond_without suitesparse
%endif
Name:           python-scipy
Version:        1.1.0
Release:        0
Summary:        Scientific Tools for Python
License:        BSD-3-Clause AND LGPL-2.0-or-later
Group:          Development/Libraries/Python
Url:            http://www.scipy.org
Source0:        https://files.pythonhosted.org/packages/source/s/scipy/scipy-%{version}.tar.gz
Source100:      python-scipy-rpmlintrc
# PATCH-FIX-OPENSUSE - no_implicit_decl.patch - Fix implicit-pointer-decl warnings and implicit-fortify-decl error
Patch0:         no_implicit_decl.patch
BuildRequires:  %{python_module Cython >= 0.19}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module numpy-devel >= 1.5.1}
BuildRequires:  %{python_module setuptools}
BuildRequires:  blas-devel
BuildRequires:  fdupes
BuildRequires:  fftw-devel
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  lapack-devel
BuildRequires:  lapacke-devel
BuildRequires:  python-rpm-macros
BuildRequires:  swig
Requires:       python-numpy >= 1.5.1
%if %{with suitesparse}
BuildRequires:  suitesparse-devel-static
%endif
%if %{with openblas}
BuildRequires:  openblas-devel
%endif
%python_subpackages

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

%prep
%setup -q -n scipy-%{version}
%patch0 -p1
find . -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python||" {} \;

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

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

%build
export CFLAGS="%{optflags} -fno-strict-aliasing"
export FFTW=%{_libdir}
export BLAS=%{_libdir}
export LAPACK=%{_libdir}
%if %{with openblas}
export OPENBLAS=%{_libdir}
%endif
%python_exec setup.py config_fc --fcompiler=gnu95 --noarch build

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

%files %{python_files}
%license LICENSE.txt
%{python_sitearch}/scipy/
%{python_sitearch}/scipy-*-py*.egg-info

%changelog
openSUSE Build Service is sponsored by