|
|
88e569d |
# Python 3 only for Fedora for now.
|
|
|
88e569d |
%if 0%{?fedora} > 12
|
|
|
88e569d |
%global with_python3 1
|
|
|
88e569d |
%endif
|
|
|
88e569d |
|
|
|
88e569d |
%global srcname mimerender
|
|
|
88e569d |
|
|
|
88e569d |
Name: python-%{srcname}
|
|
|
88e569d |
Version: 0.5.5
|
|
|
d55229a |
Release: 5%{?dist}
|
|
|
88e569d |
Summary: RESTful HTTP Content Negotiation for Flask, Bottle, etc.
|
|
|
88e569d |
|
|
|
88e569d |
License: MIT
|
|
|
88e569d |
URL: http://pypi.python.org/pypi/%{srcname}
|
|
|
88e569d |
Source0: http://pypi.python.org/packages/source/m/%{srcname}/%{srcname}-%{version}.tar.gz
|
|
|
88e569d |
# https://github.com/martinblech/mimerender/issues/29
|
|
|
88e569d |
Source1: LICENSE.mimerender
|
|
|
88e569d |
|
|
|
88e569d |
BuildArch: noarch
|
|
|
88e569d |
BuildRequires: python2-devel
|
|
|
88e569d |
BuildRequires: python2-mimeparse
|
|
|
88e569d |
# Needed for EL 7, package does not provide python2-setuptools
|
|
|
88e569d |
BuildRequires: python-setuptools
|
|
|
88e569d |
# For tests
|
|
|
88e569d |
# Needs to be fixed to provide python2-unittest2
|
|
|
88e569d |
BuildRequires: python-unittest2
|
|
|
88e569d |
%if 0%{?with_python3}
|
|
|
88e569d |
BuildRequires: python3-devel
|
|
|
88e569d |
BuildRequires: python3-mimeparse
|
|
|
88e569d |
BuildRequires: python3-setuptools
|
|
|
88e569d |
BuildRequires: python3-unittest2
|
|
|
88e569d |
%endif # if with_python3
|
|
|
88e569d |
|
|
|
88e569d |
%description
|
|
|
88e569d |
mimerender provides a decorator that wraps a HTTP request handler to select
|
|
|
88e569d |
the correct render function for a given HTTP Accept header. It uses mimeparse
|
|
|
88e569d |
to parse the accept string and select the best available representation.
|
|
|
88e569d |
Supports Flask, Bottle, web.py and webapp2 out of the box, and it’s easy to
|
|
|
88e569d |
add support for other frameworks.
|
|
|
88e569d |
|
|
|
88e569d |
|
|
|
88e569d |
%package -n python2-%{srcname}
|
|
|
88e569d |
Summary: %{summary}
|
|
|
88e569d |
%{?python_provide:%python_provide python2-%{srcname}}
|
|
|
88e569d |
Requires: python2-mimeparse
|
|
|
88e569d |
# Note: mimerender has subclasses of MimeRenderBase for web.py, Flask,
|
|
|
88e569d |
# Bottle, and webapp2. When you import 'mimerender', the subclass for
|
|
|
88e569d |
# each framework you have installed will be defined; if the framework
|
|
|
88e569d |
# isn't installed, the subclass for it is skipped (they're all in try/
|
|
|
88e569d |
# except blocks). So if you have python2-flask installed you'll get
|
|
|
88e569d |
# the FlaskMimeRender class, if you python2-bottle installed you'll
|
|
|
88e569d |
# get BottleMimeRender, and so on. This relationship is not expressed
|
|
|
88e569d |
# through dependencies as it doesn't seem to the packager that such
|
|
|
88e569d |
# dependencies would actually aid in any real-world use of mimeparse;
|
|
|
88e569d |
# if you want to use it in code you've probably already picked a web
|
|
|
88e569d |
# framework, and if it's just being pulled in as a dependency of some
|
|
|
88e569d |
# other package, *that* package will express the appropriate deps on
|
|
|
88e569d |
# the web framework.
|
|
|
88e569d |
#
|
|
|
88e569d |
# Also note that *executing* mimerender.py requires the unittest or
|
|
|
88e569d |
# unittest2 module. All this does is run the test suite (as used in
|
|
|
88e569d |
# check, below). There is no Requires: for this, because it's not
|
|
|
88e569d |
# the expected use of the package, in all normal cases it will be
|
|
|
88e569d |
# used by importing the module.
|
|
|
88e569d |
|
|
|
88e569d |
%description -n python2-%{srcname}
|
|
|
88e569d |
mimerender provides a decorator that wraps a HTTP request handler to select
|
|
|
88e569d |
the correct render function for a given HTTP Accept header. It uses mimeparse
|
|
|
88e569d |
to parse the accept string and select the best available representation.
|
|
|
88e569d |
Supports Flask, Bottle, web.py and webapp2 out of the box, and it’s easy to
|
|
|
88e569d |
add support for other frameworks. This is the Python 2 build of mimerender.
|
|
|
88e569d |
|
|
|
88e569d |
|
|
|
88e569d |
%if 0%{?with_python3}
|
|
|
88e569d |
%package -n python3-%{srcname}
|
|
|
88e569d |
Summary: %{summary}
|
|
|
88e569d |
%{?python_provide:%python_provide python3-%{srcname}}
|
|
|
88e569d |
Requires: python3-mimeparse
|
|
|
88e569d |
# The note about support for web frameworks above applies to the py3
|
|
|
88e569d |
# package too, of course, except that you need python3-bottle to get
|
|
|
88e569d |
# BottleMimeRender, python3-flask to get FlaskMimeRender, etc. when
|
|
|
88e569d |
# using python3-mimerender.
|
|
|
88e569d |
|
|
|
88e569d |
%description -n python3-%{srcname}
|
|
|
88e569d |
mimerender provides a decorator that wraps a HTTP request handler to select
|
|
|
88e569d |
the correct render function for a given HTTP Accept header. It uses mimeparse
|
|
|
88e569d |
to parse the accept string and select the best available representation.
|
|
|
88e569d |
Supports Flask, Bottle, web.py and webapp2 out of the box, and it’s easy to
|
|
|
88e569d |
add support for other frameworks. This is the Python 3 build of mimerender.
|
|
|
88e569d |
%endif # if with_python3
|
|
|
88e569d |
|
|
|
88e569d |
|
|
|
88e569d |
%prep
|
|
|
88e569d |
%autosetup -n %{srcname}-%{version}
|
|
|
88e569d |
cp %{SOURCE1} ./LICENSE
|
|
|
88e569d |
|
|
|
88e569d |
%build
|
|
|
88e569d |
%py2_build
|
|
|
88e569d |
%if 0%{?with_python3}
|
|
|
88e569d |
%py3_build
|
|
|
88e569d |
%endif # if with_python3
|
|
|
88e569d |
|
|
|
88e569d |
%install
|
|
|
88e569d |
%py2_install
|
|
|
88e569d |
%if 0%{?with_python3}
|
|
|
88e569d |
%py3_install
|
|
|
88e569d |
%endif # if with_python3
|
|
|
88e569d |
|
|
|
88e569d |
%check
|
|
|
88e569d |
%{__python2} src/mimerender.py
|
|
|
88e569d |
%if 0%{?with_python3}
|
|
|
f83b104 |
# There seems to be some kind of intermittent bug which causes the test
|
|
|
f83b104 |
# suite to fail on py3 sometimes. It seems to fail with pypy too (in
|
|
|
f83b104 |
# upstream's travis):
|
|
|
f83b104 |
# https://github.com/martinblech/mimerender/issues/31
|
|
|
f83b104 |
# Disabling the test suite for now.
|
|
|
f83b104 |
#{__python3} src/mimerender.py
|
|
|
88e569d |
%endif # if with_python3
|
|
|
88e569d |
|
|
|
88e569d |
%files -n python2-%{srcname}
|
|
|
88e569d |
%{!?_licensedir:%global license %doc}
|
|
|
88e569d |
%license LICENSE
|
|
|
88e569d |
%{python2_sitelib}/%{srcname}*
|
|
|
88e569d |
|
|
|
88e569d |
%if 0%{?with_python3}
|
|
|
88e569d |
%files -n python3-%{srcname}
|
|
|
88e569d |
%license LICENSE
|
|
|
88e569d |
%{python3_sitelib}/%{srcname}*
|
|
|
88e569d |
%{python3_sitelib}/__pycache__/%{srcname}*
|
|
|
88e569d |
%endif # if with_python3
|
|
|
88e569d |
|
|
|
88e569d |
%changelog
|
|
|
d55229a |
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.5-5
|
|
|
d55229a |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
|
|
|
d55229a |
|
|
|
e628903 |
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.5.5-4
|
|
|
e628903 |
- Rebuild for Python 3.6
|
|
|
e628903 |
|
|
|
55fe51e |
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.5-3
|
|
|
55fe51e |
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
|
|
|
55fe51e |
|
|
|
adbed62 |
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.5-2
|
|
|
adbed62 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
|
|
|
adbed62 |
|
|
|
88e569d |
* Wed Jan 20 2016 Adam Williamson <awilliam@redhat.com> - 0.5.5-1
|
|
|
88e569d |
- initial package (based on skeleton from Python guidelines)
|