98e1e33
%global module cornice
98e1e33
98e1e33
%if 0%{?fedora}
98e1e33
%global with_python3 1
98e1e33
%else
98e1e33
# EL doesn't have Python 3
98e1e33
%global with_python3 0
98e1e33
%endif
98e1e33
98e1e33
%if 0%{?rhel} || 0%{?rhel} < 7
98e1e33
# EL 6 doesn't have this macro
98e1e33
%global __python2       %{__python}
98e1e33
%global python2_sitelib %{python_sitelib}
98e1e33
%endif
98e1e33
98e1e33
Name:             python-cornice
98e1e33
Summary:          Define Web Services in Pyramid
Luke Macken 6adddb4
Version:          1.0.0
b85f59a
Release:          2%{?dist}
98e1e33
98e1e33
License:          MPLv2.0
98e1e33
URL:              https://pypi.python.org/pypi/cornice
Luke Macken 6adddb4
Source0:          https://pypi.python.org/packages/source/c/%{module}/%{module}-%{version}.tar.gz
98e1e33
98e1e33
# This file is missing from the tarball
98e1e33
#     https://github.com/mozilla-services/cornice/pull/240
98e1e33
Source1:          spore_validation.rx
98e1e33
98e1e33
BuildArch:        noarch
98e1e33
98e1e33
BuildRequires:    python-colander
98e1e33
BuildRequires:    python-coverage
98e1e33
BuildRequires:    python2-devel
98e1e33
BuildRequires:    python-docutils
98e1e33
BuildRequires:    python-mock
98e1e33
BuildRequires:    python-pyramid
98e1e33
BuildRequires:    python-rxjson
98e1e33
BuildRequires:    python-setuptools
98e1e33
BuildRequires:    python-simplejson
98e1e33
BuildRequires:    python-venusian
98e1e33
BuildRequires:    python-webtest
98e1e33
98e1e33
Requires:         python-colander
98e1e33
Requires:         python-docutils
98e1e33
Requires:         python-pyramid
98e1e33
Requires:         python-simplejson
98e1e33
Requires:         python-venusian
98e1e33
98e1e33
%description
98e1e33
Helpers to build & document Web Services with Pyramid.
98e1e33
98e1e33
98e1e33
%package sphinx
98e1e33
Summary:          Generate documentation for Web Services
98e1e33
98e1e33
BuildRequires:    python-sphinx
98e1e33
98e1e33
Requires:         %{name} = %{version}-%{release}
98e1e33
Requires:         python-sphinx
98e1e33
98e1e33
%description sphinx
98e1e33
Generate documentation for Web Services.
98e1e33
98e1e33
98e1e33
%if %{with_python3}
98e1e33
%package -n python3-cornice
98e1e33
Summary:          Define Web Services in Pyramid
98e1e33
98e1e33
BuildRequires:    python3-colander
98e1e33
BuildRequires:    python3-coverage
98e1e33
BuildRequires:    python3-devel
98e1e33
BuildRequires:    python3-docutils
98e1e33
BuildRequires:    python3-mock
98e1e33
BuildRequires:    python3-pyramid
98e1e33
BuildRequires:    python3-rxjson
98e1e33
BuildRequires:    python3-setuptools
98e1e33
BuildRequires:    python3-simplejson
98e1e33
BuildRequires:    python3-venusian
98e1e33
BuildRequires:    python3-webtest
98e1e33
98e1e33
Requires:         python3-colander
98e1e33
Requires:         python3-docutils
98e1e33
Requires:         python3-pyramid
98e1e33
Requires:         python3-simplejson
98e1e33
Requires:         python3-venusian
98e1e33
98e1e33
%description -n python3-cornice
98e1e33
Helpers to build & document Web Services with Pyramid.
98e1e33
98e1e33
98e1e33
%package -n python3-cornice-sphinx
98e1e33
Summary:          Generate documentation for Web Services
98e1e33
98e1e33
BuildRequires:    python3-sphinx
98e1e33
98e1e33
Requires:         python3-cornice = %{version}-%{release}
98e1e33
Requires:         python3-sphinx
98e1e33
98e1e33
%description -n python3-cornice-sphinx
98e1e33
Generate documentation for Web Services.
98e1e33
%endif
98e1e33
98e1e33
98e1e33
%prep
98e1e33
%setup -q -n %{module}-%{version}
98e1e33
98e1e33
# This file is missing from the tarball
98e1e33
#     https://github.com/mozilla-services/cornice/pull/240
98e1e33
cp -p %{SOURCE1} ./cornice/tests/ext/
98e1e33
98e1e33
%if %{with_python3}
98e1e33
rm -rf %{py3dir}
98e1e33
cp -a . %{py3dir}
98e1e33
find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|'
98e1e33
%endif
98e1e33
98e1e33
98e1e33
%build
98e1e33
CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build
98e1e33
98e1e33
%if %{with_python3}
98e1e33
pushd %{py3dir}
98e1e33
CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build
98e1e33
popd
98e1e33
%endif
98e1e33
98e1e33
98e1e33
%install
98e1e33
%if %{with_python3}
98e1e33
pushd %{py3dir}
98e1e33
%{__python3} setup.py install --skip-build --root %{buildroot}
98e1e33
popd
98e1e33
%endif
98e1e33
98e1e33
%{__python2} setup.py install --skip-build --root %{buildroot}
98e1e33
98e1e33
98e1e33
%check
98e1e33
%{__python2} setup.py test
98e1e33
98e1e33
%if %{with_python3}
98e1e33
pushd %{py3dir}
98e1e33
%{__python3} setup.py test
98e1e33
popd
98e1e33
%endif
98e1e33
98e1e33
98e1e33
%files
98e1e33
%doc CHANGES.txt CONTRIBUTORS.txt LICENSE README.rst
98e1e33
%{python2_sitelib}/%{module}*
98e1e33
%exclude %{python2_sitelib}/%{module}/ext/sphinxext*
98e1e33
98e1e33
%files sphinx
98e1e33
%{python2_sitelib}/%{module}/ext/sphinxext*
98e1e33
98e1e33
%if %{with_python3}
98e1e33
%files -n python3-cornice
98e1e33
%doc CHANGES.txt CONTRIBUTORS.txt LICENSE README.rst
98e1e33
%{python3_sitelib}/%{module}*
98e1e33
%exclude %{python3_sitelib}/%{module}/ext/sphinxext*
98e1e33
%exclude %{python3_sitelib}/%{module}/ext/__pycache__/sphinxext*
98e1e33
98e1e33
%files -n python3-cornice-sphinx
98e1e33
%{python3_sitelib}/%{module}/ext/sphinxext*
98e1e33
%{python3_sitelib}/%{module}/ext/__pycache__/sphinxext*
98e1e33
%endif
98e1e33
98e1e33
98e1e33
%changelog
b85f59a
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-2
b85f59a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
b85f59a
Luke Macken 6adddb4
* Fri Jun 05 2015 Luke Macken <lmacken@redhat.com> - 1.0.0-1
Luke Macken 6adddb4
- Update to 1.0.0
Luke Macken 6adddb4
3c60e63
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.16.2-2
3c60e63
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
3c60e63
98e1e33
* Sun Jun 01 2014 Mathieu Bridon <bochecha@fedoraproject.org> - 0.16.2-1
98e1e33
- Initial package for Fedora.