summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-06-12 16:35:07 +0200
committerMichał Górny <mgorny@gentoo.org>2020-06-12 17:40:09 +0200
commit5695f869596291ca227e11ec7b42fd888e46f9ed (patch)
tree51dec41012b6ed9efc631ffb7ab01295b1cc1cf7 /dev-python/feedparser
parentdev-python/feedparser: Bump to 6.0.0b1 (diff)
downloadgentoo-5695f869596291ca227e11ec7b42fd888e46f9ed.tar.gz
gentoo-5695f869596291ca227e11ec7b42fd888e46f9ed.tar.bz2
gentoo-5695f869596291ca227e11ec7b42fd888e46f9ed.zip
dev-python/feedparser: Port to py3.9
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/feedparser')
-rw-r--r--dev-python/feedparser/feedparser-6.0.0_beta1.ebuild6
-rw-r--r--dev-python/feedparser/files/feedparser-6.0.0_beta1-py39.patch89
2 files changed, 94 insertions, 1 deletions
diff --git a/dev-python/feedparser/feedparser-6.0.0_beta1.ebuild b/dev-python/feedparser/feedparser-6.0.0_beta1.ebuild
index c85240293a47..1b027df23193 100644
--- a/dev-python/feedparser/feedparser-6.0.0_beta1.ebuild
+++ b/dev-python/feedparser/feedparser-6.0.0_beta1.ebuild
@@ -3,7 +3,7 @@
EAPI=7
-PYTHON_COMPAT=( python3_{6..8} pypy3 )
+PYTHON_COMPAT=( python3_{6..9} pypy3 )
inherit distutils-r1
@@ -24,6 +24,10 @@ RDEPEND="dev-python/sgmllib3k[${PYTHON_USEDEP}]"
distutils_enable_tests unittest
+PATCHES=(
+ "${FILESDIR}"/${P}-py39.patch
+)
+
src_prepare() {
# broken
rm \
diff --git a/dev-python/feedparser/files/feedparser-6.0.0_beta1-py39.patch b/dev-python/feedparser/files/feedparser-6.0.0_beta1-py39.patch
new file mode 100644
index 000000000000..f9315e47809c
--- /dev/null
+++ b/dev-python/feedparser/files/feedparser-6.0.0_beta1-py39.patch
@@ -0,0 +1,89 @@
+From fa587d171aed1b44ee06af271d718ab6fa73b77a Mon Sep 17 00:00:00 2001
+From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
+Date: Wed, 26 Feb 2020 22:06:39 +0530
+Subject: [PATCH 1/2] Use encodebytes instead of encodestring in Python 3.9.
+
+---
+ feedparser/http.py | 5 ++++-
+ feedparser/mixin.py | 5 ++++-
+ 2 files changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/feedparser/http.py b/feedparser/http.py
+index 272faad6..53511f02 100644
+--- a/feedparser/http.py
++++ b/feedparser/http.py
+@@ -73,7 +73,10 @@ class request(object):
+
+ # Python 3.1 deprecated decodestring in favor of decodebytes.
+ # This can be removed after Python 2.7 support is dropped.
+-_base64decode = getattr(base64, 'decodebytes', base64.decodestring)
++try:
++ _base64decode = base64.decodebytes
++except AttributeError:
++ _base64decode = base64.decodestring
+
+ try:
+ basestring
+diff --git a/feedparser/mixin.py b/feedparser/mixin.py
+index 1b0dc1ae..549931f5 100644
+--- a/feedparser/mixin.py
++++ b/feedparser/mixin.py
+@@ -50,7 +50,10 @@
+
+ # Python 2.7 only offers "decodestring()".
+ # This name substitution can be removed when Python 2.7 support is dropped.
+-_base64decode = getattr(base64, 'decodebytes', base64.decodestring)
++try:
++ _base64decode = base64.decodebytes
++except AttributeError:
++ _base64decode = base64.decodestring
+
+
+ bytes_ = type(b'')
+
+From 7798957b66c9cee00db9a18f84c518cacf8f14aa Mon Sep 17 00:00:00 2001
+From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
+Date: Sun, 17 May 2020 14:25:17 +0000
+Subject: [PATCH 2/2] Use base64.decodebytes only in Python 3
+
+---
+ feedparser/http.py | 7 +------
+ feedparser/mixin.py | 7 +------
+ 2 files changed, 2 insertions(+), 12 deletions(-)
+
+diff --git a/feedparser/http.py b/feedparser/http.py
+index 53511f02..1119cb3b 100644
+--- a/feedparser/http.py
++++ b/feedparser/http.py
+@@ -71,12 +71,7 @@ class request(object):
+ from .datetimes import _parse_date
+ from .urls import convert_to_idn
+
+-# Python 3.1 deprecated decodestring in favor of decodebytes.
+-# This can be removed after Python 2.7 support is dropped.
+-try:
+- _base64decode = base64.decodebytes
+-except AttributeError:
+- _base64decode = base64.decodestring
++_base64decode = base64.decodebytes
+
+ try:
+ basestring
+diff --git a/feedparser/mixin.py b/feedparser/mixin.py
+index 549931f5..119fa4ca 100644
+--- a/feedparser/mixin.py
++++ b/feedparser/mixin.py
+@@ -48,12 +48,7 @@
+ from .urls import _urljoin, make_safe_absolute_uri, resolve_relative_uris
+
+
+-# Python 2.7 only offers "decodestring()".
+-# This name substitution can be removed when Python 2.7 support is dropped.
+-try:
+- _base64decode = base64.decodebytes
+-except AttributeError:
+- _base64decode = base64.decodestring
++_base64decode = base64.decodebytes
+
+
+ bytes_ = type(b'')