From 98e1e333f800c9ec462e0710183133b1d775d856 Mon Sep 17 00:00:00 2001 From: Mathieu Bridon Date: Jun 05 2014 00:55:39 +0000 Subject: Initial package for Fedora Submitted on Mon Jun 02 2014: https://bugzilla.redhat.com/show_bug.cgi?id=1103917 --- diff --git a/.gitignore b/.gitignore index e69de29..78a3797 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/cornice-0.16.2.tar.gz diff --git a/python-cornice.spec b/python-cornice.spec new file mode 100644 index 0000000..92c760e --- /dev/null +++ b/python-cornice.spec @@ -0,0 +1,171 @@ +%global module cornice + +%if 0%{?fedora} +%global with_python3 1 +%else +# EL doesn't have Python 3 +%global with_python3 0 +%endif + +%if 0%{?rhel} || 0%{?rhel} < 7 +# EL 6 doesn't have this macro +%global __python2 %{__python} +%global python2_sitelib %{python_sitelib} +%endif + +Name: python-cornice +Summary: Define Web Services in Pyramid +Version: 0.16.2 +Release: 1%{?dist} + +License: MPLv2.0 +URL: https://pypi.python.org/pypi/cornice +Source0: https://pypi.python.org/packages/source/c/%{module}/%{module}-0.16.2.tar.gz + +# This file is missing from the tarball +# https://github.com/mozilla-services/cornice/pull/240 +Source1: spore_validation.rx + +BuildArch: noarch + +BuildRequires: python-colander +BuildRequires: python-coverage +BuildRequires: python2-devel +BuildRequires: python-docutils +BuildRequires: python-mock +BuildRequires: python-pyramid +BuildRequires: python-rxjson +BuildRequires: python-setuptools +BuildRequires: python-simplejson +BuildRequires: python-venusian +BuildRequires: python-webtest + +Requires: python-colander +Requires: python-docutils +Requires: python-pyramid +Requires: python-simplejson +Requires: python-venusian + +%description +Helpers to build & document Web Services with Pyramid. + + +%package sphinx +Summary: Generate documentation for Web Services + +BuildRequires: python-sphinx + +Requires: %{name} = %{version}-%{release} +Requires: python-sphinx + +%description sphinx +Generate documentation for Web Services. + + +%if %{with_python3} +%package -n python3-cornice +Summary: Define Web Services in Pyramid + +BuildRequires: python3-colander +BuildRequires: python3-coverage +BuildRequires: python3-devel +BuildRequires: python3-docutils +BuildRequires: python3-mock +BuildRequires: python3-pyramid +BuildRequires: python3-rxjson +BuildRequires: python3-setuptools +BuildRequires: python3-simplejson +BuildRequires: python3-venusian +BuildRequires: python3-webtest + +Requires: python3-colander +Requires: python3-docutils +Requires: python3-pyramid +Requires: python3-simplejson +Requires: python3-venusian + +%description -n python3-cornice +Helpers to build & document Web Services with Pyramid. + + +%package -n python3-cornice-sphinx +Summary: Generate documentation for Web Services + +BuildRequires: python3-sphinx + +Requires: python3-cornice = %{version}-%{release} +Requires: python3-sphinx + +%description -n python3-cornice-sphinx +Generate documentation for Web Services. +%endif + + +%prep +%setup -q -n %{module}-%{version} + +# This file is missing from the tarball +# https://github.com/mozilla-services/cornice/pull/240 +cp -p %{SOURCE1} ./cornice/tests/ext/ + +%if %{with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +%endif + + +%build +CFLAGS="$RPM_OPT_FLAGS" %{__python2} setup.py build + +%if %{with_python3} +pushd %{py3dir} +CFLAGS="$RPM_OPT_FLAGS" %{__python3} setup.py build +popd +%endif + + +%install +%if %{with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +popd +%endif + +%{__python2} setup.py install --skip-build --root %{buildroot} + + +%check +%{__python2} setup.py test + +%if %{with_python3} +pushd %{py3dir} +%{__python3} setup.py test +popd +%endif + + +%files +%doc CHANGES.txt CONTRIBUTORS.txt LICENSE README.rst +%{python2_sitelib}/%{module}* +%exclude %{python2_sitelib}/%{module}/ext/sphinxext* + +%files sphinx +%{python2_sitelib}/%{module}/ext/sphinxext* + +%if %{with_python3} +%files -n python3-cornice +%doc CHANGES.txt CONTRIBUTORS.txt LICENSE README.rst +%{python3_sitelib}/%{module}* +%exclude %{python3_sitelib}/%{module}/ext/sphinxext* +%exclude %{python3_sitelib}/%{module}/ext/__pycache__/sphinxext* + +%files -n python3-cornice-sphinx +%{python3_sitelib}/%{module}/ext/sphinxext* +%{python3_sitelib}/%{module}/ext/__pycache__/sphinxext* +%endif + + +%changelog +* Sun Jun 01 2014 Mathieu Bridon - 0.16.2-1 +- Initial package for Fedora. diff --git a/sources b/sources index e69de29..3bcaef7 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +6c1bab992d8ed45bfe0e3ff9ab702954 cornice-0.16.2.tar.gz diff --git a/spore_validation.rx b/spore_validation.rx new file mode 100644 index 0000000..f031353 --- /dev/null +++ b/spore_validation.rx @@ -0,0 +1,89 @@ +{ + "type": "//rec", + "optional": { + "expected_status": { + "type" : "//arr", + "contents": { + "type": "//int" + } + }, + "base_url": "//str", + "description": "//str", + "authentication": "//bool", + "unattended_params": "//bool", + "version": "//str", + "authority": "//str", + "formats": { + "type" : "//arr", + "contents": { "type":"//str" } + }, + "meta": { + "type": "//map", + "values": { + "type": "//str" + } + } + }, + "required": { + "name": "//str", + "methods": { + "type": "//map", + "values": { + "type": "//rec", + "required": { + "method": "//str", + "path": "//str" + }, + "optional": { + "expected_status": { + "type" : "//arr", + "contents": { + "type": "//int" + } + }, + "required_params": { + "type" : "//arr", + "contents": { + "type": "//str" + } + }, + "optional_params": { + "type": "//arr", + "contents": { + "type": "//str" + } + }, + "payload" : { + "type": "//arr", + "contents": { + "type": "//str" + } + }, + "form-data" : { + "type": "//map", + "values": { + "type": "//str" + } + }, + "headers" : { + "type": "//map", + "values": { + "type": "//str" + } + }, + "required_payload": "//bool", + "optional_payload": "//bool", + "unattended_params": "//bool", + "description": "//str", + "deprecated": "//bool", + "authentication": "//bool", + "base_url": "//str", + "formats": { + "type" : "//arr", + "contents": { "type":"//str" } + } + } + } + } + } +}