Merged revisions 69324 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r69324 | tarek.ziade | 2009-02-06 01:31:59 +0100 (Fri, 06 Feb 2009) | 1 line

  Fixed #1276768: verbose option was not used in the code.
........
This commit is contained in:
Tarek Ziadé 2009-02-06 00:38:35 +00:00
parent 4d491a535c
commit 70a74eb2c4
5 changed files with 188 additions and 24 deletions

View file

@ -67,7 +67,7 @@ def _copy_file_contents(src, dst, buffer_size=16*1024):
fsrc.close()
def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
link=None, verbose=0, dry_run=0):
link=None, verbose=1, dry_run=0):
"""Copy a file 'src' to 'dst'. If 'dst' is a directory, then 'src' is
copied there with the same name; otherwise, it must be a filename. (If
the file exists, it will be ruthlessly clobbered.) If 'preserve_mode'
@ -112,17 +112,20 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
dir = os.path.dirname(dst)
if update and not newer(src, dst):
log.debug("not copying %s (output up-to-date)", src)
if verbose == 1:
log.debug("not copying %s (output up-to-date)", src)
return (dst, 0)
try:
action = _copy_action[link]
except KeyError:
raise ValueError("invalid value '%s' for 'link' argument" % link)
if os.path.basename(dst) == os.path.basename(src):
log.info("%s %s -> %s", action, src, dir)
else:
log.info("%s %s -> %s", action, src, dst)
if verbose == 1:
if os.path.basename(dst) == os.path.basename(src):
log.info("%s %s -> %s", action, src, dir)
else:
log.info("%s %s -> %s", action, src, dst)
if dry_run:
return (dst, 1)
@ -164,7 +167,7 @@ def copy_file(src, dst, preserve_mode=1, preserve_times=1, update=0,
# XXX I suspect this is Unix-specific -- need porting help!
def move_file (src, dst,
verbose=0,
verbose=1,
dry_run=0):
"""Move a file 'src' to 'dst'. If 'dst' is a directory, the file will
@ -177,7 +180,8 @@ def move_file (src, dst,
from os.path import exists, isfile, isdir, basename, dirname
import errno
log.info("moving %s -> %s", src, dst)
if verbose == 1:
log.info("moving %s -> %s", src, dst)
if dry_run:
return dst
@ -209,7 +213,7 @@ def move_file (src, dst,
"couldn't move '%s' to '%s': %s" % (src, dst, msg))
if copy_it:
copy_file(src, dst)
copy_file(src, dst, verbose=verbose)
try:
os.unlink(src)
except os.error as e: