Blob Blame History Raw
%global pypi_name cookies
%global sum Friendlier RFC 6265-compliant cookie parser/renderer
# Python 3 only for Fedora for now.
%if 0%{?fedora} > 12
%global with_python3 1
%endif

Name:           python-%{pypi_name}
Version:        2.2.1
Release:        3%{?dist}
Summary:        Friendlier RFC 6265-compliant cookie parser/renderer

License:        MIT
URL:            https://gitlab.com/sashahart/cookies
Source0:        https://pypi.python.org/packages/source/c/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Source1:		https://gitlab.com/sashahart/cookies/raw/master/LICENSE

BuildArch:      noarch

BuildRequires:  python2-devel
BuildRequires:  pytest
%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-pytest
%endif # if with_python3


%description
cookies.py is a Python module for working with HTTP cookies:
parsing and rendering ‘Cookie:’ request headers and ‘Set-Cookie:’
response headers, and exposing a convenient API for creating
and modifying cookies. It can be used as a replacement of
Python’s Cookie.py (aka http.cookies).

%package -n python2-%{pypi_name}
Summary:        %{sum}
%{?python_provide:%python_provide python2-%{pypi_name}}

%description -n python2-%{pypi_name}
cookies.py is a Python module for working with HTTP cookies:
parsing and rendering ‘Cookie:’ request headers and ‘Set-Cookie:’
response headers, and exposing a convenient API for creating
and modifying cookies. It can be used as a replacement of
Python’s Cookie.py (aka http.cookies).

%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary:        %{sum}
%{?python_provide:%python_provide python3-%{pypi_name}}

%description -n python3-%{pypi_name}
cookies.py is a Python module for working with HTTP cookies:
parsing and rendering ‘Cookie:’ request headers and ‘Set-Cookie:’
response headers, and exposing a convenient API for creating
and modifying cookies. It can be used as a replacement of
Python’s Cookie.py (aka http.cookies).
%endif # if with_python3

%prep
%setup -q -n %{pypi_name}-%{version}
cp %{SOURCE1} .
rm test_cookies.py

%build
%py2_build
%if 0%{?with_python3}
%py3_build
%endif # if with_python3

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

%check
# removing test_cookies.py to avoid import file mismatch error
# imported module 'test_cookies' has this __file__ attribute:
#   /home/makerpm/rpmbuild/BUILD/cookies-2.2.1/test_cookies.py
# which is not the same as the test file we want to collect:
#   /home/makerpm/rpmbuild/BUILD/cookies-2.2.1/build/lib/test_cookies.py
# Gitlab issue 
# https://gitlab.com/sashahart/cookies/issues/3
#%{__python2} setup.py test
#%if 0%{?with_python3}
#%{__python3} setup.py test
#%endif # if with_python3

%files -n python2-%{pypi_name}
%license LICENSE
%doc README
%{python2_sitelib}/*

%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%license LICENSE
%doc README
%{python3_sitelib}/*
%endif # if with_python3

%changelog
* Mon Jan 25 2016 Germano Massullo <germano.massullo@gmail.com> - 2.2.1-3
- Disabled tests due https://gitlab.com/sashahart/cookies/issues/3

* Fri Jan 22 2016 Germano Massullo <germano.massullo@gmail.com> - 2.2.1-2
- Added data to allow package building on EPEL repository. Only Fedora ships Python3

* Fri Jan 22 2016 Germano Massullo <germano.massullo@gmail.com> - 2.2.1-1
- First commit on Fedora's Git