Blob Blame History Raw
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}

%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_with    python2
%bcond_without python3
%else
%bcond_without python2
%bcond_with    python3
%endif

%global pypi_name microversion_parse
%global pkg_name microversion-parse

Name:           python-%{pkg_name}
Version:        0.1.3
Release:        11%{?dist}
Summary:        OpenStack microversion header parser

License:        ASL 2.0
URL:            http://www.openstack.org/
Source0:        https://pypi.python.org/packages/source/m/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:      noarch


%description
A simple parser for OpenStack microversion headers

%if %{with python2}
%package -n     python2-%{pkg_name}
Summary:        OpenStack microversion header parser
%{?python_provide:%python_provide python2-%{pkg_name}}

BuildRequires:  python2-devel
BuildRequires:  python2-setuptools
BuildRequires:  python2-pbr
BuildRequires:  python2-sphinx
# Required for testing and documentation generation
BuildRequires:  python2-hacking
BuildRequires:  python2-coverage
BuildRequires:  python2-oslo-sphinx
BuildRequires:  python2-testrepository
BuildRequires:  python2-testtools
BuildRequires:  python2-webob

%description -n python2-%{pkg_name}
A simple parser for OpenStack microversion headers
%endif

%if %{with python3}
%package -n     python3-%{pkg_name}
Summary:        OpenStack microversion header parser
%{?python_provide:%python_provide python3-%{pkg_name}}

BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-pbr
BuildRequires:  python3-sphinx
# Required for testing and documentation generation
BuildRequires:  python3-hacking
BuildRequires:  python3-coverage
BuildRequires:  python3-oslo-sphinx
BuildRequires:  python3-testrepository
BuildRequires:  python3-testtools
BuildRequires:  python3-webob

%description -n python3-%{pkg_name}
A simple parser for OpenStack microversion headers
%endif

%package -n python-%{pkg_name}-doc
Summary:        microversion_parse documentation
%description -n python-%{pkg_name}-doc
Documentation for microversion_parse

%prep
%autosetup -n %{pypi_name}-%{version}

%build
%if %{with python2}
%py2_build
# generate html docs
sphinx-build doc/source html
%endif
%if %{with python3}
%py3_build
# generate html docs
sphinx-build doc/source html
%endif

# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
%if %{with python3}
%py3_install
%endif
%if %{with python2}
%py2_install
%endif

%check
%if %{with python3}
PYTHON=python3 %{__python3} setup.py test
rm -rf .testrepository
%endif
%if %{with python2}
PYTHON=python2 %{__python2} setup.py test
%endif

%if %{with python2}
%files -n python2-%{pkg_name}
%doc README.rst
%license LICENSE
%{python2_sitelib}/%{pypi_name}
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif

%if %{with python3}
%files -n python3-%{pkg_name}
%doc README.rst
%license LICENSE
%{python3_sitelib}/%{pypi_name}
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%endif

%files -n python-%{pkg_name}-doc
%doc html
%license LICENSE

%changelog
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.3-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Mon Oct 01 2018 Javier Peña <jpena@redhat.com> - 0.1.3-10
- Removed Python 2 package from Fedora 30+ (bz#1634562)

* Tue Aug 07 2018 Javier Peña <jpena@redhat.com> - 0.1.3-9
- Fixed rawhide build(bz#1605770)

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.1.3-7
- Rebuilt for Python 3.7

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

* Thu Jan 25 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.1.3-5
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.1.3-2
- Rebuild for Python 3.6

* Fri Apr 22 2016 jpena <jpena@redhat.com> - 0.1.3-1
- Initial package.