File python-tox.spec of Package python-tox

%define realname tox
%define srcext   tar.bz2

%if ! 0%{?py_ver:1}
%define py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
%endif

# Common info
Name:          python-%{realname}
Version:       2.0.0
Release:       %{?extraver:0.}1%{?dist}
License:       MIT
Group:         Development/Languages/Python
URL:           http://tox.testrun.org/
Summary:       Virtualenv-based automation of test activities

# Install-time parameters
Requires:      python%{?suse_version:-base}
Requires:      python-virtualenv >= 1.11.2
Requires:      python-argparse
Requires:      python-pluggy >= 0.3.0 python-pluggy < 0.4.0
Requires:      python-py >= 1.4.17

# Build-time parameters
%if ! 0%{?sles_version}
BuildArch:     noarch
%endif
BuildRequires: python-setuptools
BuildRequires: python-py >= 1.4.17
BuildRequires: python-Sphinx
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

%description
Tox is a generic virtualenv management and test command line tool you can
use for:

  * checking your package installs correctly with different Python versions
    and interpreters
  * running your tests in each of the environments, configuring your test tool
    of choice
  * acting as a frontend to Continuous Integration servers, greatly reducing
    boilerplate and merging CI and shell-based testing.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}

%build
python setup.py build
make -C doc man

%install
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
python setup.py install --prefix=%{_prefix} --root=%{buildroot} -O2
[ "%{buildroot}" != "/" ] && find %{buildroot}%{python_sitelib}/%{realname}/ -name "*.pyo" -delete
%{__install} -D -m0644 doc/_build/man/tox.1 %{buildroot}%{_mandir}/man1/tox.1

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CONTRIBUTORS LICENSE README.rst
%{_bindir}/tox*
%{python_sitelib}/%{realname}/
%{python_sitelib}/%{realname}-%{version}-py%{py_ver}.egg-info/
%doc %{_mandir}/man1/tox.1*

%changelog