testing/py3-ioflo: backport python 3.9 fixes

This commit is contained in:
Natanael Copa 2021-04-02 11:13:22 +00:00
parent 1f70f81015
commit f72fb0fb60
2 changed files with 61 additions and 4 deletions

View File

@ -3,15 +3,17 @@
pkgname=py3-ioflo
_pkgname=ioflo
pkgver=2.0.2
pkgrel=0
pkgrel=1
pkgdesc="Automated Reasoning Engine and Flow Based Programming Framework"
url="https://github.com/ioflo/ioflo"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-setuptools-git"
makedepends="py3-setuptools-git py3-setuptools"
checkdepends="py3-pytest"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
python-3.9.patch
"
builddir="$srcdir"/$_pkgname-$pkgver
replaces="py-ioflo" # Backwards compatibility
@ -32,4 +34,5 @@ package() {
rm -f "$pkgdir"/usr/bin/ioflo3
}
sha512sums="7f704ccd5680b612d63990915259999e967d87dadd25608143dbc6ecf7a7679eb33f1c11c2d490a358845946add668e6014b80705db8701127b5d05ac436cc4b ioflo-2.0.2.tar.gz"
sha512sums="7f704ccd5680b612d63990915259999e967d87dadd25608143dbc6ecf7a7679eb33f1c11c2d490a358845946add668e6014b80705db8701127b5d05ac436cc4b ioflo-2.0.2.tar.gz
f951ce837fbe501535b6baab8e4f998af14660c0ec375e01b2526fd848c8d24ceae822263a256befea75163fade36ab059c775b53d5e96fe514097516d9d5726 python-3.9.patch"

View File

@ -0,0 +1,54 @@
From 2961d846dd250334b8fc52c2ef4c00ebc36ed510 Mon Sep 17 00:00:00 2001
From: Felix Yan <felixonmars@archlinux.org>
Date: Fri, 20 Nov 2020 04:42:02 +0800
Subject: [PATCH] Fix compatibility with Python 3.9
json.loads() removed encoding parameter
(https://bugs.python.org/issue39377)
It was a no-op since 3.1.
---
ioflo/aio/http/clienting.py | 4 ++--
ioflo/aio/http/httping.py | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/ioflo/aio/http/clienting.py b/ioflo/aio/http/clienting.py
index 11132e3..967570e 100644
--- a/ioflo/aio/http/clienting.py
+++ b/ioflo/aio/http/clienting.py
@@ -268,13 +268,13 @@ def build(self):
'\r\n{2}'.format(boundary, key, val))
formParts.append('\r\n--{0}--'.format(boundary))
form = "".join(formParts)
- body = form.encode(encoding='utf-8')
+ body = form.encode('utf-8')
self.headers[u'content-type'] = u'multipart/form-data; boundary={0}'.format(boundary)
else:
formParts = [u"{0}={1}".format(key, val) for key, val in self.fargs.items()]
form = u'&'.join(formParts)
form = quote_plus(form, '&=')
- body = form.encode(encoding='utf-8')
+ body = form.encode('utf-8')
self.headers[u'content-type'] = u'application/x-www-form-urlencoded; charset=utf-8'
else: # body last in precendence
body = self.body
diff --git a/ioflo/aio/http/httping.py b/ioflo/aio/http/httping.py
index ba604e7..a22cc84 100644
--- a/ioflo/aio/http/httping.py
+++ b/ioflo/aio/http/httping.py
@@ -746,7 +746,7 @@ def parseEvents(self):
if edata: # data so dispatch event by appending to .events
if self.dictable:
try:
- ejson = json.loads(edata, encoding='utf-8', object_pairs_hook=odict)
+ ejson = json.loads(edata, object_pairs_hook=odict)
except ValueError as ex:
ejson = None
else: # valid json set edata to ejson
@@ -1058,7 +1058,6 @@ def dictify(self):
if self.jsoned or self.dictable: # attempt to deserialize json
try:
self.data = json.loads(self.body.decode('utf-8'),
- encoding='utf-8',
object_pairs_hook=odict)
except ValueError as ex:
self.data = None