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)

# Common info
Name:          python-%{realname}
Version:       2.0.0
Release:       %{?extraver:0.}1%{?dist}
License:       MIT
Group:         Development/Languages/Python
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
BuildRequires: python-setuptools
BuildRequires: python-py >= 1.4.17
BuildRequires: python-Sphinx
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}

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)
%setup -q -n %{realname}-%{version}%{?extraver}

python build
make -C doc man

export PATH=/usr/bin:/bin:/usr/sbin:/sbin
python 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

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

%doc %{_mandir}/man1/tox.1*