diff --git a/.gitignore b/.gitignore index e69de29..747a504 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/0.3.3.tar.gz diff --git a/python-flask-restful.spec b/python-flask-restful.spec new file mode 100644 index 0000000..639318f --- /dev/null +++ b/python-flask-restful.spec @@ -0,0 +1,123 @@ +%if 0%{?rhel} && 0%{?rhel} <= 6 +%{!?__python2: %global __python2 /usr/bin/python} +%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")} +%endif + +%if (0%{?fedora} > 12) +%global with_python3 1 +%endif + +%global pkgname python-flask-restful +%global tarball_name flask-restful + +Name: python-flask-restful +Version: 0.3.3 +Release: 1%{?dist} +Summary: Simple framework for creating REST APIs for Flask + +Group: Development/Languages +License: BSD +URL: https://www.github.com/twilio/flask-restful/ +Source0: https://github.com/flask-restful/%{tarball_name}/archive/%{version}.tar.gz +Patch0: remove_q0_testcase.patch + +BuildArch: noarch + +Requires: python-flask +Requires: python-six +Requires: python-aniso8601 +Requires: pytz +# those are needed for tests: +BuildRequires: python-flask +BuildRequires: python-six +BuildRequires: python-aniso8601 +BuildRequires: pytz +BuildRequires: python2-devel +BuildRequires: python-setuptools +BuildRequires: python-nose +BuildRequires: python-mock +BuildRequires: python-blinker +BuildRequires: python-crypto + +%description +Flask-RESTful is Python 2 extension for Flask that adds support +for quickly building REST APIs. It is a lightweight abstraction +that works with your existing ORM/libraries. + +%if 0%{?with_python3} +%package -n python3-flask-restful +Summary: %{summary} +Requires: python3-flask +Requires: python3-six +Requires: python3-aniso8601 +Requires: python3-pytz +# those are needed for tests: +BuildRequires: python3-flask +BuildRequires: python3-six +BuildRequires: python3-aniso8601 +BuildRequires: python3-pytz +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-nose +BuildRequires: python3-mock +BuildRequires: python3-blinker +BuildRequires: python3-crypto + +%description -n python3-flask-restful +Flask-RESTful is Python 3 extension for Flask that adds support +for quickly building REST APIs. It is a lightweight abstraction +that works with your existing ORM/libraries. +%endif + +%prep +%setup -qn %{tarball_name}-%{version} +rm -rf docs/_themes/.gitignore +%patch0 -p1 + +%if 0%{?with_python3} +rm -rf %{py3dir} +cp -a . %{py3dir} +find %{py3dir} -name '*.py' | xargs sed -i '1s|^#!python|#!%{__python3}|' +%endif + +%build +%{__python2} setup.py build + +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py build +popd +%endif + +%install +%{__python2} setup.py install --skip-build --root %{buildroot} +%if 0%{?with_python3} +pushd %{py3dir} +%{__python3} setup.py install --skip-build --root %{buildroot} +popd +%endif + +%check +%{__python2} setup.py test +%if 0%{?with_python3} +%{__python3} setup.py test +%endif + +%files +%doc AUTHORS.md README.md examples/ docs/ +%license LICENSE +%{python2_sitelib}/* + +%if 0%{?with_python3} +%files -n python3-flask-restful +%doc AUTHORS.md README.md examples/ docs/ +%license LICENSE +%{python3_sitelib}/* +%endif + +%changelog +* Tue Jul 07 2015 Jan Sedlak - 0.3.3-1 +- package newest version +* Wed Jan 22 2014 Jan Sedlak - 0.2.11-1 +- initial packaging diff --git a/remove_q0_testcase.patch b/remove_q0_testcase.patch new file mode 100644 index 0000000..acc98b3 --- /dev/null +++ b/remove_q0_testcase.patch @@ -0,0 +1,43 @@ +From dd42963452e8bb79fb4baef11b47c6e3a41a3491 Mon Sep 17 00:00:00 2001 +From: Garret Raziel +Date: Tue, 7 Jul 2015 16:15:17 +0200 +Subject: [PATCH] remove q=0 testcase + +--- + tests/test_accept.py | 20 -------------------- + 1 file changed, 20 deletions(-) + +diff --git a/tests/test_accept.py b/tests/test_accept.py +index 7d78118..1f294e9 100644 +--- a/tests/test_accept.py ++++ b/tests/test_accept.py +@@ -121,26 +121,6 @@ class AcceptTestCase(unittest.TestCase): + assert_equals(res.content_type, 'text/plain') + + +- def test_accept_no_default_match_q0_not_acceptable(self): +- """ +- q=0 should be considered NotAcceptable, +- but this depends on werkzeug >= 1.0 which is not yet released +- so this test is expected to fail until we depend on werkzeug >= 1.0 +- """ +- class Foo(flask_restful.Resource): +- def get(self): +- return "data" +- +- app = Flask(__name__) +- api = flask_restful.Api(app, default_mediatype=None) +- +- api.add_resource(Foo, '/') +- +- with app.test_client() as client: +- res = client.get('/', headers=[('Accept', 'application/json; q=0')]) +- assert_equals(res.status_code, 406) +- assert_equals(res.content_type, 'application/json') +- + def test_accept_no_default_accept_highest_quality_of_two(self): + class Foo(flask_restful.Resource): + def get(self): +-- +2.4.3 + diff --git a/sources b/sources index e69de29..6c4556b 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +2ed0e4f3b56e5064bf916014adbf7c60 0.3.3.tar.gz