- updated to 0.12
authorJakub Bogusz <qboosh@pld-linux.org>
Mon, 13 Mar 2017 20:56:32 +0000 (21:56 +0100)
committerJakub Bogusz <qboosh@pld-linux.org>
Mon, 13 Mar 2017 20:56:32 +0000 (21:56 +0100)
- added python3.6 patch (fixes tests with python 3.6
- run tests, build -apidocs

python-flask-python3.6.patch [new file with mode: 0644]
python-flask.spec

diff --git a/python-flask-python3.6.patch b/python-flask-python3.6.patch
new file mode 100644 (file)
index 0000000..55a7151
--- /dev/null
@@ -0,0 +1,40 @@
+From 01b992b1a1482246d705ffe3b3d0dd7816f0456b Mon Sep 17 00:00:00 2001
+From: Andrew Arendt <AndrewArendt@gmail.com>
+Date: Tue, 10 Jan 2017 11:20:53 -0600
+Subject: [PATCH] Added python3.6 support for tests
+
+---
+ .travis.yml         | 6 +++++-
+ tests/test_basic.py | 2 +-
+ tests/test_ext.py   | 4 ++--
+ tox.ini             | 2 +-
+ 4 files changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_basic.py b/tests/test_basic.py
+index be3d5ed..a099c90 100644
+--- a/tests/test_basic.py
++++ b/tests/test_basic.py
+@@ -333,7 +333,7 @@ def test():
+     client = app.test_client()
+     rv = client.get('/')
+     assert 'set-cookie' in rv.headers
+-    match = re.search(r'\bexpires=([^;]+)(?i)', rv.headers['set-cookie'])
++    match = re.search(r'(?i)\bexpires=([^;]+)', rv.headers['set-cookie'])
+     expires = parse_date(match.group())
+     expected = datetime.utcnow() + app.permanent_session_lifetime
+     assert expires.year == expected.year
+diff --git a/tests/test_ext.py b/tests/test_ext.py
+index d336e40..ebb5f02 100644
+--- a/tests/test_ext.py
++++ b/tests/test_ext.py
+@@ -179,8 +179,8 @@ def test_flaskext_broken_package_no_module_caching(flaskext_broken):
+ def test_no_error_swallowing(flaskext_broken):
+     with pytest.raises(ImportError) as excinfo:
+         import flask.ext.broken
+-
+-    assert excinfo.type is ImportError
++    # python3.6 raises a subclass of ImportError: 'ModuleNotFoundError'
++    assert issubclass(excinfo.type, ImportError)
+     if PY2:
+         message = 'No module named missing_module'
+     else:
index ec08921400c8ae8d908672425c431ba27f78beec..55aa7c10b14b057471a42461b4818176b5cf8da3 100644 (file)
@@ -1,44 +1,52 @@
 #
 # Conditional build:
-%bcond_without  doc             # don't build doc
-%bcond_with  tests   # do not perform "make test"
-%bcond_without  python2 # CPython 2.x module
-%bcond_without  python3 # CPython 3.x module
-
+%bcond_without  doc    # Sphinx documentation
+%bcond_without tests   # unit tests
+%bcond_without python2 # CPython 2.x module
+%bcond_without python3 # CPython 3.x module
 
 %define        module  flask
 Summary:       A microframework based on Werkzeug, Jinja2 and good intentions
+Summary(pl.UTF-8):     Mikroszkielet oparty na Werkzeugu, Jinja2 i dobrych intencjach
 Name:          python-%{module}
-Version:       0.10.1
-Release:       5
+Version:       0.12
+Release:       1
 License:       BSD
 Group:         Development/Languages/Python
-# https://pypi.python.org/packages/source/F/Flask/Flask-0.10.1.tar.gz
-Source0:       http://pypi.python.org/packages/source/F/Flask/Flask-%{version}.tar.gz
-# Source0-md5: 378670fe456957eb3c27ddaef60b2b24
+#Source0Download: https://pypi.python.org/simple/Flask
+Source0:       https://files.pythonhosted.org/packages/source/F/Flask/Flask-%{version}.tar.gz
+# Source0-md5: c1d30f51cff4a38f9454b23328a15c5a
+Patch0:                %{name}-python3.6.patch
 URL:           http://flask.pocoo.org/
+%if %{with tests} && %(locale -a | grep -q '^C\.UTF-8$'; echo $?)
+BuildRequires: glibc-localedb-all
+%endif
 %if %{with python2}
-BuildRequires: python-devel
-BuildRequires: python-distribute
-BuildRequires: python-distribute
+BuildRequires: python-click >= 2.0
+BuildRequires: python-devel >= 1:2.6
+BuildRequires: python-itsdangerous >= 0.21
 BuildRequires: python-jinja2 >= 2.4
-BuildRequires: python-werkzeug >= 0.6.1
-BuildRequires: rpm-pythonprov
-BuildRequires: rpmbuild(macros) >= 1.710
-
+BuildRequires: python-modules >= 1:2.6
+BuildRequires: python-pytest
+BuildRequires: python-setuptools
+BuildRequires: python-werkzeug >= 0.7
 %endif
 %if %{with python3}
-BuildRequires: python3-devel
-BuildRequires: python3-distribute
+BuildRequires: python3-click >= 2.0
+BuildRequires: python3-devel >= 1:3.3
+BuildRequires: python3-itsdangerous >= 0.21
 BuildRequires: python3-jinja2 >= 2.4
-BuildRequires: python3-modules
-BuildRequires: python3-werkzeug >= 0.6.1
+BuildRequires: python3-modules >= 1:3.3
+BuildRequires: python3-pytest
+BuildRequires: python3-setuptools
+BuildRequires: python3-werkzeug >= 0.7
 %endif
-
-Requires:      python-itsdangerous
-Requires:      python-jinja2 >= 2.4
-Requires:      python-modules
-Requires:      python-werkzeug >= 0.6.1
+%if %{with doc}
+BuildRequires: sphinx-pdg
+%endif
+BuildRequires: rpm-pythonprov
+BuildRequires: rpmbuild(macros) >= 1.714
+Requires:      python-modules >= 1:2.6
 BuildArch:     noarch
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -46,60 +54,80 @@ BuildRoot:  %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 Flask is a microframework for Python based on Werkzeug, Jinja 2 and
 good intentions.
 
+%description -l pl.UTF-8
+Flask to mikroszkielet dla Pythona oparty na modułach Werkzeug i
+Jinja2 oraz dobrych intencjach.
+
 %package -n python3-%{module}
-Summary:       -
-Summary(pl.UTF-8):     -
+Summary:       A microframework based on Werkzeug, Jinja2 and good intentions
+Summary(pl.UTF-8):     Mikroszkielet oparty na Werkzeugu, Jinja2 i dobrych intencjach
 Group:         Libraries/Python
-Requires:      python3-itsdangerous
-Requires:      python3-jinja2 >= 2.4
-Requires:      python3-modules
-Requires:      python3-werkzeug >= 0.6.1
+Requires:      python3-modules >= 1:3.3
 
 %description -n python3-%{module}
 Flask is a microframework for Python based on Werkzeug, Jinja 2 and
 good intentions.
 
-# %description -n python3-%{module} -l pl.UTF-8
+%description -n python3-%{module} -l pl.UTF-8
+Flask to mikroszkielet dla Pythona oparty na modułach Werkzeug i
+Jinja2 oraz dobrych intencjach.
+
+%package apidocs
+Summary:       Documentation for Python Flask package
+Summary(pl.UTF-8):     Dokumentacja do pakietu Pythona Flask
+Group:         Documentation
 
+%description apidocs
+Documentation for Python Flask package.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja do pakietu Pythona Flask.
 
 %prep
 %setup -q -n Flask-%{version}
+%patch0 -p1
 
 %build
 %if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%{?with_tests:%{__python} -m pytest tests}
 %endif
 
 %if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%{?with_tests:LC_ALL=C.UTF-8 %{__python3} -m pytest tests}
+%endif
+
+%if %{with doc}
+PYTHONPATH=$(pwd) \
+%{__make} -C docs html
 %endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
 
+%if %{with python3}
+%py3_install
+
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/flask{,-3}
+
+install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
+%endif
+
 %if %{with python2}
 %py_install
 
 %py_postclean
-%endif
 
-%if %{with python3}
-%py3_install
-%endif
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/flask{,-2}
+ln -sf flask-2 $RPM_BUILD_ROOT%{_bindir}/flask
 
-# in case there are examples provided
-%if %{with python2}
 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
 %endif
-%if %{with python3}
-install -d $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
-cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version}
-find $RPM_BUILD_ROOT%{_examplesdir}/python3-%{module}-%{version} -name '*.py' \
-        | xargs sed -i '1s|^#!.*python\b|#!%{__python3}|'
-%endif
-
-
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -107,10 +135,12 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python2}
 %files
 %defattr(644,root,root,755)
