File python-pbr.spec of Package python-pbr
%global pypi_name pbr
%bcond_with python2
%bcond_with python3
%bcond_with test
Name: python-%{pypi_name}
Version: 4.2.0
Release: 1%{?dist}
Summary: Python Build Reasonableness
License: Apache-2.0
URL: https://docs.openstack.org/pbr/latest/
Source0: https://files.pythonhosted.org/packages/source/p/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Group: Development/Languages/Python
BuildArch: noarch
%description
PBR is a library that injects some useful and sensible default behaviors into
your setuptools run. It started off life as the chunks of code that were copied
between all of the OpenStack projects. Around the time that OpenStack hit 18
different projects each with at least 3 active branches, it seems like a good
time to make that code into a proper re-usable library.
%if %{with python2}
%package -n python2-%{pypi_name}
Summary: Python Build Reasonableness
BuildRequires: python2-devel
BuildRequires: python2-setuptools
Requires: python2-setuptools
%{?python_provide:%python_provide python2-%{pypi_name}}
%description -n python2-%{pypi_name}
Manage dynamic plugins for Python applications
%endif
%if %{with python3}
%package -n python%{python3_pkgversion}-%{pypi_name}
Summary: Python Build Reasonableness
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
Requires: python%{python3_pkgversion}-setuptools
%{?python_provide:%python_provide python%{python3_pkgversion}-%{pypi_name}}
%description -n python%{python3_pkgversion}-%{pypi_name}
Manage dynamic plugins for Python applications
%endif
%prep
%setup -q -n %{pypi_name}-%{version}
rm -rf {test-,}requirements.txt pbr.egg-info/requires.txt
%build
export SKIP_PIP_INSTALL=1
%if %{with python2}
%py2_build
%endif
%if %{with python3}
%py3_build
%endif
# generate html docs
# sphinx-build doc/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}
%install
# Must do the python3 install first because the scripts in /usr/bin are
# overwritten with every setup.py install (and we want the python2 version
# to be the default for now).
%if %{with python3}
%py3_install
mv %{buildroot}%{_bindir}/pbr %{buildroot}%{_bindir}/pbr-3
%endif
%if %{with python2}
%py2_install
%endif
rm -rf %{buildroot}%{python2_sitelib}/pbr/tests
%if %{with python2}
%files -n python2-%{pypi_name}
%license LICENSE
%doc README.rst
%{_bindir}/pbr
%{python2_sitelib}/*.egg-info
%{python2_sitelib}/%{pypi_name}
%endif
%if %{with python3}
%files -n python%{python3_pkgversion}-pbr
%license LICENSE
%doc README.rst
%{_bindir}/pbr-3
%{python3_sitelib}/*.egg-info
%{python3_sitelib}/%{pypi_name}
%endif
%changelog