%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%if 0%{?fedora}
%global with_python3 1
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif
%global pkgname remoto
Name: python-%{pkgname}
Version: 0.0.25
Release: 1%{?dist}
Summary: Execute remote commands or processes
Group: Development/Languages
License: MIT
URL: https://github.com/alfredodeza/remoto
Source0: https://pypi.python.org/packages/source/r/%{pkgname}/%{pkgname}-%{version}.tar.gz
BuildArch: noarch
BuildRequires: pytest
BuildRequires: python2-devel
BuildRequires: python-execnet >= 1.2.0
BuildRequires: python-mock
BuildRequires: python-setuptools
%if 0%{?with_python3}
BuildRequires: python3-devel
BuildRequires: python3-pytest
BuildRequires: python3-execnet >= 1.2.0
BuildRequires: python3-mock
BuildRequires: python3-setuptools
%endif # with_python3
Requires: python-execnet >= 1.2.0
%description
Execute remote commands or processes.
%if 0%{?with_python3}
%package -n python3-remoto
Summary: Execute remote commands or processes
Group: Development/Languages
Requires: python3
Requires: python3-execnet >= 1.2.0
%description -n python3-remoto
Execute remote commands or processes.
%endif # with_python3
%prep
%setup -q -n %{pkgname}-%{version}
# https://github.com/alfredodeza/remoto/issues/17
find . -name '*.pyc' -print0 | xargs -0 rm
%if 0%{?with_python3}
cp -a . %{py3dir}
%endif # with_python3
%build
REMOTO_NO_VENDOR=1 %{__python2} setup.py build
%if 0%{?with_python3}
pushd %{py3dir}
REMOTO_NO_VENDOR=1 %{__python3} setup.py build
popd
%endif # with_python3
%install
REMOTO_NO_VENDOR=1 %{__python2} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
%if 0%{?with_python3}
pushd %{py3dir}
REMOTO_NO_VENDOR=1 %{__python3} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
popd
%endif # with_python3
%check
export REMOTO_NO_VENDOR=1
export PYTHONPATH=$(pwd)
py.test-%{python_version} -v remoto/tests
%if 0%{?with_python3}
pushd %{py3dir}
py.test-%{python3_version} -v remoto/tests
popd
%endif # with_python3
%files
%doc LICENSE README.rst
%{python2_sitelib}/*
%if 0%{?with_python3}
%files -n python3-remoto
%{python3_sitelib}/*
%doc LICENSE README.rst
%endif # with_python3
%changelog
* Tue Apr 21 2015 Ken Dreyer <ktdreyer@ktdreyer.com> - 0.0.25-1
- Update to remoto-0.0.25
- rm python3_version compat macro; this has been defined since F13
- Remove pre-existing .pyc files during %%prep
* Mon Jan 05 2015 Ken Dreyer <ktdreyer@ktdreyer.com> - 0.0.24-1
- Update to remoto-0.0.24
- Add Group tag
- Enable tests during %%check (RHBZ #1178930)
- Add python3 subpackage
* Fri Dec 12 2014 Ken Dreyer <kdreyer@redhat.com> - 0.0.23-1
- Update to remoto-0.0.23 (RHBZ #1146478)
- Use pypi URL for Source0 (requires LICENSE file to be shipped separately)
- Use HTTPS for homepage
* Fri Sep 12 2014 Federico Simoncelli <fsimonce@redhat.com> 0.0.21-1
- update remoto-0.0.21
* Fri Aug 1 2014 Federico Simoncelli <fsimonce@redhat.com> 0.0.19-1
- update to remoto-0.0.19
* Fri Jun 27 2014 Federico Simoncelli <fsimonce@redhat.com> 0.0.17-2
- specfile cleanups
* Sun Jun 22 2014 Federico Simoncelli <fsimonce@redhat.com> 0.0.17-1
- initial build