[Python-checkins] python/dist/src/Tools/scripts ftpmirror.py,1.15,1.16

montanaro@users.sourceforge.net montanaro@users.sourceforge.net
Wed, 04 Dec 2002 18:37:25 -0800


Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv20636

Modified Files:
	ftpmirror.py 
Log Message:
allow optional port specified as part of the hostname, e.g.,
"www.zope.org:8021".


Index: ftpmirror.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ftpmirror.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ftpmirror.py	11 Sep 2002 20:36:01 -0000	1.15
--- ftpmirror.py	5 Dec 2002 02:37:23 -0000	1.16
***************
*** 5,9 ****
  usage: ftpmirror [-v] [-q] [-i] [-m] [-n] [-r] [-s pat]
                   [-l username [-p passwd [-a account]]]
!                  hostname [remotedir [localdir]]
  -v: verbose
  -q: quiet
--- 5,9 ----
  usage: ftpmirror [-v] [-q] [-i] [-m] [-n] [-r] [-s pat]
                   [-l username [-p passwd [-a account]]]
!                  hostname[:port] [remotedir [localdir]]
  -v: verbose
  -q: quiet
***************
*** 14,18 ****
  -l username [-p passwd [-a account]]: login info (default .netrc or anonymous)
  -s pat: skip files matching pattern
! hostname: remote host
  remotedir: remote directory (default initial)
  localdir: local directory (default current)
--- 14,18 ----
  -l username [-p passwd [-a account]]: login info (default .netrc or anonymous)
  -s pat: skip files matching pattern
! hostname: remote host w/ optional port separated by ':'
  remotedir: remote directory (default initial)
  localdir: local directory (default current)
***************
*** 53,56 ****
--- 53,59 ----
      if not args: usage('hostname missing')
      host = args[0]
+     port = 0
+     if ':' in host:
+         host, port = host.split(':', 1)
      try:
          auth = netrc.netrc().authenticators(host)
***************
*** 80,84 ****
      f = ftplib.FTP()
      if verbose: print 'Connecting to %s...' % `host`
!     f.connect(host)
      if not nologin:
          if verbose:
--- 83,87 ----
      f = ftplib.FTP()
      if verbose: print 'Connecting to %s...' % `host`
!     f.connect(host,port)
      if not nologin:
          if verbose: