diff -u gnupginterface-0.3.2/debian/control gnupginterface-0.3.2/debian/control
--- gnupginterface-0.3.2/debian/control
+++ gnupginterface-0.3.2/debian/control
@@ -9,7 +9,7 @@
 
 Package: python-gnupginterface
 Architecture: all
-Depends: ${python:Depends}, gnupg (>= 1.2.1)
+Depends: ${python:Depends}, gnupg (>= 1.2.1) | gnupg2, ${misc:Depends}
 Provides: ${python:Provides}
 Description: Python interface to GnuPG (GPG)
  GnuPGInterface is a Python module to interface with GnuPG.
only in patch2:
unchanged:
--- gnupginterface-0.3.2.orig/debian/patches/03_gpg2_compatibility.patch
+++ gnupginterface-0.3.2/debian/patches/03_gpg2_compatibility.patch
@@ -0,0 +1,39 @@
+Subject: use gpg2 if available.
+From: nob...@dreamwidth.org
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/497529
+Bug-Debian: http://bugs.debian.org/602677
+--- gnupginterface-0.3.2~/GnuPGInterface.py    2002-01-11 20:22:04.000000000 
+0000
++++ gnupginterface-0.3.2/GnuPGInterface.py     2010-02-12 02:34:47.000000000 
+0000
+@@ -269,7 +269,10 @@
+     """
+ 
+     def __init__(self):
+-        self.call = 'gpg'
++        if (self._pathexists('gpg2')):
++            self.call = 'gpg2'
++        else:
++            self.call = 'gpg'
+         self.passphrase = None
+         self.options = Options()
+     
+@@ -440,6 +443,20 @@
+                   + gnupg_commands + args
+ 
+         os.execvp( command[0], command )
++    
++    
++    def _pathexists(self, filename):
++        """Checks if 'filename' is present in the system PATH.
++        In other words, it checks if os.execvp(filename, ...) will work."""
++        
++        pathenv = os.getenv("PATH")
++        path = pathenv.split(":")
++        for directory in path:
++            fullpath = os.path.join(directory, filename)
++            if (os.path.exists(fullpath)):
++                return True
++        
++        return False
+ 
+     
+ class Pipe:

Reply via email to