File python-rpy2.spec of Package python-rpy2

#
# spec file for package python-rpy2
#
# 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-%{**}}
%define         skip_python2 1
%bcond_with     test
Name:           python-rpy2
Version:        2.9.5
Release:        0
Summary:        A Python interface to the R Programming Language
License:        GPL-2.0-or-later
Group:          Development/Libraries/Python
Url:            https://bitbucket.org/rpy2/rpy2
Source:         https://files.pythonhosted.org/packages/source/r/rpy2/rpy2-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module numpy-devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  R-base >= 3.2
BuildRequires:  R-base-devel >= 3.2
BuildRequires:  fdupes
BuildRequires:  libbz2-devel
BuildRequires:  libicu-devel
BuildRequires:  pcre-devel
BuildRequires:  python-rpm-macros
BuildRequires:  readline-devel
BuildRequires:  texinfo
BuildRequires:  texlive-latex
BuildRequires:  xz-devel
BuildRequires:  zlib-devel
Requires:       R-base >= 2.12
Requires:       python-numpy
Requires:       readline

%python_subpackages

%description
RPy is a Python interface to the R Programming Language. It can
manage all kinds of R objects and can execute arbitrary R functions
(including the graphic functions). All errors from the R language are
converted to Python exceptions. Any module installed for the R system
can be used from Python.

This code is inspired by RSPython from the Omegahat project.

%prep
%setup -qn rpy2-%{version}
sed -i 's/\r$//' README.rst

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

%install
%python_install
%{python_expand chmod a+x %{buildroot}%{$python_sitearch}/rpy2/tests.py
sed -i "s|^#!/usr/bin/env python$|#!%__$python|" %{buildroot}%{$python_sitearch}/rpy2/tests.py
$python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/rpy2/
$python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/rpy2/
%fdupes %{buildroot}%{$python_sitearch}
}

%if %{with test}
%check
mkdir -p tester
pushd tester
%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch}
$python -B -m rpy2.tests
}
popd
%endif

%files %{python_files}
%defattr(-,root,root)
%doc AUTHORS NEWS README.rst
%license gpl-2.0.txt
%{python_sitearch}/rpy2/
%{python_sitearch}/rpy2-%{version}-py*.egg-info

%changelog
openSUSE Build Service is sponsored by