14
0

Accepting request 1076397 from devel:languages:python

- Add patch support-python-311.patch:
  * http.cookiejar changed behaviour from Python 3.11 onwards, support
    both.

OBS-URL: https://build.opensuse.org/request/show/1076397
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-mechanize?expand=0&rev=31
This commit is contained in:
2023-03-31 19:15:57 +00:00
committed by Git OBS Bridge
3 changed files with 47 additions and 4 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Mar 31 07:05:30 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-python-311.patch:
* http.cookiejar changed behaviour from Python 3.11 onwards, support
both.
-------------------------------------------------------------------
Tue Oct 11 02:02:03 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -17,7 +17,6 @@
%define modname mechanize
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-mechanize
Version: 0.4.8
Release: 0
@@ -26,7 +25,10 @@ License: BSD-3-Clause AND (BSD-3-Clause OR ZPL-2.1)
URL: https://github.com/python-mechanize/mechanize
Source: https://files.pythonhosted.org/packages/source/m/mechanize/%{modname}-%{version}.tar.gz
# PATCH-FIX-UPSTREAM python-mechanize-setup.cfg.patch gh#python-mechanize/mechanize#73 -- setup.cfg: Move packages def to options section
Patch1: %{name}-setup.cfg.patch
Patch0: %{name}-setup.cfg.patch
# PATCH-FIX-OPENSUSE Python 3.11 no longer sorts cookies by key when iterating
# Re: gh#python/cpython#22745
Patch1: support-python-311.patch
BuildRequires: %{python_module Twisted}
BuildRequires: %{python_module html5lib}
BuildRequires: %{python_module setuptools}
@@ -43,8 +45,7 @@ programmatically with HTML form filling and clicking
of links.
%prep
%setup -q -n %{modname}-%{version}
%patch1 -p1
%autosetup -p1 -n %{modname}-%{version}
sed -i -e '1{/^#!\/usr\/bin\/env python/d}' %{modname}/{_entities,_equiv,_form_controls,polyglot}.py
sed -i -e '1{/^#!/d}' examples/forms/{echo.cgi,example.py,simple.py}
chmod -x examples/forms/{echo.cgi,example.py,simple.py}

35
support-python-311.patch Normal file
View File

@@ -0,0 +1,35 @@
Index: mechanize-0.4.8/test/test_cookies.py
===================================================================
--- mechanize-0.4.8.orig/test/test_cookies.py
+++ mechanize-0.4.8/test/test_cookies.py
@@ -1015,13 +1015,23 @@ class CookieTests(unittest.TestCase):
r'port="90,100, 80,8080"; '
r'max-age=100; Comment = "Just kidding! (\"|\\\\) "')
- versions = [1, 1, 1, 0, 1]
- names = ["bang", "foo", "foo", "spam", "foo"]
- domains = [
- ".sol.no", "blah.spam.org", "www.acme.com", "www.acme.com",
- "www.acme.com"
- ]
- paths = ["/", "/", "/", "/blah", "/blah/"]
+ # Python 3.11+ no longer sort cookies when returning them.
+ if sys.version_info >= (3, 11):
+ versions = [1, 0, 1, 1, 1]
+ names = ["foo", "spam", "foo", "foo", "bang"]
+ domains = [
+ "blah.spam.org", "www.acme.com", "www.acme.com",
+ "www.acme.com", ".sol.no"
+ ]
+ paths = ["/", "/blah", "/blah/", "/", "/"]
+ else:
+ versions = [1, 1, 1, 0, 1]
+ names = ["bang", "foo", "foo", "spam", "foo"]
+ domains = [
+ ".sol.no", "blah.spam.org", "www.acme.com", "www.acme.com",
+ "www.acme.com"
+ ]
+ paths = ["/", "/", "/", "/blah", "/blah/"]
# sequential iteration
for i in range(4):