public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-python/mechanize/files/, dev-python/mechanize/
@ 2024-04-21 11:57 Michał Górny
  0 siblings, 0 replies; 3+ messages in thread
From: Michał Górny @ 2024-04-21 11:57 UTC (permalink / raw
  To: gentoo-commits

commit:     07a32969d5e4a1e81f5e6cee1ec2d0d0e44fedd8
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 11:56:18 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 11:57:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=07a32969

dev-python/mechanize: Backport a test fix

Closes: https://bugs.gentoo.org/930257
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../mechanize/files/mechanize-0.4.9-test.patch     | 23 ++++++++++++++++++++++
 dev-python/mechanize/mechanize-0.4.9.ebuild        |  9 +++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/dev-python/mechanize/files/mechanize-0.4.9-test.patch b/dev-python/mechanize/files/mechanize-0.4.9-test.patch
new file mode 100644
index 000000000000..369cbe9495e1
--- /dev/null
+++ b/dev-python/mechanize/files/mechanize-0.4.9-test.patch
@@ -0,0 +1,23 @@
+From 1324b09b661aaac7d4cdc7e1e9d49e1c3851db2c Mon Sep 17 00:00:00 2001
+From: Martin Weinelt <hexa@darmstadt.ccc.de>
+Date: Sun, 21 Apr 2024 13:05:45 +0200
+Subject: [PATCH] Fix test_ftp mime type expectation on 3.11+
+
+Closes: #94
+---
+ test/test_urllib2.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/test/test_urllib2.py b/test/test_urllib2.py
+index e9b96fd..c46a2fc 100644
+--- a/test/test_urllib2.py
++++ b/test/test_urllib2.py
+@@ -864,7 +864,7 @@ def connect_ftp(self, user, passwd, host, port, dirs, timeout):
+              ["foo", "bar"], _sockettimeout._GLOBAL_DEFAULT_TIMEOUT, "", None),
+             ("ftp://localhost/baz.gif;type=a", "localhost", ftplib.FTP_PORT,
+              "A", [], _sockettimeout._GLOBAL_DEFAULT_TIMEOUT, "baz.gif",
+-             None),  # TODO: really this should guess image/gif
++             "image/gif" if sys.version_info >= (3, 11) else None),
+         ]:
+             req = Request(url, timeout=timeout)
+             r = h.ftp_open(req)

diff --git a/dev-python/mechanize/mechanize-0.4.9.ebuild b/dev-python/mechanize/mechanize-0.4.9.ebuild
index 9f450d7fd6b3..801db8146541 100644
--- a/dev-python/mechanize/mechanize-0.4.9.ebuild
+++ b/dev-python/mechanize/mechanize-0.4.9.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -29,6 +29,11 @@ BDEPEND="
 	)
 "
 
+PATCHES=(
+	# https://github.com/python-mechanize/mechanize/pull/95
+	"${FILESDIR}/${P}-test.patch"
+)
+
 python_test() {
-	"${EPYTHON}" run_tests.py || die
+	"${EPYTHON}" run_tests.py -v || die
 }


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/mechanize/files/, dev-python/mechanize/
@ 2022-06-01  7:30 Sam James
  0 siblings, 0 replies; 3+ messages in thread
