diff options
author | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-06 00:38:35 +0000 |
---|---|---|
committer | Tarek Ziadé <ziade.tarek@gmail.com> | 2009-02-06 00:38:35 +0000 |
commit | 70a74eb2c46e18f77cf75106a7ee07767fa90aaf (patch) | |
tree | a261b41725ae1d755c53d1e27c0e88b42bb93be6 /Lib/distutils/file_util.py | |
parent | 4d491a535ccab3caef1dba0d079c398b551c045c (diff) | |
download | cpython-git-70a74eb2c46e18f77cf75106a7ee07767fa90aaf.tar.gz |
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.
........
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 b46b0da678..00c5bc5b8e 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: |