~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-29 05:17:23 UTC
  • mto: (1711.5.3 win32)
  • mto: This revision was merged to the branch mainline in revision 1827.
  • Revision ID: john@arbash-meinel.com-20060629051723-b76336a0994291e1
Clean up paramiko agent support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
                }
102
102
 
103
103
 
104
 
# don't use prefetch unless paramiko version >= 1.5.2 (there were bugs earlier)
105
 
_default_do_prefetch = False
106
 
if getattr(paramiko, '__version_info__', (0, 0, 0)) >= (1, 5, 5):
107
 
    _default_do_prefetch = True
 
104
_paramiko_version = getattr(paramiko, '__version_info__', (0, 0, 0))
 
105
# don't use prefetch unless paramiko version >= 1.5.5 (there were bugs earlier)
 
106
_default_do_prefetch = (_paramiko_version >= (1, 5, 5))
108
107
 
109
108
# Paramiko 1.5 tries to open a socket.AF_UNIX in order to connect
110
109
# to ssh-agent. That attribute doesn't exist on win32 (it does in cygwin)
111
110
# so we get an AttributeError exception. So we will not try to
112
111
# connect to an agent if we are on win32 and using Paramiko older than 1.6
113
 
_use_win32_ssh_agent = False
114
 
if getattr(paramiko, '__version_info__', (0, 0, 0)) >= (1, 6, 0):
115
 
    _use_win32_ssh_agent = True
 
112
_use_ssh_agent = (sys.platform != 'win32' or _paramiko_version >= (1, 6, 0)) 
116
113
 
117
114
 
118
115
_ssh_vendor = None
782
779
        # Also, it would mess up the self.relpath() functionality
783
780
        username = self._username or getpass.getuser()
784
781
 
785
 
        if sys.platform != 'win32' or _use_win32_ssh_agent:
 
782
        if _use_ssh_agent:
786
783
            agent = paramiko.Agent()
787
784
            for key in agent.get_keys():
788
785
                mutter('Trying SSH agent key %s' % paramiko.util.hexify(key.get_fingerprint()))