diff options
Diffstat (limited to 'Lib/distutils/file_util.py')
-rw-r--r-- | Lib/distutils/file_util.py | 22 |
1 files changed, 13 insertions, 9 deletions
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 @@ 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: |