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.
This commit is contained in:
Jeremy Hylton 2002-06-04 20:14:43 +00:00
parent 6fa82a3477
commit cd8a1148e1
32 changed files with 260 additions and 313 deletions

View file

@ -16,7 +16,7 @@ from distutils.file_util import move_file
from distutils.dir_util import mkpath
from distutils.dep_util import newer_pairwise, newer_group
from distutils.util import split_quoted, execute
from distutils import log
class CCompiler:
"""Abstract base class to define the interface that must be implemented
@ -80,7 +80,6 @@ class CCompiler:
dry_run=0,
force=0):
self.verbose = verbose
self.dry_run = dry_run
self.force = force
@ -808,8 +807,7 @@ class CCompiler:
# -- Utility methods -----------------------------------------------
def announce (self, msg, level=1):
if self.verbose >= level:
print msg
log.debug(msg)
def debug_print (self, msg):
from distutils.core import DEBUG
@ -820,16 +818,16 @@ class CCompiler:
sys.stderr.write ("warning: %s\n" % msg)
def execute (self, func, args, msg=None, level=1):
execute(func, args, msg, self.verbose >= level, self.dry_run)
execute(func, args, msg, self.dry_run)
def spawn (self, cmd):
spawn (cmd, verbose=self.verbose, dry_run=self.dry_run)
spawn (cmd, dry_run=self.dry_run)
def move_file (self, src, dst):
return move_file (src, dst, verbose=self.verbose, dry_run=self.dry_run)
return move_file (src, dst, dry_run=self.dry_run)
def mkpath (self, name, mode=0777):
mkpath (name, mode, self.verbose, self.dry_run)
mkpath (name, mode, self.dry_run)
# class CCompiler
@ -957,7 +955,10 @@ def new_compiler (plat=None,
("can't compile C/C++ code: unable to find class '%s' " +
"in module '%s'") % (class_name, module_name)
return klass (verbose, dry_run, force)
# XXX The None is necessary to preserve backwards compatibility
# with classes that expect verbose to be the first positional
# argument.
return klass (None, dry_run, force)
def gen_preprocess_options (macros, include_dirs):