%global alt_name azure-activedirectory-library-for-python
%global python_module adal
%global common_summary ADAL for Python
%global common_description The ADAL for Python library makes it easy for python applications to \
authenticate to AAD in order to access AAD protected web resources.
Name: python-%{python_module}
Version: 0.4.3
Release: 1%{?dist}
Summary: %{common_summary}
Group: System Environment/Libraries
License: MIT
URL: https://github.com/AzureAD/azure-activedirectory-library-for-python/
Source0: https://github.com/AzureAD/%{alt_name}/archive/%{version}/%{name}-%{version}.tar.gz
# Fix install_requires option, for EPEL especially
Patch0: %{name}-0.4.3-build.patch
BuildRequires: python-setuptools
BuildRequires: python2-devel
# Needed for tests
BuildRequires: python-cryptography
BuildRequires: python-dateutil
BuildRequires: python-httpretty
BuildRequires: python-jwt
BuildRequires: python-requests
%if 0%{?fedora}
BuildRequires: python3-devel
# Needed for tests
BuildRequires: python3-cryptography
BuildRequires: python3-dateutil
BuildRequires: python3-httpretty
BuildRequires: python3-jwt
BuildRequires: python3-requests
%endif
BuildArch: noarch
%description
%{common_description}
%package -n python2-%{python_module}
Summary: %{common_summary}
Requires: python-dateutil
Requires: python-jwt
Requires: python-requests
%{?python_provide:%python_provide python2-%{python_module}}
%description -n python2-%{python_module}
%{common_description}
# Python 3 subpackage is disabled in EPEL due to missing dependencies
%if 0%{?fedora}
%package -n python3-%{python_module}
Summary: %{common_summary}
Requires: python3-dateutil
Requires: python3-jwt
Requires: python3-requests
%{?python_provide:%python_provide python3-%{python_module}}
%description -n python3-%{python_module}
%{common_description}
%endif
%prep
%autosetup -n %{alt_name}-%{version}
# Remove BOM
pushd adal/
tail --bytes=+4 __init__.py >__init__.py.new && \
touch -r __init__.py __init__.py.new && \
mv __init__.py.new __init__.py
popd
# Delete tests requiring a valid Azure account
rm tests/{test_client_credentials.py,test_e2e_examples.py}
%build
%py2_build
%{?fedora:%py3_build}
%install
%py2_install
%{?fedora:%py3_install}
%check
%{__python2} setup.py test
%{?fedora:%{__python3} setup.py test}
%files -n python2-%{python_module}
%doc README.md
%license LICENSE
%{python2_sitelib}/*
%if 0%{?fedora}
%files -n python3-%{python_module}
%doc README.md
%license LICENSE
%{python3_sitelib}/*
%endif
%changelog
* Sun Dec 04 2016 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.4.3-1
- Update to 0.4.3
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.0-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Mon Jun 20 2016 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.1.0-2
- Fix build (disable tests requiring a valid Azure account)
* Mon Feb 08 2016 Mohamed El Morabity <melmorabity@fedoraproject.org> - 0.1.0-1
- Initial RPM release