From: Sam James @ 2022-06-01  7:30 UTC (permalink / raw
  To: gentoo-commits

commit:     fafc85759cc72fafd2b6ce6cd08569dee5268ed4
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  1 07:25:24 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 07:25:37 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fafc8575

dev-python/mechanize: enable py3.11

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../mechanize-0.4.8-python3.11-test-order.patch    | 79 ++++++++++++++++++++++
 dev-python/mechanize/mechanize-0.4.8.ebuild        |  6 +-
 2 files changed, 84 insertions(+), 1 deletion(-)

diff --git a/dev-python/mechanize/files/mechanize-0.4.8-python3.11-test-order.patch b/dev-python/mechanize/files/mechanize-0.4.8-python3.11-test-order.patch
new file mode 100644
index 000000000000..0808460dcc67
--- /dev/null
+++ b/dev-python/mechanize/files/mechanize-0.4.8-python3.11-test-order.patch
@@ -0,0 +1,79 @@
+https://github.com/python-mechanize/mechanize/commit/529d2c4cb8f31284f8026642968ba3adb9de1171
+https://github.com/python-mechanize/mechanize/commit/7ba3d586368c03577c061c35bc27664a907f5435
+https://github.com/python-mechanize/mechanize/commit/560839d51e54943890c2d37c0d0854792479cb80
+
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Tue, 24 May 2022 11:13:16 +0530
+Subject: [PATCH] Use asserts for failing test so we get better feedback on the
+ failure
+
+--- a/test/test_cookies.py
++++ b/test/test_cookies.py
+@@ -1028,10 +1028,10 @@ def test_Cookie_iterator(self):  # noqa
+             i = 0
+             for c in cs:
+                 # assert isinstance(c, Cookie)
+-                assert c.version == versions[i]
+-                assert c.name == names[i]
+-                assert c.domain == domains[i]
+-                assert c.path == paths[i]
++                self.assertEqual(c.version, versions[i])
++                self.assertEqual(c.name, names[i])
++                self.assertEqual(c.domain, domains[i])
++                self.assertEqual(c.path, paths[i])
+                 i = i + 1
+ 
+         self.assertRaises(IndexError, lambda cs=cs: cs[5])
+
+From: Kovid Goyal <kovid@kovidgoyal.net>
+Date: Tue, 24 May 2022 17:54:50 +0530
+Subject: [PATCH] DRYer
+
+--- a/test/test_cookies.py
++++ b/test/test_cookies.py
+@@ -1025,14 +1025,9 @@ def test_Cookie_iterator(self):  # noqa
+ 
+         # sequential iteration
+         for i in range(4):
+-            i = 0
+-            for c in cs:
++            for c, expected in zip(cs, zip(versions, names, domains, paths)):
+                 # assert isinstance(c, Cookie)
+-                self.assertEqual(c.version, versions[i])
+-                self.assertEqual(c.name, names[i])
+-                self.assertEqual(c.domain, domains[i])
+-                self.assertEqual(c.path, paths[i])
+-                i = i + 1
++                self.assertEqual((c.version, c.name, c.domain, c.path), expected)
+ 
+         self.assertRaises(IndexError, lambda cs=cs: cs[5])
+ 
+Date: Tue, 24 May 2022 18:09:16 +0530
+Subject: [PATCH] Change test to not rely on order of cookie iteration
+
+python 3.11 iterates in add order, earlier pythons iterate in domain
+sorted order
+
+Fix #74
+--- a/test/test_cookies.py
++++ b/test/test_cookies.py
+@@ -1022,13 +1022,12 @@ def test_Cookie_iterator(self):  # noqa
+             "www.acme.com"
+         ]
+         paths = ["/", "/", "/", "/blah", "/blah/"]
+-
++        expected = set(zip(versions, names, domains, paths))
+         # sequential iteration
+-        for i in range(4):
+-            for c, expected in zip(cs, zip(versions, names, domains, paths)):
+-                # assert isinstance(c, Cookie)
+-                self.assertEqual((c.version, c.name, c.domain, c.path), expected)
+-
++        # python 3.11 iterates in add order, earlier pythons iterate in domain
++        # sorted order
++        actual = {(c.version, c.name, c.domain, c.path) for c in cs}
++        self.assertEqual(expected, actual)
+         self.assertRaises(IndexError, lambda cs=cs: cs[5])
+ 
+     def test_parse_ns_headers(self):
+

diff --git a/dev-python/mechanize/mechanize-0.4.8.ebuild b/dev-python/mechanize/mechanize-0.4.8.ebuild
index c8d729b6ea5e..327456a039dd 100644
--- a/dev-python/mechanize/mechanize-0.4.8.ebuild
+++ b/dev-python/mechanize/mechanize-0.4.8.ebuild
@@ -4,7 +4,7 @@
 EAPI=8
 
 DISTUTILS_USE_PEP517=setuptools
-PYTHON_COMPAT=( python3_{8..10} )
+PYTHON_COMPAT=( python3_{8..11} )
 inherit distutils-r1
 
 DESCRIPTION="Stateful programmatic web browsing in Python"
