I've attached a patch that fixes the shift bug and correctly detabifies
the source.  The source was a mess with tab size of 8 and indent of 4,
which really screws up editors that use indent size == tab size.

...Ken
--- GnuPGInterface/GnuPGInterface.py	2002-01-11 14:22:04.000000000 -0600
+++ duplicity/duplicity/GnuPGInterface.py	2009-03-16 10:52:22.000000000 -0500
@@ -226,7 +226,7 @@
 
 __author__   = "Frank J. Tobin, fto...@neverending.org"
 __version__  = "0.3.2"
-__revision__ = "$Id: GnuPGInterface.py,v 1.22 2002/01/11 20:22:04 ftobin Exp $"
+__revision__ = "$Id: GnuPGInterface.py,v 1.4 2009/03/08 13:28:12 loafman Exp $"
 
 # "standard" filehandles attached to processes
 _stds = [ 'stdin', 'stdout', 'stderr' ]
@@ -274,14 +274,14 @@
         self.options = Options()
     
     def run(self, gnupg_commands, args=None, create_fhs=None, attach_fhs=None):
-	"""Calls GnuPG with the list of string commands gnupg_commands,
-	complete with prefixing dashes.
-	For example, gnupg_commands could be
-	'["--sign", "--encrypt"]'
-	Returns a GnuPGInterface.Process object.
-	
-	args is an optional list of GnuPG command arguments (not options),
-	such as keyID's to export, filenames to process, etc.
+        """Calls GnuPG with the list of string commands gnupg_commands,
+        complete with prefixing dashes.
+        For example, gnupg_commands could be
+        '["--sign", "--encrypt"]'
+        Returns a GnuPGInterface.Process object.
+        
+        args is an optional list of GnuPG command arguments (not options),
+        such as keyID's to export, filenames to process, etc.
 
         create_fhs is an optional list of GnuPG filehandle
         names that will be set as keys of the returned Process object's
@@ -307,9 +307,9 @@
         opened file and 'attach_fhs[stdin] is my_file', then GnuPG
         will read its standard input from my_file. This is useful
         if you want GnuPG to read/write to/from an existing file.
-	For instance:
+        For instance:
         
-	    f = open("encrypted.gpg")
+            f = open("encrypted.gpg")
             gnupg.run(["--decrypt"], attach_fhs={'stdin': f})
 
         Using attach_fhs also helps avoid system buffering
@@ -317,29 +317,29 @@
         can cause the process to deadlock.
         
         If not mentioned in create_fhs or attach_fhs,
-	GnuPG filehandles which are a std* (stdin, stdout, stderr)
+        GnuPG filehandles which are a std* (stdin, stdout, stderr)
         are defaulted to the running process' version of handle.
-	Otherwise, that type of handle is simply not used when calling GnuPG.
-	For example, if you do not care about getting data from GnuPG's
-	status filehandle, simply do not specify it.
-	
-	run() returns a Process() object which has a 'handles'
+        Otherwise, that type of handle is simply not used when calling GnuPG.
+        For example, if you do not care about getting data from GnuPG's
+        status filehandle, simply do not specify it.
+        
+        run() returns a Process() object which has a 'handles'
         which is a dictionary mapping from the handle name
         (such as 'stdin' or 'stdout') to the respective
         newly-created FileObject connected to the running GnuPG process.
-	For instance, if the call was
+        For instance, if the call was
 
           process = gnupg.run(["--decrypt"], stdin=1)
           
-	after run returns 'process.handles["stdin"]'
+        after run returns 'process.handles["stdin"]'
         is a FileObject connected to GnuPG's standard input,
-	and can be written to.
+        and can be written to.
         """
         
-	if args == None: args = []
+        if args == None: args = []
         if create_fhs == None: create_fhs = []
         if attach_fhs == None: attach_fhs = {}
-	
+        
         for std in _stds:
             if not attach_fhs.has_key(std) \
                and std not in create_fhs:
@@ -367,9 +367,9 @@
     
     def _attach_fork_exec(self, gnupg_commands, args, create_fhs, attach_fhs):
         """This is like run(), but without the passphrase-helping
-	(note that run() calls this)."""
-	
-	process = Process()
+        (note that run() calls this)."""
+        
+        process = Process()
         
         for fh_name in create_fhs + attach_fhs.keys():
             if not _fd_modes.has_key(fh_name):
@@ -557,12 +557,12 @@
         self.extra_args = []
     
     def get_args( self ):
-	"""Generate a list of GnuPG arguments based upon attributes."""
-	
+        """Generate a list of GnuPG arguments based upon attributes."""
+        
         return self.get_meta_args() + self.get_standard_args() + self.extra_args
 
     def get_standard_args( self ):
-	"""Generate a list of standard, non-meta or extra arguments"""
+        """Generate a list of standard, non-meta or extra arguments"""
         args = []
         if self.homedir != None: args.extend( [ '--homedir', self.homedir ] )
         if self.options != None: args.extend( [ '--options', self.options ] )
@@ -589,7 +589,7 @@
         return args
 
     def get_meta_args( self ):
-	"""Get a list of generated meta-arguments"""
+        """Get a list of generated meta-arguments"""
         args = []
 
         if self.meta_pgp_5_compatible: args.extend( [ '--compress-algo', '1',
@@ -636,7 +636,7 @@
         
         e = os.waitpid(self.pid, 0)[1]
         if e != 0:
-            raise IOError, "GnuPG exited non-zero, with code %d" % (e << 8)
+            raise IOError, "GnuPG exited non-zero, with code %d" % (e >> 8)
 
 def _run_doctests():
     import doctest, GnuPGInterface

Reply via email to