pld-builder.new: PLD_Builder/gpg.py Close in sing(), too.

arekm arekm at pld-linux.org
Tue Nov 20 21:56:31 CET 2007


Author: arekm                        Date: Tue Nov 20 20:56:31 2007 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
Close in sing(), too.

---- Files affected:
pld-builder.new/PLD_Builder:
   gpg.py (1.13 -> 1.14) 

---- Diffs:

================================================================
Index: pld-builder.new/PLD_Builder/gpg.py
diff -u pld-builder.new/PLD_Builder/gpg.py:1.13 pld-builder.new/PLD_Builder/gpg.py:1.14
--- pld-builder.new/PLD_Builder/gpg.py:1.13	Tue Nov 20 21:48:04 2007
+++ pld-builder.new/PLD_Builder/gpg.py	Tue Nov 20 21:56:26 2007
@@ -8,6 +8,11 @@
 import util
 import pipeutil
 
+def __gpg_close(descriptors):
+    for d in descriptors:
+        if not d.closed:
+            d.close()
+
 def verify_sig(buf):
     """Check signature.
     
@@ -16,16 +21,11 @@
     object.
     """
 
-    def __close(descriptors):
-        for d in descriptors:
-            if not d.closed:
-                d.close()
-
     (gpg_out, gpg_in, gpg_err) = popen2.popen3("gpg --batch --no-tty --decrypt")
     try:
         body = pipeutil.rw_pipe(buf, gpg_in, gpg_out)
     except OSError, e:
-        __close([gpg_out, gpg_in, gpg_err])
+        __gpg_close([gpg_out, gpg_in, gpg_err])
         log.error("gnupg signing failed, does gpg binary exist? : %s" % e)
         raise
 
@@ -35,7 +35,7 @@
         m = rx.match(l)
         if m:
             emails.append(m.group(2))
-    __close([gpg_out, gpg_in, gpg_err])
+    __gpg_close([gpg_out, gpg_in, gpg_err])
     return (emails, body)
 
 def sign(buf):
@@ -43,8 +43,9 @@
     try:
         body = pipeutil.rw_pipe(buf, gpg_in, gpg_out)
     except OSError, e:
+        __gpg_close([gpg_out, gpg_in, gpg_err])
         log.error("gnupg signing failed, does gpg binary exist? : %s" % e)
         raise
 
-    gpg_err.close()
+    __gpg_close([gpg_out, gpg_in, gpg_err])
     return body
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-builder.new/PLD_Builder/gpg.py?r1=1.13&r2=1.14&f=u



More information about the pld-cvs-commit mailing list