@@ -24,6 +24,10 @@ BDEPEND="
 	)
 "
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-0.4.8-python3.11-test-order.patch
+)
+
 python_test() {
 	"${EPYTHON}" run_tests.py || die
 }


^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-python/mechanize/files/, dev-python/mechanize/
@ 2021-08-07 13:25 Louis Sautier
  0 siblings, 0 replies; 3+ messages in thread
From: Louis Sautier @ 2021-08-07 13:25 UTC (permalink / raw
  To: gentoo-commits

commit:     7b96644c1436f391a309d3fd7393e720573356a0
Author:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  7 13:05:20 2021 +0000
Commit:     Louis Sautier <sbraz <AT> gentoo <DOT> org>
CommitDate: Sat Aug  7 13:25:02 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b96644c

dev-python/mechanize: enable py3.10, fix deps

Remove unused doc USE-flag since the tarball doesn't contain
documentation.

Signed-off-by: Louis Sautier <sbraz <AT> gentoo.org>

 .../mechanize/files/mechanize-0.4.5-py310.patch    | 28 +++++++++++++++++
 dev-python/mechanize/mechanize-0.4.5-r1.ebuild     | 35 ++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff --git a/dev-python/mechanize/files/mechanize-0.4.5-py310.patch b/dev-python/mechanize/files/mechanize-0.4.5-py310.patch
new file mode 100644
index 00000000000..98656b65425
--- /dev/null
+++ b/dev-python/mechanize/files/mechanize-0.4.5-py310.patch
@@ -0,0 +1,28 @@
+diff --git a/mechanize/_clientcookie.py b/mechanize/_clientcookie.py
+index ebd2773..6c89cbf 100644
+--- a/mechanize/_clientcookie.py
++++ b/mechanize/_clientcookie.py
+@@ -188,13 +188,22 @@ class CookieJar(CJ):
+         raise IndexError()
+ 
+ 
++try:
++    from http.cookiejar import NETSCAPE_MAGIC_RGX, NETSCAPE_HEADER_TEXT
++except ImportError:  # python < 3.10
++    NETSCAPE_MAGIC_RGX = MCJ.magic_re
++    NETSCAPE_HEADER_TEXT = MCJ.header
++else:
++    MCJ.header = NETSCAPE_HEADER_TEXT  # needed for tests
++
++
+ class MozillaCookieJar(MCJ):
+ 
+     def _really_load(self, f, filename, ignore_discard, ignore_expires):
+         now = time.time()
+ 
+         magic = f.readline()
+-        if not re.search(self.magic_re, magic):
++        if not re.search(NETSCAPE_MAGIC_RGX, magic):
+             f.close()
+             raise LoadError(
+                 "%r does not look like a Netscape format cookies file" %

diff --git a/dev-python/mechanize/mechanize-0.4.5-r1.ebuild b/dev-python/mechanize/mechanize-0.4.5-r1.ebuild
new file mode 100644
index 00000000000..01bc41260c6
--- /dev/null
+++ b/dev-python/mechanize/mechanize-0.4.5-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{7..10} )
+
+inherit distutils-r1
+
+DESCRIPTION="Stateful programmatic web browsing in Python"
+HOMEPAGE="https://github.com/python-mechanize/mechanize"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="|| ( BSD ZPL )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND=">=dev-python/html5lib-0.999999999[${PYTHON_USEDEP}]"
+BDEPEND="
+	test? (
+		${RDEPEND}
+	)
+"
+
+PATCHES=(
+	# https://github.com/python-mechanize/mechanize/commit/2a563ec4fbc394ec5976dda0f528db43d28a2706
+	# https://github.com/python-mechanize/mechanize/commit/bc6a2ca7b17e11f2533ada67f0bf92124d4a3cac
+	"${FILESDIR}/${P}-py310.patch"
+)
+
+python_test() {
+	"${EPYTHON}" run_tests.py || die
+}


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-21 11:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-21 11:57 [gentoo-commits] repo/gentoo:master commit in: dev-python/mechanize/files/, dev-python/mechanize/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2022-06-01  7:30 Sam James
2021-08-07 13:25 Louis Sautier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox