Package: debdelta Version: 0.28 os.popen2 have been deprecated[1] in Python 2.6 and this makes debdelta output an annoying DeprecationWarning:
/usr/bin/debdelta:383: DeprecationWarning: os.popen2 is deprecated. Use the
subprocess module.
o,i=os.popen2(shell)
Attached is a trivial patch that replaces os.popen2 with
subprocess.Popen.
According to the Python 2.6 documentation os.popen have also been
deprecated[2], but strangely that does not print a
DeprecationWarning. Replacing os.popen (and why not also os.system?)
with subprocess.Popen is also trivial, there are good examples in the
documentation for subprocess. If you like I can write a patch for this
as well.
[1] http://docs.python.org/library/popen2.html
[2] http://docs.python.org/library/os.html#os.popen
Kind regards,
Pär Andersson
diff --git a/debdelta b/debdelta
index 0d23ff1..8be8c27 100755
--- a/debdelta
+++ b/debdelta
@@ -94,6 +94,7 @@ minibzip2='/usr/lib/debdelta/minibzip2'
####################################################################
import sys , os , tempfile , string ,getopt , tarfile , shutil , time, hashlib, traceback, ConfigParser
+from subprocess import *
from stat import ST_SIZE, ST_MTIME, ST_MODE, S_IMODE, S_IRUSR, S_IWUSR, S_IXUSR
from os.path import abspath
@@ -380,11 +381,12 @@ def prepare_for_echo__(s):
def apply_prepare_for_echo(shell,repres):
a=ECHO_TEST + " $echo '" + repres + "' \n exit "
- o,i=os.popen2(shell)
- o.write(a)
- o.close()
- a=i.read()
+ p = Popen([shell], shell=True, stdin=PIPE, stdout=PIPE, close_fds=True)
+ (o, i) = (p.stdout, p.stdin)
+ i.write(a)
i.close()
+ a=o.read()
+ o.close()
return a
#ack! I wanted to use 'dash' as preferred shell, but bug 379227 stopped me
pgpQsnDHVphQJ.pgp
Description: PGP signature

