diff options
Diffstat (limited to 'pym')
-rw-r--r-- | pym/getbinpkg.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/pym/getbinpkg.py b/pym/getbinpkg.py index 8bd43f29c..9484d1d16 100644 --- a/pym/getbinpkg.py +++ b/pym/getbinpkg.py @@ -419,7 +419,24 @@ def file_get_lib(baseurl,dest,conn=None): elif protocol in ["ftp"]: data,rc,msg = make_ftp_request(conn, address, dest=dest) elif protocol == "sftp": - conn.get(address, dest) + rc = 0 + try: + f = conn.open(address) + except SystemExit: + raise + except Exception: + rc = 1 + else: + try: + if dest: + bufsize = 8192 + while True: + data = f.read(bufsize) + if not data: + break + dest.write(data) + finally: + f.close() else: raise TypeError, "Unknown protocol. '%s'" % protocol |