98e1e33
%global module cornice
98e1e33
Luke Macken 32269a4
%{!?py2ver: %global py2ver %(%{__python2} -c "import sys ; print(sys.version[:3])")}
Luke Macken 32269a4
%{!?py3ver: %global py3ver %(%{__python3} -c "import sys ; print(sys.version[:3])")}
Luke Macken 32269a4
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
dda4b01
%global desc Helpers to build & document Web Services with Pyramid.
dda4b01
98e1e33
Name:             python-cornice
e271587
Summary:          Define Web Services in Pyramid
Luke Macken 32269a4
Version:          1.1.0
e271587
Release:          6%{?dist}
dda4b01
BuildArch:        noarch
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
dda4b01
# This file is missing from the tarball
dda4b01
#     https://github.com/mozilla-services/cornice/pull/240
dda4b01
Source1:          spore_validation.rx
dcbe629
# https://github.com/Cornices/cornice.ext.sphinx/pull/5
dcbe629
Patch0:           0000-New-setting-in-latest-docutils.patch
dcbe629
# https://github.com/Cornices/cornice.ext.sphinx/pull/9
dcbe629
Patch1:           0001-Initialize-the-ref_context-as-a-dictionary.patch
dcbe629
98e1e33
98e1e33
BuildRequires:    python-pyramid
98e1e33
BuildRequires:    python-rxjson
98e1e33
BuildRequires:    python-venusian
98e1e33
BuildRequires:    python-webtest
e271587
BuildRequires:    python2-colander
e271587
BuildRequires:    python2-coverage
dda4b01
BuildRequires:    python2-devel
e271587
BuildRequires:    python2-docutils
e271587
BuildRequires:    python2-mock
e271587
BuildRequires:    python2-nose
e271587
BuildRequires:    python2-setuptools
e271587
BuildRequires:    python2-simplejson
e271587
BuildRequires:    python2-sphinx
dda4b01
dda4b01
%if %{with_python3}
dda4b01
BuildRequires:    python3-colander
dda4b01
BuildRequires:    python3-coverage
dda4b01
BuildRequires:    python3-devel
dda4b01
BuildRequires:    python3-docutils
dda4b01
BuildRequires:    python3-mock
dda4b01
BuildRequires:    python3-nose
dda4b01
BuildRequires:    python3-pyramid
dda4b01
BuildRequires:    python3-rxjson
dda4b01
BuildRequires:    python3-setuptools
dda4b01
BuildRequires:    python3-simplejson
dda4b01
BuildRequires:    python3-sphinx
dda4b01
BuildRequires:    python3-venusian
dda4b01
BuildRequires:    python3-webtest
dda4b01
%endif
dda4b01
dda4b01
dda4b01
%description
dda4b01
%{desc}
dda4b01
dda4b01
dda4b01
%package -n python2-cornice
e271587
Summary:          %{summary}
98e1e33
98e1e33
Requires:         python-pyramid
98e1e33
Requires:         python-venusian
e271587
Requires:         python2-colander
e271587
Requires:         python2-docutils
e271587
Requires:         python2-simplejson
98e1e33
dda4b01
%{?python_provide:%python_provide python2-%{module}}
98e1e33
98e1e33
dda4b01
%description -n python2-cornice
dda4b01
%{desc}
98e1e33
98e1e33
dda4b01
%package -n python2-cornice-sphinx
dda4b01
Summary:          Generate documentation for Web Services
dda4b01
dda4b01
Requires:         python2-cornice = %{version}-%{release}
e271587
Requires:         python2-sphinx
dda4b01
dda4b01
%{?python_provide:%python_provide python2-cornice-sphinx}
98e1e33
dda4b01
dda4b01
%description -n python2-cornice-sphinx
98e1e33
Generate documentation for Web Services.
98e1e33
98e1e33
98e1e33
%if %{with_python3}
98e1e33
%package -n python3-cornice
e271587
Summary:          %{summary}
98e1e33
98e1e33
Requires:         python3-colander
98e1e33
Requires:         python3-docutils
98e1e33
Requires:         python3-pyramid
98e1e33
Requires:         python3-simplejson
98e1e33
Requires:         python3-venusian
98e1e33
dda4b01
%{?python_provide:%python_provide python3-%{module}}
dda4b01
dda4b01
98e1e33
%description -n python3-cornice
dda4b01
%{desc}
98e1e33
98e1e33
98e1e33
%package -n python3-cornice-sphinx
98e1e33
Summary:          Generate documentation for Web Services
98e1e33
98e1e33
Requires:         python3-cornice = %{version}-%{release}
98e1e33
Requires:         python3-sphinx
98e1e33
dda4b01
%{?python_provide:%python_provide python3-cornice-sphinx}
dda4b01
dda4b01
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
dcbe629
%patch0 -p1
dcbe629
%patch1 -p1
dcbe629
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
dda4b01
# Kill some rpmlint warnings about the templates being executable but not having shebangs.
dda4b01
chmod a-x cornice/scaffolds/cornice/*tmpl
dda4b01
chmod a-x cornice/scaffolds/cornice/+package+/*tmpl
dda4b01
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
Luke Macken 32269a4
nosetests-%{py2ver}
98e1e33
98e1e33
%if %{with_python3}
98e1e33
pushd %{py3dir}
Luke Macken 32269a4
nosetests-%{py3ver}
98e1e33
popd
98e1e33
%endif
98e1e33
98e1e33
dda4b01
%files -n python2-cornice
dda4b01
%license LICENSE
dda4b01
%doc CHANGES.txt CONTRIBUTORS.txt README.rst
98e1e33
%{python2_sitelib}/%{module}*
98e1e33
%exclude %{python2_sitelib}/%{module}/ext/sphinxext*
98e1e33
dda4b01
%files -n python2-cornice-sphinx
dda4b01
%doc README.rst
98e1e33
%{python2_sitelib}/%{module}/ext/sphinxext*
98e1e33
98e1e33
%if %{with_python3}
98e1e33
%files -n python3-cornice
dda4b01
%license LICENSE
dda4b01
%doc CHANGES.txt CONTRIBUTORS.txt 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
dda4b01
%doc README.rst
98e1e33
%{python3_sitelib}/%{module}/ext/sphinxext*
98e1e33
%{python3_sitelib}/%{module}/ext/__pycache__/sphinxext*
98e1e33
%endif
98e1e33
98e1e33
98e1e33
%changelog
e271587
* Wed Jul 05 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.1.0-6
e271587
- Use python2- requires where appropriate.
e271587
dda4b01
* Wed Jul 05 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.1.0-5
dda4b01
- Provide python2- subpackages.
dda4b01
- Use the license macro.
dda4b01
- Reorganize requirements, and sort them alphabetically.
dda4b01
- Remove the execute bit from some templates.
dda4b01
dcbe629
* Tue Mar 07 2017 Randy Barlow <bowlofeggs@fedoraproject.org> - 1.1.0-4
dcbe629
- Apply two patches to allow autodoc generation to work again (#1430185, #1430186).
dcbe629
37dc434
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-3
37dc434
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
37dc434
d500f97
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.0-2
d500f97
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
d500f97
Luke Macken 32269a4
* Wed Jan 13 2016 Luke Macken <lmacken@redhat.com> - 1.1.0-1
Luke Macken 32269a4
- Update to 1.1.0
Luke Macken 32269a4
- Get the test suite running again with nose
Luke Macken 32269a4
2117cad
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.0-3
2117cad
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
2117cad
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.