Blob Blame History Raw
%if 0%{?fedora} > 12
%global with_python3 1
%endif

%global pypi_name xvfbwrapper

Name:           python-%{pypi_name}
Version:        0.2.4
Release:        2%{?dist}
Summary:        run headless display inside X virtual framebuffer (Xvfb)

License:        MIT
URL:            https://github.com/cgoldberg/xvfbwrapper
Source0:        https://pypi.python.org/packages/source/x/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python2-devel

# required for tests:
BuildRequires:  python-nose
BuildRequires:  xorg-x11-server-Xvfb

Requires:  xorg-x11-server-Xvfb

Provides:  python2-%{pypi_name} = %{version}-%{release}

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        run headless display inside X virtual framebuffer (Xvfb)

BuildRequires: python3-devel
BuildRequires: python3-nose

%description -n python3-%{pypi_name}
Python wrapper for running a display inside X virtual framebuffer (Xvfb)
%endif

%description
Python wrapper for running a display inside X virtual framebuffer (Xvfb)

%prep
%setup -qc
mv %{pypi_name}-%{version} python2
pushd python2

cp -a README.rst ..

# remove shebang
sed -i '1{\@^#!/usr/bin/env python@d}' xvfbwrapper.py

popd

%if 0%{?with_python3}
cp -a python2 python3
%endif



%build
pushd python2
%{__python2} setup.py build
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py build
popd
%endif

%install
pushd python2
%{__python2} setup.py install --skip-build --root %{buildroot}
popd

%if 0%{?with_python3}
pushd python3
%{__python3} setup.py install --skip-build --root %{buildroot}
popd
%endif

%check
export DISPLAY=:0.0
nosetests-%{python_version}


%if 0%{?with_python3}
nosetests-%{python3_version}
%endif

%files
%doc README.rst
%license

%{python2_sitelib}/%{pypi_name}.py*
%{python2_sitelib}/%{pypi_name}-%{version}-py%{python_version}.egg-info

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%{python3_sitelib}/%{pypi_name}.py*
%{python3_sitelib}/__pycache__/%{pypi_name}.*
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%endif # with_python3

%changelog
* Tue Jul 21 2015 Matthias Runge <mrunge@redhat.com> - 0.2.4-2
- add py3 subpackage (rhbz#1244817)

* Mon Jul 20 2015 Matthias Runge <mrunge@redhat.com> - 0.2.4-1
- Initial package.