File python-petsc4py.spec of Package python-petsc4py
#
# spec file for package python-petsc4py
#
# 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/
#
%define petsc_arch linux-gnu-c-opt
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-petsc4py
Version: 3.18.5
Release: 0
Summary: Python bindings for PETSc
License: BSD-2-Clause
Group: Development/Languages/Python
Url: http://jinja.pocoo.org/
Source: https://files.pythonhosted.org/packages/source/p/petsc4py/petsc4py-%{version}.tar.gz
Source1: %{name}-rpmlintrc
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: petsc-devel >= 3.7
BuildRequires: petsc-openmpi4-devel >= 3.7
BuildRequires: python-rpm-macros
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy-devel}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module Cython}
Requires: libpetsc3 >= 3.7
Requires: python-numpy
%python_subpackages
%description
petsc4py are Python bindings for PETSc, the Portable, Extensible Toolkit for Scientific Computation.
%package openmpi4
Summary: Python bindings for PETSc - openmpi enabled
Group: Development/Languages/Python
Requires: libpetsc3-openmpi4 >= 3.7
Requires: python-mpi4py
Requires: python-numpy
Provides: %{name}-openmpi = %{version}
%description openmpi4
petsc4py are Python bindings for PETSc, the Portable, Extensible Toolkit for Scientific Computation.
This is the openmpi enabled version
%prep
%setup -q -n petsc4py-%{version}
set -- *
mkdir serial
cp -a "$@" serial
mpi=openmpi4
mkdir $mpi
cp -a "$@" $mpi
%build
export PETSC_VERSION=$(rpm -q --queryformat '%%{version}' petsc-devel)
pushd serial
export PETSC_DIR=%{_libdir}/petsc/${PETSC_VERSION}/%{petsc_arch}
%python_build
popd
mpi=openmpi4
pushd $mpi
export PETSC_DIR=%{_libdir}/mpi/gcc/$mpi/%_lib/petsc/${PETSC_VERSION}/%{petsc_arch}
%python_build
popd
%install
export PETSC_VERSION=$(rpm -q --queryformat '%%{version}' petsc-devel)
pushd serial
export PETSC_DIR=%{_libdir}/petsc/${PETSC_VERSION}/%{petsc_arch}
%python_install
popd
mpi=openmpi4
pushd $mpi
export PETSC_DIR=%{_libdir}/mpi/gcc/$mpi/%_lib/petsc/${PETSC_VERSION}/%{petsc_arch}
%python_exec setup.py install --prefix=%{_libdir}/mpi/gcc/$mpi --root=%{buildroot}
popd
%python_expand %fdupes -s %{buildroot}%{$python_sitearch}
%python_expand %fdupes -s %{buildroot}%{_libdir}/mpi/gcc/openmpi4/%_lib/python%{$python_bin_suffix}
%files %{python_files}
%defattr(-,root,root,-)
%doc CHANGES.rst LICENSE.rst DESCRIPTION.rst README.rst
%{python_sitearch}/*
%files %{python_files openmpi4 }
%defattr(-,root,root,-)
%doc CHANGES.rst LICENSE.rst DESCRIPTION.rst README.rst
%dir %{_libdir}/mpi/gcc/openmpi4/%_lib/python%{python_bin_suffix}
%dir %{_libdir}/mpi/gcc/openmpi4/%_lib/python%{python_bin_suffix}/site-packages
%{_libdir}/mpi/gcc/openmpi4/%_lib/python%{python_bin_suffix}/site-packages/*
%changelog