[arch-commits] Commit in python-dnspython/repos (3 files)

Jelle van der Waa jelle at gemini.archlinux.org
Tue Aug 31 19:27:23 UTC 2021


    Date: Tuesday, August 31, 2021 @ 19:27:23
  Author: jelle
Revision: 1010206

archrelease: copy trunk to community-testing-any

Added:
  python-dnspython/repos/community-testing-any/
  python-dnspython/repos/community-testing-any/PKGBUILD
    (from rev 1010205, python-dnspython/trunk/PKGBUILD)
  python-dnspython/repos/community-testing-any/py39.patch
    (from rev 1010205, python-dnspython/trunk/py39.patch)

------------+
 PKGBUILD   |   48 +++++++++++++++++++++++++++++++++++
 py39.patch |   79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 127 insertions(+)

Copied: python-dnspython/repos/community-testing-any/PKGBUILD (from rev 1010205, python-dnspython/trunk/PKGBUILD)
===================================================================
--- community-testing-any/PKGBUILD	                        (rev 0)
+++ community-testing-any/PKGBUILD	2021-08-31 19:27:23 UTC (rev 1010206)
@@ -0,0 +1,48 @@
+# Maintainer: Sergej Pupykin <pupykin.s+arch at gmail.com>
+# Contributor: Mathijs Kadijk <maccain13 at gmail.com>
+
+_name=dnspython
+pkgname=python-dnspython
+pkgver=2.1.0
+pkgrel=1
+epoch=1
+pkgdesc="A DNS toolkit for Python"
+arch=('any')
+url="http://www.dnspython.org"
+license=('ISC')
+depends=('python')
+makedepends=('python-setuptools')
+checkdepends=('python-idna' 'python-cryptography' 'python-trio' 'python-pytest')
+optdepends=('python-cryptography: DNSSEC support'
+            'python-requests-toolbelt: DoH support'
+            'python-idna: support for updated IDNA 2008'
+            'python-curio: async support'
+            'python-trio: async support'
+            'python-sniffio: async support')
+source=("https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.zip")
+sha256sums=('e4a87f0b573201a0f3727fa18a516b055fd1107e0e5477cded4a2de497df1dd4')
+validpgpkeys=('A580DEE052FEC78D8ACF383DF24B3AFC8CA2F5C7') # Bob Halley <halley at dnspython.org>
+
+prepare() {
+    cd dnspython-${pkgver}
+}
+
+build() {
+    cd dnspython-${pkgver}
+
+    python setup.py build
+}
+
+check() {
+    cd dnspython-${pkgver}
+
+    # https://github.com/rthalley/dnspython/issues/622
+    pytest -k 'not test_unpickle'
+}
+
+package() {
+    cd dnspython-${pkgver}
+
+    python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
+    install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
+}

Copied: python-dnspython/repos/community-testing-any/py39.patch (from rev 1010205, python-dnspython/trunk/py39.patch)
===================================================================
--- community-testing-any/py39.patch	                        (rev 0)
+++ community-testing-any/py39.patch	2021-08-31 19:27:23 UTC (rev 1010206)
@@ -0,0 +1,79 @@
+From f565c1120bc8f823ce2c6e21d5aeea412afaec6e Mon Sep 17 00:00:00 2001
+From: Evangelos Foutras <evangelos at foutrelis.com>
+Date: Thu, 3 Dec 2020 18:17:51 +0200
+Subject: [PATCH] Use base64.decodebytes() and base64.encodebytes().  [Issue
+ #338]
+
+This commit also adds test coverage for tsigkeyring, and fixes to_text()
+on python 3, which had never worked properly due to an extra .decode().
+
+(cherry picked from commit f93c8c6ad41d38ccd19335a5a0a396cbaa409caf)
+---
+ dns/tsigkeyring.py        |  7 ++++---
+ tests/test_tsigkeyring.py | 33 +++++++++++++++++++++++++++++++++
+ 2 files changed, 37 insertions(+), 3 deletions(-)
+ create mode 100644 tests/test_tsigkeyring.py
+
+diff --git a/dns/tsigkeyring.py b/dns/tsigkeyring.py
+index 5e5fe1c..74ff667 100644
+--- a/dns/tsigkeyring.py
++++ b/dns/tsigkeyring.py
+@@ -32,7 +32,7 @@ def from_text(textring):
+     keyring = {}
+     for keytext in textring:
+         keyname = dns.name.from_text(keytext)
+-        secret = base64.decodestring(maybe_encode(textring[keytext]))
++        secret = base64.decodebytes(maybe_encode(textring[keytext]))
+         keyring[keyname] = secret
+     return keyring
+ 
+@@ -44,7 +44,8 @@ def to_text(keyring):
+ 
+     textring = {}
+     for keyname in keyring:
+-        keytext = maybe_decode(keyname.to_text())
+-        secret = maybe_decode(base64.encodestring(keyring[keyname]))
++        keytext = keyname.to_text()
++        # rstrip to get rid of the \n encoding adds
++        secret = maybe_decode(base64.encodebytes(keyring[keyname])).rstrip()
+         textring[keytext] = secret
+     return textring
+diff --git a/tests/test_tsigkeyring.py b/tests/test_tsigkeyring.py
+new file mode 100644
+index 0000000..ce8888d
+--- /dev/null
++++ b/tests/test_tsigkeyring.py
+@@ -0,0 +1,33 @@
++# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license
++
++import base64
++import unittest
++
++import dns.tsigkeyring
++
++text_keyring = {
++    'keyname.' : 'NjHwPsMKjdN++dOfE5iAiQ=='
++}
++
++rich_keyring = {
++    dns.name.from_text('keyname.') : \
++    base64.decodebytes('NjHwPsMKjdN++dOfE5iAiQ=='.encode())
++}
++
++class TSIGKeyRingTestCase(unittest.TestCase):
++
++    def test_from_text(self):
++        """text keyring -> rich keyring"""
++        rkeyring = dns.tsigkeyring.from_text(text_keyring)
++        self.assertEqual(rkeyring, rich_keyring)
++
++    def test_to_text(self):
++        """text keyring -> rich keyring -> text keyring"""
++        tkeyring = dns.tsigkeyring.to_text(rich_keyring)
++        self.assertEqual(tkeyring, text_keyring)
++
++    def test_from_and_to_text(self):
++        """text keyring -> rich keyring -> text keyring"""
++        rkeyring = dns.tsigkeyring.from_text(text_keyring)
++        tkeyring = dns.tsigkeyring.to_text(rkeyring)
++        self.assertEqual(tkeyring, text_keyring)



More information about the arch-commits mailing list