[packages/python-responses] - updated to 0.12.1 - added py2 patch (fixes unicode cookies creation under python2)
qboosh
qboosh at pld-linux.org
Sun Feb 14 18:45:34 CET 2021
commit 0e5595bce2d3feb2c7943566f395a679c5f01edd
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sun Feb 14 18:46:01 2021 +0100
- updated to 0.12.1
- added py2 patch (fixes unicode cookies creation under python2)
python-responses-py2.patch | 19 ++++++++++++
python-responses.spec | 73 +++++++++++++++++++++++++++++++---------------
2 files changed, 68 insertions(+), 24 deletions(-)
---
diff --git a/python-responses.spec b/python-responses.spec
index a989360..9039d88 100644
--- a/python-responses.spec
+++ b/python-responses.spec
@@ -1,7 +1,6 @@
-# NOTE: skipping tests due to missing dependencies: python-pytest-localserver
#
# Conditional build:
-%bcond_with tests # do not perform "make test"
+%bcond_without tests # unit tests
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
@@ -9,43 +8,48 @@
%define egg_name responses
%define pypi_name responses
Summary: A utility for mocking out the Python Requests library
+Summary(pl.UTF-8): Narzędzie do podstawiania atrap biblioteki Python Requests
Name: python-%{pypi_name}
-Version: 0.9.0
+Version: 0.12.1
Release: 1
License: Apache v2.0
+#Source0Download: https://github.com/getsentry/responses/releases
Source0: https://github.com/getsentry/responses/archive/%{version}/%{pypi_name}-%{version}.tar.gz
-# Source0-md5: 70b7510b9bcd87046ba450b440b7543d
+# Source0-md5: afbac75fad56fe130f7915ce6feff0db
+Patch0: %{name}-py2.patch
Group: Libraries/Python
URL: https://github.com/getsentry/responses
BuildRequires: rpm-pythonprov
BuildRequires: rpmbuild(macros) >= 1.714
%if %{with python2}
-BuildRequires: python-modules
+BuildRequires: python-modules >= 1:2.7
BuildRequires: python-setuptools
%endif
%if %{with python3}
%if %{with tests}
BuildRequires: python-cookies
-BuildRequires: python-coverage
+BuildRequires: python-coverage >= 3.7.1
BuildRequires: python-flake8
BuildRequires: python-mock
-BuildRequires: python-pytest
+BuildRequires: python-pytest >= 4.6
BuildRequires: python-pytest-cov
-BuildRequires: python-requests
+BuildRequires: python-pytest-localserver
+BuildRequires: python-requests >= 2.0
+BuildRequires: python-urllib3 >= 1.25.10
BuildRequires: python-six
%endif
%endif
%if %{with python3}
-BuildRequires: python3-modules
+BuildRequires: python3-modules >= 1:3.5
BuildRequires: python3-setuptools
%if %{with tests}
-BuildRequires: python3-cookies
-BuildRequires: python3-coverage
+BuildRequires: python3-coverage >= 3.7.1
BuildRequires: python3-flake8
-BuildRequires: python3-mock
-BuildRequires: python3-pytest
+BuildRequires: python3-pytest >= 4.6
BuildRequires: python3-pytest-cov
-BuildRequires: python3-requests
+BuildRequires: python3-pytest-localserver
+BuildRequires: python3-requests >= 2.0
+BuildRequires: python3-urllib3 >= 1.25.10
BuildRequires: python3-six
%endif
%endif
@@ -55,37 +59,58 @@ BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
A utility library for mocking out the requests Python library.
+%description -l pl.UTF-8
+Biblioteka narzędziowa do podstawiania atrap biblioteki Pythona
+requests.
+
%package -n python3-%{pypi_name}
Summary: A utility for mocking out the Python Requests library
+Summary(pl.UTF-8): Narzędzie do podstawiania atrap biblioteki Python Requests
Group: Libraries/Python
%description -n python3-%{pypi_name}
A utility library for mocking out the requests Python library.
+%description -n python3-%{pypi_name} -l pl.UTF-8
+Biblioteka narzędziowa do podstawiania atrap biblioteki Pythona
+requests.
+
%prep
%setup -q -n %{pypi_name}-%{version}
+%patch0 -p1
%build
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS="pytest_localserver.plugin" \
+%{__python} -m pytest test_responses.py
+%endif
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
+
+%if %{with tests}
+PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
+PYTEST_PLUGINS="pytest_localserver.plugin" \
+%{__python3} -m pytest test_responses.py
+%endif
%endif
%install
rm -rf $RPM_BUILD_ROOT
+
%if %{with python2}
%py_install
+
%py_postclean
-%{__rm} $RPM_BUILD_ROOT%{py_sitescriptdir}/test_responses.py*
%endif
%if %{with python3}
%py3_install
-%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/test_responses.py
-%{__rm} $RPM_BUILD_ROOT%{py3_sitescriptdir}/__pycache__/test_responses.*.pyc
%endif
%clean
@@ -94,16 +119,16 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python2}
%files
%defattr(644,root,root,755)
-%doc README.rst LICENSE
-%{py_sitescriptdir}/%{module}.py[co]
+%doc CHANGES README.rst
+%{py_sitescriptdir}/responses.py[co]
%{py_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
%endif
%if %{with python3}
%files -n python3-%{pypi_name}
%defattr(644,root,root,755)
-%doc README.rst LICENSE
-%{py3_sitescriptdir}/%{module}.py
-%{py3_sitescriptdir}/__pycache__/%{module}.cpython-*.pyc
+%doc CHANGES README.rst
+%{py3_sitescriptdir}/responses.py
+%{py3_sitescriptdir}/__pycache__/responses.cpython-*.pyc
%{py3_sitescriptdir}/%{egg_name}-%{version}-py*.egg-info
%endif
diff --git a/python-responses-py2.patch b/python-responses-py2.patch
new file mode 100644
index 0000000..c4c9aec
--- /dev/null
+++ b/python-responses-py2.patch
@@ -0,0 +1,19 @@
+--- responses-0.12.1/responses.py.orig 2020-11-12 07:48:06.000000000 +0100
++++ responses-0.12.1/responses.py 2021-02-14 18:40:46.615255256 +0100
+@@ -122,14 +122,14 @@
+
+
+ def _cookies_from_headers(headers):
+- try:
++ if six.PY3: # http.cookies.SimpleCookie().load() from future fails with unicode input
+ import http.cookies as cookies
+
+ resp_cookie = cookies.SimpleCookie()
+ resp_cookie.load(headers["set-cookie"])
+
+ cookies_dict = {name: v.value for name, v in resp_cookie.items()}
+- except ImportError:
++ else:
+ from cookies import Cookies
+
+ resp_cookies = Cookies.from_request(_ensure_str(headers["set-cookie"]))
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-responses.git/commitdiff/0e5595bce2d3feb2c7943566f395a679c5f01edd
More information about the pld-cvs-commit
mailing list