5993f2b
%global srcname msrestazure
b0a29ae
%global common_description %{summary}.
b0a29ae
b0a29ae
%global _with_python2 0%{?rhel} || 0%{?fedora} <= 29
b0a29ae
%global py2_prefix %{?rhel:python}%{?fedora:python2}
b0a29ae
# Some Python 3 libraries required by msrestazure are not available in EL
b0a29ae
%global _with_python3 0%{?fedora}
b0a29ae
# Tests require a more recent version of requests library than the one available
b0a29ae
# in EL
b0a29ae
%global _with_tests 0%{?fedora}
b0a29ae
# EL is missing recommonmark library to build documentation
b0a29ae
%global _with_doc 0%{?fedora}
b0a29ae
%global pydoc_prefix %{?rhel:python}%{?fedora:python%{python3_pkgversion}}
b0a29ae
%global sphinxbuild sphinx-build%{?fedora:-%{python3_version}}
b0a29ae
b0a29ae
%global adal_min_version 0.6.0
b0a29ae
%global msrest_min_version 0.4.28
5993f2b
5993f2b
Name:           python-%{srcname}
b0a29ae
Version:        0.5.1
b0a29ae
Release:        2%{?dist}
b0a29ae
Summary:        The runtime library "msrestazure" for AutoRest generated Python clients
5993f2b
5993f2b
License:        MIT
b0a29ae
URL:            https://github.com/Azure/msrestazure-for-python
b0a29ae
Source0:        %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz
5993f2b
b0a29ae
%if 0%{?_with_python2}
b0a29ae
BuildRequires:  %{py2_prefix}-devel
bfc6bbb
BuildRequires:  %{py2_prefix}-setuptools
5993f2b
%if 0%{?_with_tests}
5993f2b
BuildRequires:  %{py2_prefix}-adal >= %{adal_min_version}
29cc308
BuildRequires:  %{py2_prefix}-mock
5993f2b
BuildRequires:  %{py2_prefix}-msrest >= %{msrest_min_version}
b0a29ae
BuildRequires:  %{?!rhel:%{py2_prefix}-}pytest
b0a29ae
%if 0%{?fedora} <= 27
b0a29ae
BuildRequires:  python-httpretty
b0a29ae
%else
b0a29ae
BuildRequires:  %{py2_prefix}-httpretty
b0a29ae
%endif
b0a29ae
%endif
b0a29ae
%endif
5993f2b
%if 0%{?_with_python3}
b0a29ae
BuildRequires:  python%{python3_pkgversion}-devel
b0a29ae
BuildRequires:  python%{python3_pkgversion}-setuptools
b0a29ae
%if 0%{?_with_tests}
b0a29ae
BuildRequires:  python%{python3_pkgversion}-adal >= %{adal_min_version}
b0a29ae
BuildRequires:  python%{python3_pkgversion}-httpretty
b0a29ae
BuildRequires:  python%{python3_pkgversion}-msrest >= %{msrest_min_version}
b0a29ae
BuildRequires:  python%{python3_pkgversion}-pytest
b0a29ae
%endif
5993f2b
%endif
b0a29ae
%if 0%{?_with_doc}
b0a29ae
BuildRequires:  %{pydoc_prefix}-pip
b0a29ae
BuildRequires:  %{pydoc_prefix}-recommonmark
b0a29ae
BuildRequires:  %{pydoc_prefix}-sphinx
b0a29ae
BuildRequires:  %{pydoc_prefix}-sphinx_rtd_theme
5993f2b
%endif
5993f2b
BuildArch:      noarch
5993f2b
5993f2b
%description
5993f2b
%{common_description}
5993f2b
5993f2b
b0a29ae
%if 0%{?_with_python2}
5993f2b
%package -n python2-%{srcname}
b0a29ae
Summary:        %{summary}
5993f2b
Requires:       %{py2_prefix}-adal >= %{adal_min_version}
5993f2b
Requires:       %{py2_prefix}-msrest >= %{msrest_min_version}
5993f2b
%{?python_provide:%python_provide python2-%{srcname}}
5993f2b
5993f2b
%description -n python2-%{srcname}
5993f2b
%{common_description}
b0a29ae
%endif
5993f2b
5993f2b
5993f2b
%if 0%{?_with_python3}
b0a29ae
%package -n python%{python3_pkgversion}-%{srcname}
b0a29ae
Summary:        %{summary}
b0a29ae
Requires:       python%{python3_pkgversion}-adal >= %{adal_min_version}
b0a29ae
Requires:       python%{python3_pkgversion}-msrest >= %{msrest_min_version}
b0a29ae
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
b0a29ae
b0a29ae
%description -n python%{python3_pkgversion}-%{srcname}
5993f2b
%{common_description}
5993f2b
%endif
5993f2b
5993f2b
b0a29ae
%if 0%{?_with_doc}
b0a29ae
%package doc
b0a29ae
Summary:        Documentation for %{name}
b0a29ae
b0a29ae
%description doc
b0a29ae
This package provides documentation for %{name}.
b0a29ae
%endif
b0a29ae
b0a29ae
5993f2b
%prep
5993f2b
%autosetup -n %{srcname}-for-python-%{version}
5993f2b
5993f2b
5993f2b
%build
b0a29ae
%if 0%{?_with_python2}
5993f2b
%py2_build
b0a29ae
%endif
b0a29ae
%if 0%{?_with_python3}
b0a29ae
%py3_build
b0a29ae
%endif
b0a29ae
b0a29ae
%if 0%{?_with_doc}
b0a29ae
pushd doc/
b0a29ae
%{sphinxbuild} -b html -d _build/doctrees/ . _build/html/
b0a29ae
rm _build/html/.buildinfo
b0a29ae
popd
b0a29ae
%endif
5993f2b
5993f2b
5993f2b
%install
b0a29ae
%if 0%{?_with_python2}
5993f2b
%py2_install
b0a29ae
%endif
b0a29ae
%if 0%{?_with_python3}
b0a29ae
%py3_install
b0a29ae
%endif
5993f2b
5993f2b
5993f2b
%check
b0a29ae
%if 0%{_with_tests}
b0a29ae
%if 0%{?_with_python2}
b0a29ae
py.test-%{python2_version}
b0a29ae
%endif
b0a29ae
%if 0%{?_with_python3}
b0a29ae
py.test-%{python3_version}
b0a29ae
%endif
5993f2b
%endif
5993f2b
5993f2b
b0a29ae
%if 0%{?_with_python2}
5993f2b
%files -n python2-%{srcname}
5993f2b
%doc README.rst
5993f2b
%license LICENSE.md
b0a29ae
%{python2_sitelib}/%{srcname}/
b0a29ae
%{python2_sitelib}/%{srcname}-*.egg-info/
b0a29ae
%endif
5993f2b
5993f2b
5993f2b
%if 0%{?_with_python3}
b0a29ae
%files -n python%{python3_pkgversion}-%{srcname}
5993f2b
%doc README.rst
5993f2b
%license LICENSE.md
b0a29ae
%{python3_sitelib}/%{srcname}/
b0a29ae
%{python3_sitelib}/%{srcname}-*.egg-info/
5993f2b
%endif
5993f2b
5993f2b
b0a29ae
%if 0%{?_with_doc}
b0a29ae
%files doc
b0a29ae
%doc doc/_build/html/
b0a29ae
%license LICENSE.md
b0a29ae
%endif
5993f2b
5993f2b
b0a29ae
%changelog
b0a29ae
* Tue Nov 13 2018 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.5.1-2
b0a29ae
- Rebuild for python-msrest dependency fix update
5993f2b
b0a29ae
* Sun Nov 11 2018 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.5.1-1
b0a29ae
- Update to 0.5.1
b0a29ae
- Build documentation