Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 123021 Details for
Bug 175891
sftp not suported as transport for PORTAGE_BINHOST
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
python script for use in {FETCHCOMMAND,RESUMECOMMAND}_SFTP
sftp.py (text/plain), 2.22 KB, created by
Zac Medico
on 2007-06-25 06:39:20 UTC
(
hide
)
Description:
python script for use in {FETCHCOMMAND,RESUMECOMMAND}_SFTP
Filename:
MIME Type:
Creator:
Zac Medico
Created:
2007-06-25 06:39:20 UTC
Size:
2.22 KB
patch
obsolete
>#!/usr/bin/python ># Copyright 1998-2007 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 > >import os, sys > >BUFSIZE = 8192 > >if __name__ == "__main__": > from optparse import OptionParser > usage = "%s [OPTION]... [URL]..." % os.path.basename(sys.argv[0]) > parser = OptionParser(usage=usage) > parser.add_option("-O", "--output-document", dest="filename", > help="save uri to FILE", metavar="FILE") > parser.add_option("-c", "--continue", action="store_true", dest="cont", > help="continue getting a partially-downloaded file") > parser.add_option("-b", "--blocksize", type="int", > help="block size used for read/write", default=BUFSIZE) > parser.add_option("-q", "--quiet", action="store_true", > help="disable output") > options, args = parser.parse_args(sys.argv[1:]) > if len(args) != 1: > parser.error("missing URL") > uri = args[0] > parts = uri.split("://", 1) > if len(parts) != 2: > parser.error("invalid URL: % '%s'" % uri) > protocol = parts[0] > parts = parts[1].split("/", 1) > if len(parts) != 2: > parser.error("invalid URL: % '%s'" % uri) > host = parts[0] > path = parts[1] > userpass_host = host.split("@", 1) > if len(userpass_host) != 2: > parser.error("invalid host name: '%s'" % host) > else: > host = userpass_host[1] > userpass = userpass_host[0].split(":") > if len(userpass) > 2: > parser.error("invalid user/password: % '%s'" % userpass) > elif len(userpass) == 2: > username = userpass[0] > password = userpass[1] > elif len(userpass) == 1: > username = userpass[0] > password = None > filename = options.filename > if not filename: > filename = os.path.basename(uri) > size = 0 > if options.cont: > try: > size = os.stat(filename).st_size > except EnvironmentError: > pass > bufsize = options.blocksize > quiet = options.quiet > stdout = sys.stdout > if size: > dest = open(filename, "a") > else: > dest = open(filename, "w") > import paramiko > t = paramiko.Transport(host) > t.connect(username=username, password=password) > conn = paramiko.SFTPClient.from_transport(t) > f = conn.open(path) > if size: > f.seek(size) > try: > while True: > data = f.read(bufsize) > if not data: > break > dest.write(data) > if not quiet: > stdout.write(".") > stdout.flush() > finally: > f.close() > if not quiet: > stdout.write("\n") > stdout.flush() >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 175891
:
120600
|
123003
|
123020
| 123021