Package: debian-goodies
Version: 0.51
User: [email protected]
Usertags: python2.6
Severity: minor
Tags: patch

$ python2.6 /usr/bin/which-pkg-broke debian-goodies > /dev/null
/usr/bin/which-pkg-broke:7: DeprecationWarning: The popen2 module is 
deprecated.  Use the subprocess module.
  import popen2

The attached patch fixes this warning.

--
Jakub Wilk
diff --git a/which-pkg-broke b/which-pkg-broke
--- a/which-pkg-broke
+++ b/which-pkg-broke
@@ -4,22 +4,27 @@
 
 import sys
 import os
-import popen2
+import subprocess
 import time
 from string import *
 from stat import *
 
 def pkgdeps(pkg):
-    outstr, instr = popen2.popen4("LC_ALL=C apt-cache depends %s" % pkg)
+    apt_cache = subprocess.Popen(
+        ['apt-cache', 'depends', pkg],
+        stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+        env={} # force POSIX locale
+    )
     deps = []
-    myline = outstr.readline()
+    myline = apt_cache.stdout.readline()
     while(myline != ''):
         elts = map(strip, myline.split(':'))
         if len(elts) == 2:
             how, pkg = elts
             if how in ('Depends', 'PreDepends'):
                 deps.append(pkg)
-        myline = outstr.readline()
+        myline = apt_cache.stdout.readline()
+    apt_cache.wait()
     return deps
 
 def alldeps(pkg, ignore):

Attachment: signature.asc
Description: Digital signature

Reply via email to