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.
........
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py
index b46b0da..00c5bc5 100644
--- a/Lib/distutils/file_util.py
+++ b/Lib/distutils/file_util.py
@@ -67,7 +67,7 @@
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 @@
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 @@
# 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 @@
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 @@
"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: