[Python-modules-commits] [py3dns] 01/04: Import py3dns_3.1.1.orig.tar.gz

Scott Kitterman kitterman at moszumanska.debian.org
Fri Oct 7 03:11:40 UTC 2016


This is an automated email from the git hooks/post-receive script.

kitterman pushed a commit to branch master
in repository py3dns.

commit 8c88e9f7a7d51877485524a06d3bc336fb9341a5
Author: Scott Kitterman <scott at kitterman.com>
Date:   Thu Oct 6 22:26:41 2016 -0400

    Import py3dns_3.1.1.orig.tar.gz
---
 CHANGES                | 12 ++++++++++++
 DNS/Base.py            |  4 ++--
 DNS/Lib.py             |  9 ++++++---
 DNS/__init__.py        |  2 +-
 DNS/tests/test_base.py | 26 ++++++++++++++------------
 PKG-INFO               |  2 +-
 tools/caching.py       |  6 +++---
 7 files changed, 39 insertions(+), 22 deletions(-)

diff --git a/CHANGES b/CHANGES
index adbbfe4..18deb01 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+3.1.1 Thu, 06 Oct 2016 22:00:13 -0400
+ * Update test suite for new example.org IP addresses
+ * Fix missing bits for use of ipaddr-py with python3 < 3.3 (LP: #1319611)
+   - Patch thanks to Arfrever Frehtes Taifersar Arahesis
+ * Correct error in _DiscoverNameServers from OS X implementation in 3.0.1
+   that prevents name server discovery on windows (LP: #1442424)
+ * Correct encoding issue with label length to fix issues with DNS labels
+   greater than 46 characters (LP: #1502853)
+   - Thanks to Petr Czepiec for the patch
+ * Use full path to /usr/sbin/scutil on OS X since scutil is not always in the
+   search path (LP: #1630844)
+
 3.1.0 Thu Apr 24 23:52:00 EDT 2014
  * Raise DNSError when no nameservers have been found by the time a
    Base.DNSRequest object is initialized
diff --git a/DNS/Base.py b/DNS/Base.py
index c0752b4..4a70613 100644
--- a/DNS/Base.py
+++ b/DNS/Base.py
@@ -78,7 +78,7 @@ def _DiscoverNameServers():
     if sys.platform in ('win32', 'nt'):
         from . import win32dns
         defaults['server']=win32dns.RegistryResolve()
-    if sys.platform == 'darwin':
+    elif sys.platform == 'darwin':
         ParseOSXSysConfig()
     else:
         return ParseResolvConf()
@@ -454,7 +454,7 @@ class DnsAsyncRequest(DnsRequest,asyncore.dispatcher_with_send):
 def ParseOSXSysConfig():
     "Retrieves the current Mac OS X resolver settings using the scutil(8) command."
     import os, re
-    scutil = os.popen('scutil --dns', 'r')
+    scutil = os.popen('/usr/sbin/scutil --dns', 'r')
     res_re = re.compile('^\s+nameserver[]0-9[]*\s*\:\s*(\S+)$')
     sets = [ ]
     currentset = None
diff --git a/DNS/Lib.py b/DNS/Lib.py
index 3512ecb..67622f5 100644
--- a/DNS/Lib.py
+++ b/DNS/Lib.py
@@ -36,6 +36,11 @@ import DNS
 
 from .Base import DNSError
 
+try:
+    import ipaddress
+except ImportError:
+    import ipaddr as ipaddress
+
 LABEL_UTF8 = False
 LABEL_ENCODING = 'idna'
 
@@ -189,7 +194,7 @@ class Packer:
             else:
                 print('DNS.Lib.Packer.addname:')
                 print('warning: pointer too big')
-            buf = buf + (bytes(chr(n), enc) + label)
+            buf = buf + bytes([n]) + label
         if pointer:
             buf = buf + (pack16bit(pointer | 0xC000))
         else:
@@ -518,7 +523,6 @@ class RRunpackerDefault(RRunpacker):
         RRunpacker.__init__(self, buf)
         self.rdend = None
     def getAdata(self):
-        import ipaddress
         if DNS.LABEL_UTF8:
             enc = 'utf8'
         else:
@@ -526,7 +530,6 @@ class RRunpackerDefault(RRunpacker):
         x = socket.inet_aton(self.getaddr().decode(enc))
         return ipaddress.IPv4Address(struct_unpack("!I", x)[0])
     def getAAAAdata(self):
-        import ipaddress
         return ipaddress.IPv6Address(bin2addr6(self.getaddr6()))
 
 class RRunpackerText(RRunpackerDefault):
diff --git a/DNS/__init__.py b/DNS/__init__.py
index bfd7380..e003688 100644
--- a/DNS/__init__.py
+++ b/DNS/__init__.py
@@ -10,7 +10,7 @@
 
 # __init__.py for DNS class.
 
-__version__ = '3.1.0'
+__version__ = '3.1.1'
 
 try:
     import ipaddress
diff --git a/DNS/tests/test_base.py b/DNS/tests/test_base.py
index 3c67aad..84161f8 100644
--- a/DNS/tests/test_base.py
+++ b/DNS/tests/test_base.py
@@ -3,7 +3,10 @@
 
 import DNS
 import unittest
-import ipaddress
+try:
+    import ipaddress
+except ImportError:
+    import ipaddr as ipaddress
 
 def assertIsByte(b):
     assert b >= 0
@@ -33,12 +36,12 @@ class TestBase(unittest.TestCase):
         self.assertTrue(a_response.answers)
         # is the result vaguely ipv4 like?
         self.assertEqual(a_response.answers[0]['data'].count('.'), 3)
-        self.assertEqual(a_response.answers[0]['data'],'93.184.216.119')
+        self.assertEqual(a_response.answers[0]['data'],'93.184.216.34')
 
         # Default result type for .qry object is an ipaddress object
         ad_response = dnsobj.qry(qtype='A')
         self.assertTrue(ad_response.answers)
-        self.assertEqual(ad_response.answers[0]['data'],ipaddress.IPv4Address('93.184.216.119'))
+        self.assertEqual(ad_response.answers[0]['data'],ipaddress.IPv4Address('93.184.216.34'))
 
         ab_response = dnsobj.qry(qtype='A', resulttype='binary')
         self.assertTrue(ab_response.answers)
@@ -46,27 +49,26 @@ class TestBase(unittest.TestCase):
         self.assertEqual(len(ab_response.answers[0]['data']), 4)
         for b in ab_response.answers[0]['data']:
             assertIsByte(b)
-        self.assertEqual(ab_response.answers[0]['data'],b']\xb8\xd8w')
+        self.assertEqual(ab_response.answers[0]['data'],b']\xb8\xd8\"')
 
         ai_response = dnsobj.qry(qtype='A', resulttype='integer')
         self.assertTrue(ai_response.answers)
-        self.assertEqual(ai_response.answers[0]['data'],1572395127)
+        self.assertEqual(ai_response.answers[0]['data'],1572395042)
 
 
     def testDnsRequestAAAA(self):
-        import ipaddress
         dnsobj = DNS.DnsRequest('example.org')
         
         aaaa_response = dnsobj.qry(qtype='AAAA', resulttype='text')
         self.assertTrue(aaaa_response.answers)
         # does the result look like an ipv6 address?
         self.assertTrue(':' in aaaa_response.answers[0]['data'])
-        self.assertEqual(aaaa_response.answers[0]['data'],'2606:2800:220:6d:26bf:1447:1097:aa7')
+        self.assertEqual(aaaa_response.answers[0]['data'],'2606:2800:220:1:248:1893:25c8:1946')
 
         # default is returning ipaddress object
         aaaad_response = dnsobj.qry(qtype='AAAA')
         self.assertTrue(aaaad_response.answers)
-        self.assertEqual(aaaad_response.answers[0]['data'],ipaddress.IPv6Address('2606:2800:220:6d:26bf:1447:1097:aa7'))
+        self.assertEqual(aaaad_response.answers[0]['data'],ipaddress.IPv6Address('2606:2800:220:1:248:1893:25c8:1946'))
         
         aaaab_response = dnsobj.qry(qtype='AAAA', resulttype='binary')
         self.assertTrue(aaaab_response.answers)
@@ -74,11 +76,11 @@ class TestBase(unittest.TestCase):
         self.assertEqual(len(aaaab_response.answers[0]['data']) , 16)
         for b in aaaab_response.answers[0]['data']:
             assertIsByte(b)
-        self.assertEqual(aaaab_response.answers[0]['data'],b'&\x06(\x00\x02 \x00m&\xbf\x14G\x10\x97\n\xa7')
+        self.assertEqual(aaaab_response.answers[0]['data'],b'&\x06(\x00\x02 \x00\x01\x02H\x18\x93%\xc8\x19F')
         # IPv6 decimal
         aaaai_response = dnsobj.qry(qtype='AAAA', resulttype='integer')
         self.assertTrue(aaaai_response.answers)
-        self.assertEqual(aaaai_response.answers[0]['data'], 50542628918019815862290244053507705511)
+        self.assertEqual(aaaai_response.answers[0]['data'], 50542628918019813867414319910101719366)
 
     def testDnsRequestEmptyMX(self):
         dnsobj = DNS.DnsRequest('example.org')
@@ -168,7 +170,7 @@ class TestBase(unittest.TestCase):
         self.assertTrue(ad_response.answers)
         # is the result vaguely ipv4 like?
         self.assertEqual(ad_response.answers[0]['data'].count('.'), 3)
-        self.assertEqual(ad_response.answers[0]['data'],'93.184.216.119')
+        self.assertEqual(ad_response.answers[0]['data'],'93.184.216.34')
 
     def testDnsRequestAAAAD(self):
         dnsob = DNS.DnsRequest('example.org')
@@ -180,7 +182,7 @@ class TestBase(unittest.TestCase):
         self.assertEqual(len(aaaad_response.answers[0]['data']) , 16)
         for b in aaaad_response.answers[0]['data']:
             assertIsByte(b)
-        self.assertEqual(aaaad_response.answers[0]['data'],b'&\x06(\x00\x02 \x00m&\xbf\x14G\x10\x97\n\xa7')
+        self.assertEqual(aaaad_response.answers[0]['data'],b'&\x06(\x00\x02 \x00\x01\x02H\x18\x93%\xc8\x19F')
         
     def testDnsRequestEmptyMXD(self):
         dnsob = DNS.DnsRequest('example.org')
diff --git a/PKG-INFO b/PKG-INFO
index e04201a..fbb9393 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: py3dns
-Version: 3.1.0
+Version: 3.1.1
 Summary: Python 3 DNS library
 Home-page: https://launchpad.net/py3dns
 Author: Scott Kitterman
diff --git a/tools/caching.py b/tools/caching.py
index 7ee55cd..9d02583 100644
--- a/tools/caching.py
+++ b/tools/caching.py
@@ -19,7 +19,7 @@ class DNSCache:
 
     def lookup(self,IP = None,name = None):
         import DNS
-	now = time.time()
+        now = time.time()
         if (not IP) and (not name):
             return None
         if IP:
@@ -36,7 +36,7 @@ class DNSCache:
             cache = self.forCache
             qt = 'a'
         if name in cache:
-	    # Check if it's timed out or not
+            # Check if it's timed out or not
             if cache[name][1] < now:
                 del(cache[name])
             else:
@@ -48,7 +48,7 @@ class DNSCache:
             return 'Timeout'
         if len(x.response.answers) > 0:
             cache[name] = ( x.response.answers[0]['data'], x.time_finish + 
-			    x.response.answers[0]['ttl'])
+                            x.response.answers[0]['ttl'])
         else:
             cache[name] = (None,now+self.negCache)
         return cache[name][0]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/py3dns.git



More information about the Python-modules-commits mailing list