Blob Blame Raw
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%if 0%{?fedora}
%global with_python3 1
%endif

%global modname cliff

Name:             python-%{modname}
Version:          2.9.1
Release:          3%{?dist}
Summary:          Command Line Interface Formulation Framework

Group:            Development/Libraries
License:          ASL 2.0
URL:              https://pypi.io/pypi/cliff
Source0:          https://pypi.io/packages/source/c/cliff/cliff-%{version}.tar.gz

BuildArch:        noarch

BuildRequires:    python2-devel
BuildRequires:    python2-setuptools
BuildRequires:    python2-pbr
BuildRequires:    python2-prettytable
BuildRequires:    python2-cmd2 >= 0.6.7
BuildRequires:    python2-stevedore
BuildRequires:    python2-six


%description
cliff is a framework for building command line programs. It uses setuptools
entry points to provide subcommands, output formatters, and other
extensions.

Documentation for cliff is hosted on readthedocs.org at
http://readthedocs.org/docs/cliff/en/latest/


%package -n python2-%{modname}
Summary:          Command Line Interface Formulation Framework
%{?python_provide:%python_provide python2-%{modname}}

Requires:         python2-prettytable
Requires:         python2-cmd2 >= 0.6.7
Requires:         python2-stevedore >= 1.20.0
Requires:         python2-six
Requires:         python2-unicodecsv
Requires:         python2-pyyaml

%if %{?rhel}%{!?rhel:0} == 6
BuildRequires:    python-argparse
Requires:         python-argparse
%endif

%description -n python2-%{modname}
cliff is a framework for building command line programs. It uses setuptools
entry points to provide subcommands, output formatters, and other
extensions.

Documentation for cliff is hosted on readthedocs.org at
http://readthedocs.org/docs/cliff/en/latest/

%package -n python2-%{modname}-tests
Summary:          Command Line Interface Formulation Framework
%{?python_provide:%python_provide python2-%{modname}-tests}

# Required for the test suite
BuildRequires:    python2-mock
BuildRequires:    bash
BuildRequires:    python2-unicodecsv
BuildRequires:    python2-pyyaml
BuildRequires:    which
BuildRequires:    python2-docutils
BuildRequires:    python2-subunit
BuildRequires:    python2-testrepository
BuildRequires:    python2-testscenarios
BuildRequires:    python2-testtools

Requires:         python2-%{modname} = %{version}-%{release}
Requires:         python2-mock
Requires:         bash
Requires:         python2-unicodecsv
Requires:         python2-pyyaml
Requires:         which
Requires:         python2-subunit
Requires:         python2-testrepository
Requires:         python2-testscenarios
Requires:         python2-testtools

%description -n python2-%{modname}-tests
This package contains tests for the python cliff library.

%if 0%{?with_python3}
%package -n python3-cliff
Summary:        Command Line Interface Formulation Framework
Group:          Development/Libraries
%{?python_provide:%python_provide python3-%{modname}}

BuildRequires:    python3-devel
BuildRequires:    python3-setuptools
BuildRequires:    python3-pbr
BuildRequires:    python3-prettytable
BuildRequires:    python3-cmd2 >= 0.6.7
BuildRequires:    python3-stevedore
BuildRequires:    python3-six
BuildRequires:    python3-PyYAML
BuildRequires:    python3-testtools

Requires:         python3-prettytable
Requires:         python3-cmd2 >= 0.6.7
Requires:         python3-stevedore >= 1.20.0
Requires:         python3-six
Requires:         python3-PyYAML

%description -n python3-cliff
cliff is a framework for building command line programs. It uses setuptools
entry points to provide subcommands, output formatters, and other
extensions.

Documentation for cliff is hosted on readthedocs.org at
http://readthedocs.org/docs/cliff/en/latest/

%package -n python3-%{modname}-tests
Summary:          Command Line Interface Formulation Framework
%{?python_provide:%python_provide python3-%{modname}-tests}

# Required for the test suite
BuildRequires:    bash
BuildRequires:    python3-unicodecsv
BuildRequires:    python3-PyYAML
BuildRequires:    which
BuildRequires:    python3-subunit
BuildRequires:    python3-testrepository
BuildRequires:    python3-testscenarios
BuildRequires:    python3-testtools

Requires:         python3-%{modname} = %{version}-%{release}
Requires:         bash
Requires:         python3-unicodecsv
Requires:         python3-PyYAML
Requires:         which
Requires:         python3-subunit
Requires:         python3-testrepository
Requires:         python3-testscenarios
Requires:         python3-testtools

%description -n python3-%{modname}-tests
This package contains tests for the python cliff library.
%endif

%prep
%setup -q -n %{modname}-%{upstream_version}
rm -rf {test-,}requirements.txt

# Remove bundled egg info
rm -rf *.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python2} setup.py build

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

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

%{__python2} setup.py install -O1 --skip-build --root=%{buildroot}

%check
%if 0%{?with_python3}
%{__python3} setup.py test
rm -rf .testrepository
%endif
%{__python2} setup.py test

%files -n python2-%{modname}
%license LICENSE
%doc doc/ README.rst ChangeLog AUTHORS CONTRIBUTING.rst
%{python2_sitelib}/%{modname}
%{python2_sitelib}/%{modname}-*.egg-info
%exclude %{python2_sitelib}/%{modname}/tests

%files -n python2-%{modname}-tests
%{python2_sitelib}/%{modname}/tests

%if 0%{?with_python3}
%files -n python3-%{modname}
%license LICENSE
%doc doc/ README.rst ChangeLog AUTHORS CONTRIBUTING.rst
%{python3_sitelib}/%{modname}
%{python3_sitelib}/%{modname}-*.egg-info
%exclude %{python3_sitelib}/%{modname}/tests

%files -n python3-%{modname}-tests
%{python3_sitelib}/%{modname}/tests
%endif

%changelog
* Fri Mar 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.9.1-3
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.9.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sun Oct 22 2017 Kevin Fenzi <kevin@scrye.com> - 2.9.1-1
- Update to 2.9.1. Fixes bug #1448974

* Mon Oct 16 2017 Petr Viktorin <pviktori@redhat.com> 3.8.0-2
- Use explicit Python version in "python2-cliff" package name

* Thu Aug 10 2017 Alfredo Moralejo <amoralej@redhat.com> 2.8.0-1
- Update to 2.8.0