summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Sautier <sbraz@gentoo.org>2021-08-07 15:05:20 +0200
committerLouis Sautier <sbraz@gentoo.org>2021-08-07 15:25:02 +0200
commit7b96644c1436f391a309d3fd7393e720573356a0 (patch)
treec8dc1f40e5984bdecdffbd69312cb3f32a4ef894 /dev-python/mechanize
parentsci-libs/fflas-ffpack: fix linking with slibtool. (diff)
downloadgentoo-7b96644c1436f391a309d3fd7393e720573356a0.tar.gz
gentoo-7b96644c1436f391a309d3fd7393e720573356a0.tar.bz2
gentoo-7b96644c1436f391a309d3fd7393e720573356a0.zip
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@gentoo.org>
Diffstat (limited to 'dev-python/mechanize')
-rw-r--r--dev-python/mechanize/files/mechanize-0.4.5-py310.patch28
-rw-r--r--dev-python/mechanize/mechanize-0.4.5-r1.ebuild35
2 files changed, 63 insertions, 0 deletions
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 000000000000..98656b65425f
--- /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 000000000000..01bc41260c68
--- /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
+}