-%doc AUTHORS CHANGES README
-%{py_sitescriptdir}/%{module}
+%doc AUTHORS CHANGES LICENSE README
+%attr(755,root,root) %{_bindir}/flask
+%attr(755,root,root) %{_bindir}/flask-2
+%{py_sitescriptdir}/flask
 %if "%{py_ver}" > "2.4"
-%{py_sitescriptdir}/Flask-*.egg-info
+%{py_sitescriptdir}/Flask-%{version}-py*.egg-info
 %endif
 %{_examplesdir}/%{name}-%{version}
 %endif
@@ -118,8 +148,15 @@ rm -rf $RPM_BUILD_ROOT
 %if %{with python3}
 %files -n python3-%{module}
 %defattr(644,root,root,755)
-%doc AUTHORS CHANGES LICENSE
-%{py3_sitescriptdir}/%{module}
+%doc AUTHORS CHANGES LICENSE README
+%attr(755,root,root) %{_bindir}/flask-3
+%{py3_sitescriptdir}/flask
 %{py3_sitescriptdir}/Flask-%{version}-py*.egg-info
 %{_examplesdir}/python3-%{module}-%{version}
 %endif
+
+%if %{with doc}
+%files apidocs
+%defattr(644,root,root,755)
+%doc docs/_build/html/{_images,_static,deploying,patterns,tutorial,*.html,*.js}
+%endif
This page took 0.138638 seconds and 4 git commands to generate.