Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%global modname sanction

Name:               python-sanction
Version:            0.3.1
Release:            1%{?dist}
Summary:            A simple, lightweight OAuth2 client
Group:              Development/Libraries
License:            MIT
URL:                http://pypi.python.org/pypi/sanction
Source0:            http://pypi.python.org/packages/source/s/%{modname}/%{modname}-%{version}.tar.gz

BuildArch:          noarch

BuildRequires:      python2-devel
BuildRequires:      python-nose

%if 0%{?with_python3}
BuildRequires:      python3-devel
BuildRequires:      python3-nose
%endif


%description
python-sanction is a lightweight, dead simple client implementation of
the OAuth2 protocol.

- Variations on OAuth2 client implementation range from a few hundred LOC
  to thousands. In a Pythonic world, there's absolutely no need for this when
  simply dealing with the client side of the spec. Currently, sanction sits
  at a whopping 65 LOC, one class. This makes the library tremendously easy
  to grok.

- Most providers have varying levels of diversion from the official spec.
  The goal with this library is to either handle these diversions natively,
  or expose a method to allow client code to deal with it efficiently and
  effectively.

- Three of the four OAuth2 flows should be supported by this library.
  Currently, only authorization code and client credential flows have been
  tested due to lack of other (known) implementations.

sanction has been tested with the following OAuth2 providers:

* Facebook (include the test API)
* Google
* Foursquare
* bitly
* GitHub
* StackExchange
* Instagram
* DeviantArt

%if 0%{?with_python3}
%package -n python3-sanction
Summary:            A simple, lightweight OAuth2 client
Group:              Development/Libraries

%description -n python3-sanction
python-sanction is a lightweight, dead simple client implementation of
the OAuth2 protocol.

- Variations on OAuth2 client implementation range from a few hundred LOC
  to thousands. In a Pythonic world, there's absolutely no need for this when
  simply dealing with the client side of the spec. Currently, sanction sits
  at a whopping 65 LOC, one class. This makes the library tremendously easy
  to grok.

- Most providers have varying levels of diversion from the official spec.
  The goal with this library is to either handle these diversions natively,
  or expose a method to allow client code to deal with it efficiently and
  effectively.

- Three of the four OAuth2 flows should be supported by this library.
  Currently, only authorization code and client credential flows have been
  tested due to lack of other (known) implementations.

sanction has been tested with the following OAuth2 providers:

* Facebook (include the test API)
* Google
* Foursquare
* bitly
* GitHub
* StackExchange
* Instagram
* DeviantArt
%endif


%prep
%setup -q -n %{modname}-%{version}

# Remove bundled egg-info in case it exists
rm -rf %{modname}.egg-info

%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif

%build
%{__python} setup.py build

%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py build
popd
%endif

%install
%if 0%{?with_python3}
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root=%{buildroot}
popd
%endif

%{__python} setup.py install -O1 --skip-build --root=%{buildroot}

%check
%if 0%{?with_python3}
pushd %{py3dir}
PYTHONPATH=$(pwd) nosetests-3.3
popd
%endif

PYTHONPATH=$(pwd) nosetests

%files
%doc README.rst LICENSE.txt
%{python_sitelib}/%{modname}/
%{python_sitelib}/%{modname}-%{version}*

%if 0%{?with_python3}
%files -n python3-sanction
%doc README.rst LICENSE.txt
%{python3_sitelib}/%{modname}/
%{python3_sitelib}/%{modname}-%{version}*
%endif

%changelog
* Mon Oct 07 2013 Ralph Bean <rbean@redhat.com> - 0.3.1-1
- Latest upstream.
- Added python3 subpackage.

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Mon Feb 04 2013 Ralph Bean <rbean@redhat.com> - 0.1.4-1
- Initial packaging for Fedora