File python-cliff.spec of Package python-cliff

#
# spec file for package python
#
# Copyright (c) 2019 SUSE LLC.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -%{flavor}
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%bcond_without python2
Name:           python-cliff%{psuffix}
Version:        2.16.0
Release:        0
Summary:        Command Line Interface Formulation Framework
License:        Apache-2.0
Group:          Development/Languages/Python
URL:            https://launchpad.net/python-cliff
Source0:        https://files.pythonhosted.org/packages/source/c/cliff/cliff-2.16.0.tar.gz
# PATCH-FIX-UPSTREAM lp#1774418 mcepl@suse.com
# this patch makes things totally awesome
Patch0:         0001-fixed-FrozenAttributesError-in-cliff-Interactive.py.patch
BuildRequires:  %{python_module attrs}
BuildRequires:  %{python_module cmd2}
BuildRequires:  %{python_module colorama}
BuildRequires:  %{python_module pbr}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module stevedore}
%if %{with test}
BuildRequires:  %{python_module PrettyTable}
BuildRequires:  %{python_module PyYAML}
BuildRequires:  %{python_module cliff >= %{version}}
BuildRequires:  %{python_module cryptography}
BuildRequires:  %{python_module docutils}
BuildRequires:  %{python_module mock}
BuildRequires:  %{python_module python-subunit}
BuildRequires:  %{python_module stestr}
BuildRequires:  %{python_module testscenarios}
BuildRequires:  %{python_module testtools}
%endif
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
%if %{with python2}
BuildRequires:  python2-unicodecsv
%endif
# documentation requirements
BuildRequires:  python3-Sphinx
BuildRequires:  python3-openstackdocstheme
Requires:       python-PrettyTable
Requires:       python-PyYAML
Requires:       python-cmd2
Requires:       python-pyparsing
Requires:       python-six
Requires:       python-stevedore
BuildArch:      noarch
%ifpython2
Requires:       python-unicodecsv
%endif
%python_subpackages

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

%package -n %{name}-doc
Summary:        %{summary} - Documentation
Group:          Documentation/HTML
Provides:       %{python_module cliff-doc = %{version}}

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

This package contains documentation files for %{name}.

%prep
%autosetup -p1 -n cliff-2.16.0

%build
%python_build
PBR_VERSION=2.16.0 PYTHONPATH=. sphinx-build -b html doc/source doc/build/html
rm -rf doc/build/html/.{doctrees,buildinfo}

%if ! %{with test}
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%fdupes %{buildroot}%{_defaultdocdir}/python-cliff-doc/html/
%endif

%if %{with test}
%check
%python_exec -m stestr.cli run
%endif

%if ! %{with test}
%files %{python_files}
%license LICENSE
%doc ChangeLog README.rst
%{python_sitelib}/cliff
%{python_sitelib}/*.egg-info

%files -n %{name}-doc
%license LICENSE
%doc doc/build/html
%endif

%changelog
openSUSE Build Service is sponsored by