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
+}

Reply via email to