[Python-modules-commits] r17479 - in packages/pydkim/trunk/debian (5 files)

kitterman at users.alioth.debian.org kitterman at users.alioth.debian.org
Thu Jun 16 19:58:43 UTC 2011


    Date: Thursday, June 16, 2011 @ 19:58:42
  Author: kitterman
Revision: 17479

 * Finished adjusting debian/rules for python3 support
 * Added debian/patches/dns-namespace.patch to fix use of python-dnspython

Added:
  packages/pydkim/trunk/debian/patches/dns-namespace.patch
Modified:
  packages/pydkim/trunk/debian/changelog
  packages/pydkim/trunk/debian/control
  packages/pydkim/trunk/debian/patches/series
  packages/pydkim/trunk/debian/rules

Modified: packages/pydkim/trunk/debian/changelog
===================================================================
--- packages/pydkim/trunk/debian/changelog	2011-06-16 18:24:49 UTC (rev 17478)
+++ packages/pydkim/trunk/debian/changelog	2011-06-16 19:58:42 UTC (rev 17479)
@@ -1,10 +1,13 @@
-pydkim (0.4.1-1) UNRELEASED; urgency=low
+pydkim (0.4.1-1) unstable; urgency=low
 
   * New upstream release
     - Drop debian/patches/fix-key-record-validation.patch and
       relaxed-canonicalization.patch, incorporated upstream
     - Update debian/patches/adjust-setup.py.patch to match upstream setup.py
       versions
+    - Add debian/patches/dns-namespace.patch to deconflict dns (python-
+      dnspython) and dkim/dns.py namespaces so the package works with either
+      python-dns (DNS) or python-dnspython (dns)
     - Drop debian/dkimsign.1 and dkimverify.1, provided in the upstream
       tarball now
     - Drop debian/manpages, installed using upstream setup.py

Modified: packages/pydkim/trunk/debian/control
===================================================================
--- packages/pydkim/trunk/debian/control	2011-06-16 18:24:49 UTC (rev 17478)
+++ packages/pydkim/trunk/debian/control	2011-06-16 19:58:42 UTC (rev 17479)
@@ -3,7 +3,7 @@
 Priority: optional
 Maintainer: Scott Kitterman <scott at kitterman.com>
 Uploaders: Debian Python Modules Team <python-modules-team at lists.alioth.debian.org> 
-Build-Depends: debhelper (>= 7.3.16), python-all (>= 2.6.5-2~), python3-all, quilt (>= 0.46-7)
+Build-Depends: debhelper (>= 7.3.16), python (>= 2.6.5-2~), python3, quilt (>= 0.46-7)
 X-Python-Version: >= 2.6
 X-Python3-Version: >= 3.1
 Vcs-Svn: svn://svn.debian.org/python-modules/packages/pydkim/trunk/

