Package: urlgrabber
Version: 3.1.0-4
Severity: normal
Tags: patch

Hello,

as Ubuntu is already transitioning to python 2.6 here is a patch which
fixes a deprecation warning about the md5 module. It also contains a
change for the python 2.6 transition and removes the python version
from the shebang in /usr/bin/urlgrabber so the package can depend on
python (instead of python2.5).

Regards
Michael
diff -u urlgrabber-3.1.0/debian/patches/00list 
urlgrabber-3.1.0/debian/patches/00list
--- urlgrabber-3.1.0/debian/patches/00list
+++ urlgrabber-3.1.0/debian/patches/00list
@@ -1,0 +2 @@
+002_md5_deprecation
diff -u urlgrabber-3.1.0/debian/rules urlgrabber-3.1.0/debian/rules
--- urlgrabber-3.1.0/debian/rules
+++ urlgrabber-3.1.0/debian/rules
@@ -9,6 +9,7 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+include /usr/share/python/python.mk
 PYVERS = $(shell pyversions -r)
 
 CFLAGS = -Wall -g
@@ -63,10 +64,12 @@
        dh_installdirs
        # Add here commands to install the package into debian/urlgrabber.
        for py in $(PYVERS); do \
-               $$py setup.py install 
--root=$(CURDIR)/debian/python-urlgrabber; \
+               $$py setup.py install --root=$(CURDIR)/debian/python-urlgrabber 
$(py_setup_install_args); \
        done
        # remove unneeded documents installed by setup.py
        -rm -rf $(CURDIR)/debian/python-urlgrabber/usr/share/doc/urlgrabber-3*
+       # use an unversioned python interpreter
+       sed -ri 's,^#![[:space:]]*/usr/bin/python.\..,#! /usr/bin/python,' 
$(CURDIR)/debian/python-urlgrabber/usr/bin/*
 
 # Build architecture-independent files here.
 binary-indep: build install
only in patch2:
unchanged:
--- urlgrabber-3.1.0.orig/debian/patches/002_md5_deprecation.dpatch
+++ urlgrabber-3.1.0/debian/patches/002_md5_deprecation.dpatch
@@ -0,0 +1,46 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 002_md5_deprecation.dpatch by Michael Bienia <ge...@ubuntu.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix deprecation warning from python 2.6 about the md5 module
+
+...@dpatch@
+diff -urNad urlgrabber-3.1.0~/urlgrabber/keepalive.py 
urlgrabber-3.1.0/urlgrabber/keepalive.py
+--- urlgrabber-3.1.0~/urlgrabber/keepalive.py  2006-09-22 02:58:05.000000000 
+0200
++++ urlgrabber-3.1.0/urlgrabber/keepalive.py   2009-03-03 12:54:14.000000000 
+0100
+@@ -485,7 +485,7 @@
+     keepalive_handler.close_all()
+ 
+ def continuity(url):
+-    import md5
++    from hashlib import md5
+     format = '%25s: %s'
+     
+     # first fetch the file with the normal http handler
+@@ -494,7 +494,7 @@
+     fo = urllib2.urlopen(url)
+     foo = fo.read()
+     fo.close()
+-    m = md5.new(foo)
++    m = md5(foo)
+     print format % ('normal urllib', m.hexdigest())
+ 
+     # now install the keepalive handler and try again
+@@ -504,7 +504,7 @@
+     fo = urllib2.urlopen(url)
+     foo = fo.read()
+     fo.close()
+-    m = md5.new(foo)
++    m = md5(foo)
+     print format % ('keepalive read', m.hexdigest())
+ 
+     fo = urllib2.urlopen(url)
+@@ -514,7 +514,7 @@
+         if f: foo = foo + f
+         else: break
+     fo.close()
+-    m = md5.new(foo)
++    m = md5(foo)
+     print format % ('keepalive readline', m.hexdigest())
+ 
+ def comp(N, url):

Reply via email to