diff options
author | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-04 20:14:43 (GMT) |
---|---|---|
committer | Jeremy Hylton <jeremy@alum.mit.edu> | 2002-06-04 20:14:43 (GMT) |
commit | cd8a1148e19116db109f27d26c02e1de536dc76e (patch) | |
tree | e3969bc16f8ef0c540f1d0e72fb0da711344d758 /Lib/distutils/file_util.py | |
parent | 6fa82a34775576b90c8ec38e8968dfbb0b02e11d (diff) | |
download | cpython-cd8a1148e19116db109f27d26c02e1de536dc76e.zip cpython-cd8a1148e19116db109f27d26c02e1de536dc76e.tar.gz cpython-cd8a1148e19116db109f27d26c02e1de536dc76e.tar.bz2 |
Make setup.py less chatty by default.
This is a conservative version of SF patch 504889. It uses the log
module instead of calling print in various places, and it ignores the
verbose argument passed to many functions and set as an attribute on
some objects. Instead, it uses the verbosity set on the logger via
the command line.
The log module is now preferred over announce() and warn() methods
that exist only for backwards compatibility.
XXX This checkin changes a lot of modules that have no test suite and
aren't exercised by the Python build process. It will need
substantial testing.
Diffstat (limited to 'Lib/distutils/file_util.py')
-rw-r--r-- | Lib/distutils/file_util.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/Lib/distutils/file_util.py b/Lib/distutils/file_util.py index 14772fb..56b1fae 100644 --- a/Lib/distutils/file_util.py +++ b/Lib/distutils/file_util.py @@ -9,7 +9,7 @@ __revision__ = "$Id$" import os from distutils.errors import DistutilsFileError - +from distutils import log # for generating verbose output in 'copy_file()' _copy_action = { None: 'copying', @@ -73,7 +73,6 @@ def _copy_file_contents (src, dst, buffer_size=16*1024): # _copy_file_contents() - def copy_file (src, dst, preserve_mode=1, preserve_times=1, @@ -90,8 +89,7 @@ def copy_file (src, dst, 'preserve_times' is true (the default), the last-modified and last-access times are copied as well. If 'update' is true, 'src' will only be copied if 'dst' does not exist, or if 'dst' does exist but is - older than 'src'. If 'verbose' is true, then a one-line summary of the - copy will be printed to stdout. + older than 'src'. 'link' allows you to make hard links (os.link) or symbolic links (os.symlink) instead of copying: set it to "hard" or "sym"; if it is @@ -127,20 +125,18 @@ def copy_file (src, dst, dir = os.path.dirname(dst) if update and not newer(src, dst): - if verbose: - print "not copying %s (output up-to-date)" % src - return (dst, 0) + 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 verbose: - if os.path.basename(dst) == os.path.basename(src): - print "%s %s -> %s" % (action, src, dir) - else: - print "%s %s -> %s" % (action, src, dst) + 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) @@ -197,8 +193,7 @@ def move_file (src, dst, from os.path import exists, isfile, isdir, basename, dirname import errno - if verbose: - print "moving %s -> %s" % (src, dst) + log.info("moving %s -> %s", src, dst) if dry_run: return dst |