Blob Blame History Raw
%global srcname f5-icontrol-rest
%global sum F5 BIG-IP iControl REST API client

%if 0%{?fedora} <= 29 && 0%{?rhel} <= 7
%bcond_without python2
%endif
%if 0%{?fedora} || 0%{?rhel} > 7
%bcond_without python3
%endif

Name:           python-%{srcname}
Version:        1.3.13
Release:        1%{?dist}
Summary:        %{sum}

License:        ASL 2.0
URL:            https://pypi.python.org/pypi/%{srcname}
Source0:        https://github.com/F5Networks/%{srcname}/archive/%{version}/%{srcname}-%{version}.tar.gz

BuildArch:      noarch
%if 0%{?with_python2}
BuildRequires:  python2-devel
%if 0%{?el6}%{?el7}
BuildRequires:  python-setuptools
BuildRequires:  python-requests >= 2.5.0
BuildRequires:  python-urllib3
%else
BuildRequires:  python2-setuptools
BuildRequires:  python2-requests >= 2.5.0
BuildRequires:  python2-urllib3
%endif
# doc
BuildRequires:  python2-sphinx
%if 0%{?fedora} || 0%{?rhel} > 6
BuildRequires:  python2-sphinx_rtd_theme
%else
BuildRequires:  python-sphinx_rtd_theme
%endif
# tests
BuildRequires:  python2-pytest
%{!?el6:BuildRequires:  python2-pytest-cov}
# Not packaged yet...
#BuildRequires:  python2-pytest-symbols
%if 0%{?el6}%{?el7}
# Missing on EL6/EL7
#BuildRequires:  python2-coveralls
BuildRequires:  python-flake8
%{?el6:BuildRequires:  python-mccabe}
%{?el7:BuildRequires:  python2-mccabe}
BuildRequires:  python2-mock
BuildRequires:  python-pep8
BuildRequires:  pyflakes
# Missing on EL6/EL7
#BuildRequires:  python-requests-mock
%else
BuildRequires:  python2-coveralls
BuildRequires:  python2-flake8
BuildRequires:  python2-mccabe
BuildRequires:  python2-mock
BuildRequires:  python2-pep8
BuildRequires:  python2-pyflakes
BuildRequires:  python2-requests-mock
%endif
%endif

%if 0%{?with_python3}
BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  python%{python3_pkgversion}-requests >= 2.5.0
BuildRequires:  python%{python3_pkgversion}-urllib3
# doc
BuildRequires:  python%{python3_pkgversion}-sphinx
BuildRequires:  python%{python3_pkgversion}-sphinx_rtd_theme
# tests
BuildRequires:  python%{python3_pkgversion}-coveralls
BuildRequires:  python%{python3_pkgversion}-flake8
BuildRequires:  python%{python3_pkgversion}-mccabe
BuildRequires:  python%{python3_pkgversion}-mock
BuildRequires:  python%{python3_pkgversion}-pep8
BuildRequires:  python%{python3_pkgversion}-pyflakes
BuildRequires:  python%{python3_pkgversion}-pytest
BuildRequires:  python%{python3_pkgversion}-pytest-cov
# Not packaged yet...
#BuildRequires:  python%{python3_pkgversion}-pytest-symbols
BuildRequires:  python%{python3_pkgversion}-requests-mock
%endif


%description
Generic python library used by the F5 SDK and other F5 projects to communicate
with BIG-IP® via the REST API.

%if 0%{?with_python2}
%package -n python2-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{srcname}}
Requires:       python2-requests >= 2.5.0

%description -n python2-%{srcname}
Generic python library used by the F5 SDK and other F5 projects to communicate
with BIG-IP® via the REST API.
%endif

%if 0%{?with_python3}
%package -n python%{python3_pkgversion}-%{srcname}
Summary:        %{sum}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
Requires:       python%{python3_pkgversion}-requests >= 2.5.0

%description -n python%{python3_pkgversion}-%{srcname}
Generic python library used by the F5 SDK and other F5 projects to communicate
with BIG-IP® via the REST API.
%endif


%prep
%autosetup -n %{srcname}-python-%{version}
# Remove functional tests, they need a real BIG-IP
rm -rf icontrol/test/functional


%build
%if 0%{?with_python2}
%py2_build
%endif
%if 0%{?with_python3}
%py3_build
%{__python3} setup.py build_sphinx
rm build/sphinx/html/.buildinfo
%endif


%install
%if 0%{?with_python2}
%py2_install
%endif
%if 0%{?with_python3}
%py3_install
%endif


%check
%if 0%{?with_python2}
%{__python2} setup.py test
%endif
%if 0%{?with_python3}
%{__python3} setup.py test
%endif


%if 0%{?with_python2}
%files -n python2-%{srcname}
%license LICENSE
%doc CONTRIBUTING.md README.rst SUPPORT.md
%if ! 0%{?el6}%{?el7}
%doc build/sphinx/html/
%endif
%{python2_sitelib}/*
%endif

%if 0%{?with_python3}
%files -n python%{python3_pkgversion}-%{srcname}
%license LICENSE
%doc CONTRIBUTING.md README.rst SUPPORT.md
%doc build/sphinx/html/
%{python3_sitelib}/*
%endif


%changelog
* Fri Apr 19 2019 Xavier Bachelot <xavier@bachelot.org> - 1.3.13-1
- Update to 1.3.13.
- Prepare for python3 build in EPEL.

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.11-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Wed Oct 03 2018 Xavier Bachelot <xavier@bachelot.org> - 1.3.11-1
- Update to 1.3.11.
- Don't build python2 sub-package for Fedora 30+ and EL8 (RHBZ#1635602).

* Thu Jul 26 2018 Xavier Bachelot <xavier@bachelot.org> - 1.3.10-1
- Update to 1.3.10.

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

* Fri Jul 06 2018 Xavier Bachelot <xavier@bachelot.org> - 1.3.9-3
- Add missing Requires:.

* Mon Jul 02 2018 Miro Hrončok <mhroncok@redhat.com> - 1.3.9-2
- Rebuilt for Python 3.7

* Fri Jun 29 2018 Xavier Bachelot <xavier@bachelot.org> - 1.3.9-1
- Update to 1.3.9.

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

* Mon May 07 2018 Miro Hrončok <mhroncok@redhat.com> - 1.3.6-4
- Remove unused tox dependency

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

* Wed Feb 21 2018 Xavier Bachelot <xavier@bachelot.org> - 1.3.6-2
- Fix doc.
- Tidy up BR:s for EL6 and EL7.

* Wed Feb 21 2018 Xavier Bachelot <xavier@bachelot.org> - 1.3.6-1
- Update to 1.3.6.

* Mon Dec 18 2017 Xavier Bachelot <xavier@bachelot.org> - 1.3.4-2
- Use tarball from github rather than pypy.
- Fix typo in BuildRequires.
- Add BR: for building docs and running tests.

* Wed Dec 13 2017 Xavier Bachelot <xavier@bachelot.org> - 1.3.4-1
- Initial package.