File python-stevedore.spec of Package python-stevedore
%global pypi_name stevedore
%bcond_with python2
%bcond_with python3
%bcond_with test
%bcond_with docs
%global common_desc \
Python makes loading code dynamically easy, allowing you to configure \
and extend your application by discovering and loading extensions \
(plugins) at runtime. Many applications implement their own \
library for doing this, using ``__import__`` or ``importlib``. \
stevedore avoids creating yet another extension \
mechanism by building on top of setuptools entry points. The code \
for managing entry points tends to be repetitive, though, so stevedore \
provides manager classes for implementing common patterns for using \
dynamically loaded extensions.
Name: python-%{pypi_name}
Version: 3.2.0
Release: 1%{?dist}
Summary: Manage dynamic plugins for Python applications
License: Apache-2.0
URL: https://docs.openstack.org/stevedore/latest/
Source0: https://files.pythonhosted.org/packages/source/s/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch: noarch
%description
%{common_desc}
%if %{with python2}
%package -n python2-%{pypi_name}
Summary: %{summary}
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-pbr >= 2.0.0
BuildRequires: python2-six
%if %{with test}
BuildRequires: python2-bandit
BuildRequires: python2-coverage
BuildRequires: python2-mock
BuildRequires: python2-stestr >= 1.10.0
%endif # with test
Requires: python2-pbr >= 2.0.0
Requires: python2-setuptools
Requires: python2-six
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
%{common_desc}
%endif # with python2
%if %{with python3}
%package -n python3-%{pypi_name}
Summary: %{summary}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pbr
Requires: python3-pbr
%if %{with test}
BuildRequires: python3-bandit
BuildRequires: python3-coverage
BuildRequires: python3-mock
BuildRequires: python3-stestr
%endif # with test
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{common_desc}
%endif # with python3
%if %{with docs}
%package -n python-%{pypi_name}-doc
Summary: %{summary} documentation
%description -n python-%{pypi_name}-doc
Documentation for %{pypi_name}
%endif # with docs
%prep
%autosetup -n %{pypi_name}-%{version}
# Remove bundled egg-info
rm -rf %{pypi_name}.egg-info
%build
%if %{with python2}
%py2_build
%endif # python2
%if %{with python3}
%py3_build
%endif # python3
%if %{with docs}
# generate html docs
PYTHONPATH=${PWD} sphinx-build-3 doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%endif # with docs
%install
# Must do the default python version install last because
# the scripts in /usr/bin are overwritten with every setup.py install.
%if %{with python2}
%py2_install
%endif # python2
%if %{with python3}
%py3_install
%endif # python3
%check
%if %{with test}
%if %{with python2}
%{__python2} setup.py test
%endif - with python2
%if %{with python3}
%{__python3} setup.py test
%endif with python3
%endif # with test
%if %{with python2}
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with python2
%if %{with python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif # with python3
%if %{with docs}
%files -n python-%{pypi_name}-doc
%doc html
%license LICENSE
%endif # with docs
%changelog