File python-mpi4py.spec of Package python-mpi4py

#
# spec file for package python-mpi4py
#
# Copyright (c) 2017 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-%{**}}
Name:           python-mpi4py
Version:        2.0.0
Release:        0
Summary:        MPI for Python
License:        BSD-2-Clause
Group:          Development/Libraries/Python
Url:            https://bitbucket.org/mpi4py/mpi4py
Source:         https://files.pythonhosted.org/packages/source/m/mpi4py/mpi4py-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  openmpi-devel
Requires:       openmpi
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%python_subpackages

%description
This package provides Message Passing Interface support for Python scripting in parallel
environments. It is constructed on top of the MPI-1/MPI-2
specification, but provides an object-oriented interface which closely
follows the MPI-2 C++ bindings.

This module supports point-to-point (send, receive) and collective
(broadcast, scatter, gather, reduction) communications of any
*picklable* Python object.

For objects exporting single-segment buffer interface (strings, NumPy
arrays, etc.), blocking/nonbloking/persistent point-to-point,
collective and one-sided (put, get, accumulate) communications are
fully supported, as well as parallel I/O (blocking and nonbloking,
collective and non-collective read and write operations using explicit
file offsets, individual file pointers and shared file
pointers).

There is also full support for group and communicator (inter, intra,
Cartesian and graph topologies) creation and management, as well as
creating user-defined datatypes. Additionally, there is almost
complete support for dynamic process creation and management (spawn,
name publishing).

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/Python
Requires:       %{name} = %{version}
Requires:       %{name}-common-devel = %{version}
Requires:       python-devel

%description devel
Development libraries and headers needed to build packages using %{name}.

%package -n %{name}-common-devel
Summary:        Shared development files for %{name}
Group:          Development/Libraries/Python
Provides:       %{python_module mpi4py-common-devel = %{version}}
Requires:       openmpi-devel

%description -n %{name}-common-devel
Development libraries and headers needed to build packages using %{name}
for both python2 and python3.

You normally do not need to install this directly, it will be pulled in by
the python-specific devel package.

%package -n %{name}-doc
Summary:        Documentation for %{name}
Group:          Documentation/Other
Provides:       %{python_module mpi4py-doc = %{version}}

%description -n %{name}-doc
Documentation files and demos for %{name}.

%prep
%setup -q -n mpi4py-%{version}

%build
export CFLAGS="%{optflags}"
%python_build

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

# De-duplicate includes and also put them in a more generally-accessible location.
mkdir -p %{buildroot}/%{_includedir}
%python_expand cp -r %{buildroot}%{$python_sitearch}/mpi4py/include/mpi4py %{buildroot}/%{_includedir}/
%python_expand rm -r %{buildroot}%{$python_sitearch}/mpi4py/include/mpi4py
%python_expand ln -s %{_includedir}/mpi4py %{buildroot}%{$python_sitearch}/mpi4py/include/mpi4py

%files %{python_files}
%defattr(-,root,root)
%doc CHANGES.rst DESCRIPTION.rst README.rst LICENSE.rst
%{python_sitearch}/mpi4py
%{python_sitearch}/mpi4py-%{version}-py*.egg-info
%exclude %{python_sitearch}/mpi4py/include/

%files %{python_files devel}
%defattr(-,root,root)
%doc LICENSE.rst
%dir %{python_sitearch}/mpi4py/include/
%{python_sitearch}/mpi4py/include/mpi4py

%files -n %{name}-common-devel
%defattr(-,root,root)
%doc LICENSE.rst
%dir %{_includedir}/mpi4py/
%{_includedir}/mpi4py/*.h
%{_includedir}/mpi4py/*.i
%{_includedir}/mpi4py/*.pxd
%{_includedir}/mpi4py/*.pxi
%{_includedir}/mpi4py/*.pyx

%files -n %{name}-doc
%defattr(-,root,root)
%doc LICENSE.rst
%doc docs/
%doc demo/

%changelog
openSUSE Build Service is sponsored by