Added: packages/pydkim/trunk/debian/patches/dns-namespace.patch
===================================================================
--- packages/pydkim/trunk/debian/patches/dns-namespace.patch	                        (rev 0)
+++ packages/pydkim/trunk/debian/patches/dns-namespace.patch	2011-06-16 19:58:42 UTC (rev 17479)
@@ -0,0 +1,191 @@
+Fix namespace conflict between dns (dnspythong) and dkim/dns.py by renaming
+dkim/dns.py.  Cherrypick from upstream.
+Index: pydkim-0.4.1/dkim/__init__.py
+===================================================================
+--- pydkim-0.4.1.orig/dkim/__init__.py	2011-06-16 14:35:15.026408226 -0500
++++ pydkim-0.4.1/dkim/__init__.py	2011-06-16 14:35:51.798408215 -0500
+@@ -38,7 +38,7 @@
+     RSASSA_PKCS1_v1_5_verify,
+     UnparsableKeyError,
+     )
+-from dkim.dns import get_txt
++from dkim.dnsplug import get_txt
+ from dkim.util import (
+     get_default_logger,
+     InvalidTagValueList,
+Index: pydkim-0.4.1/dkim/dns.py
+===================================================================
+--- pydkim-0.4.1.orig/dkim/dns.py	2011-06-16 14:34:38.754408238 -0500
++++ /dev/null	1970-01-01 00:00:00.000000000 +0000
+@@ -1,83 +0,0 @@
+-# This software is provided 'as-is', without any express or implied
+-# warranty.  In no event will the author be held liable for any damages
+-# arising from the use of this software.
+-#
+-# Permission is granted to anyone to use this software for any purpose,
+-# including commercial applications, and to alter it and redistribute it
+-# freely, subject to the following restrictions:
+-#
+-# 1. The origin of this software must not be misrepresented; you must not
+-#    claim that you wrote the original software. If you use this software
+-#    in a product, an acknowledgment in the product documentation would be
+-#    appreciated but is not required.
+-# 2. Altered source versions must be plainly marked as such, and must not be
+-#    misrepresented as being the original software.
+-# 3. This notice may not be removed or altered from any source distribution.
+-#
+-# Copyright (c) 2008 Greg Hewgill http://hewgill.com
+-#
+-# This has been modified from the original software.
+-# Copyright (c) 2011 William Grant <me at williamgrant.id.au>
+-
+-
+-__all__ = [
+-    'get_txt'
+-    ]
+-
+-
+-def get_txt_dnspython(name):
+-    """Return a TXT record associated with a DNS name."""
+-    a = dns.resolver.query(name, dns.rdatatype.TXT)
+-    for r in a.response.answer:
+-        if r.rdtype == dns.rdatatype.TXT:
+-            return b"".join(r.items[0].strings)
+-    return None
+-
+-
+-def get_txt_pydns(name):
+-    """Return a TXT record associated with a DNS name."""
+-    # Older pydns releases don't like a trailing dot.
+-    if name.endswith('.'):
+-        name = name[:-1]
+-    response = DNS.DnsRequest(name, qtype='txt').req()
+-    if not response.answers:
+-        return None
+-    return b''.join(response.answers[0]['data'])
+-
+-def get_txt_Milter_dns(name):
+-    """Return a TXT record associated with a DNS name."""
+-    # Older pydns releases don't like a trailing dot.
+-    if name.endswith('.'):
+-        name = name[:-1]
+-    sess = Session()
+-    a = sess.dns(name,'TXT')
+-    if a: return b''.join(a[0])
+-    return None
+-
+-# Prefer dnspython if it's there, otherwise use pydns.
+-try:
+-    import dns.resolver
+-    _get_txt = get_txt_dnspython
+-except ImportError:
+-    try:
+-        from Milter.dns import Session
+-        _get_txt = get_txt_Milter_dns
+-    except ImportError:
+-        import DNS
+-        DNS.DiscoverNameServers()
+-        _get_txt = get_txt_pydns
+-
+-def get_txt(name):
+-    """Return a TXT record associated with a DNS name.
+-
+-    @param name: The bytestring domain name to look up.
+-    """
+-    # pydns needs Unicode, but DKIM's d= is ASCII (already punycoded).
+-    try:
+-        unicode_name = name.decode('ascii')
+-    except UnicodeDecodeError:
+-        return None
+-    txt = _get_txt(unicode_name)
+-    if txt:
+-      txt = txt.encode('utf-8')
+-    return txt
+Index: pydkim-0.4.1/dkim/dnsplug.py
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ pydkim-0.4.1/dkim/dnsplug.py	2011-06-15 09:40:41.000000000 -0500
+@@ -0,0 +1,83 @@
++# This software is provided 'as-is', without any express or implied
++# warranty.  In no event will the author be held liable for any damages
++# arising from the use of this software.
++#
++# Permission is granted to anyone to use this software for any purpose,
++# including commercial applications, and to alter it and redistribute it
++# freely, subject to the following restrictions:
++#
++# 1. The origin of this software must not be misrepresented; you must not
++#    claim that you wrote the original software. If you use this software
++#    in a product, an acknowledgment in the product documentation would be
++#    appreciated but is not required.
++# 2. Altered source versions must be plainly marked as such, and must not be
++#    misrepresented as being the original software.
++# 3. This notice may not be removed or altered from any source distribution.
++#
++# Copyright (c) 2008 Greg Hewgill http://hewgill.com
++#
++# This has been modified from the original software.
++# Copyright (c) 2011 William Grant <me at williamgrant.id.au>
++
++
++__all__ = [
++    'get_txt'
++    ]
++
++
++def get_txt_dnspython(name):
++    """Return a TXT record associated with a DNS name."""
++    a = dns.resolver.query(name, dns.rdatatype.TXT)
++    for r in a.response.answer:
++        if r.rdtype == dns.rdatatype.TXT:
++            return b"".join(r.items[0].strings)
++    return None
++
++
++def get_txt_pydns(name):
++    """Return a TXT record associated with a DNS name."""
++    # Older pydns releases don't like a trailing dot.
++    if name.endswith('.'):
++        name = name[:-1]
++    response = DNS.DnsRequest(name, qtype='txt').req()
++    if not response.answers:
++        return None
++    return b''.join(response.answers[0]['data'])
++
++def get_txt_Milter_dns(name):
++    """Return a TXT record associated with a DNS name."""
++    # Older pydns releases don't like a trailing dot.
++    if name.endswith('.'):
++        name = name[:-1]
++    sess = Session()
++    a = sess.dns(name,'TXT')
++    if a: return b''.join(a[0])
++    return None
++
++# Prefer dnspython if it's there, otherwise use pydns.
++try:
++    import dns.resolver
++    _get_txt = get_txt_dnspython
++except ImportError:
++    try:
++        from Milter.dns import Session
++        _get_txt = get_txt_Milter_dns
++    except ImportError:
++        import DNS
++        DNS.DiscoverNameServers()
++        _get_txt = get_txt_pydns
++
++def get_txt(name):
++    """Return a TXT record associated with a DNS name.
++
++    @param name: The bytestring domain name to look up.
++    """
++    # pydns needs Unicode, but DKIM's d= is ASCII (already punycoded).
++    try:
++        unicode_name = name.decode('ascii')
++    except UnicodeDecodeError:
++        return None
++    txt = _get_txt(unicode_name)
++    if txt:
++      txt = txt.encode('utf-8')
++    return txt

Modified: packages/pydkim/trunk/debian/patches/series
===================================================================
--- packages/pydkim/trunk/debian/patches/series	2011-06-16 18:24:49 UTC (rev 17478)
+++ packages/pydkim/trunk/debian/patches/series	2011-06-16 19:58:42 UTC (rev 17479)
@@ -1 +1,2 @@
+dns-namespace.patch
 adjust-setup.py.patch

Modified: packages/pydkim/trunk/debian/rules
===================================================================
--- packages/pydkim/trunk/debian/rules	2011-06-16 18:24:49 UTC (rev 17478)
+++ packages/pydkim/trunk/debian/rules	2011-06-16 19:58:42 UTC (rev 17479)
@@ -4,28 +4,23 @@
 %:
 	dh $@ --with python2,python3,quilt
 
+override_dh_auto_build:
+
 override_dh_auto_install:
-	set -e && for pyvers in $(shell pyversions -vr); do \
-		python$$pyvers $(CURDIR)/setup.py install --no-compile -O0 --install-layout=deb \
-			--root $(CURDIR)/debian/python-dkim; \
-	done
+	python $(CURDIR)/setup.py install --no-compile -O0 --install-layout=deb \
+		--root $(CURDIR)/debian/python-dkim
 	mv debian/python-dkim/usr/bin/dkimsign.py  debian/python-dkim/usr/bin/dkimsign
 	mv debian/python-dkim/usr/bin/dkimverify.py  debian/python-dkim/usr/bin/dkimverify
-	set -e && for pyvers in $(shell py3versions -sv); do \
-		python$$pyvers $(CURDIR)/setup.py install --no-compile -O0 --install-layout=deb \
-			--root $(CURDIR)/debian/python3-dkim; \
-	done
+	python3 $(CURDIR)/setup.py install --no-compile -O0 --install-layout=deb \
+		--root $(CURDIR)/debian/python3-dkim
 	rm $(CURDIR)/debian/python3-dkim/usr/bin/dkimverify.py
 	rm $(CURDIR)/debian/python3-dkim/usr/bin/dkimsign.py
 	rm -rf $(CURDIR)/debian/python3-dkim/usr/share/man
 	dh_install
 
 override_dh_auto_clean:
-	set -e && for pyvers in $(shell pyversions -vr); do \
-		python$$pyvers setup.py clean -a; \
+	python setup.py clean -a
+	python3 setup.py clean -a; \
 	done
-	set -e && for pyvers in $(shell py3versions -sv); do \
-		python$$pyvers setup.py clean -a; \
-	done
 	find . -name \*.pyc -exec rm {} \;
 	dh_clean




More information about the Python-modules-commits mailing list