Blob Blame History Raw
%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.1.0
Release:        2%{?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

BuildRequires:  python-setuptools
BuildRequires:  python2-devel
# Needed for tests
BuildRequires:  python-dateutil
BuildRequires:  python-httpretty
BuildRequires:  python-jwt
BuildRequires:  python-requests
%if 0%{?fedora}
BuildRequires:  python3-devel
# Needed for tests
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-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-requests
%{?python_provide:%python_provide python3-%{python_module}}

%description -n python3-%{python_module}
%{common_description}
%endif


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

# Delete tests requiring a valid Azure account
rm tests/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
* 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