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.
diff --git a/Lib/distutils/mwerkscompiler.py b/Lib/distutils/mwerkscompiler.py
index 7c77b8b..6242f12 100644
--- a/Lib/distutils/mwerkscompiler.py
+++ b/Lib/distutils/mwerkscompiler.py
@@ -13,6 +13,7 @@
CCompiler, gen_preprocess_options, gen_lib_options
import distutils.util
import distutils.dir_util
+from distutils import log
import mkcwproject
class MWerksCompiler (CCompiler) :
@@ -132,8 +133,8 @@
exportname = basename + '.mcp.exp'
prefixname = 'mwerks_%s_config.h'%basename
# Create the directories we need
- distutils.dir_util.mkpath(build_temp, self.verbose, self.dry_run)
- distutils.dir_util.mkpath(output_dir, self.verbose, self.dry_run)
+ distutils.dir_util.mkpath(build_temp, dry_run=self.dry_run)
+ distutils.dir_util.mkpath(output_dir, dry_run=self.dry_run)
# And on to filling in the parameters for the project builder
settings = {}
settings['mac_exportname'] = exportname
@@ -159,8 +160,7 @@
return
# Build the export file
exportfilename = os.path.join(build_temp, exportname)
- if self.verbose:
- print '\tCreate export file', exportfilename
+ log.debug("\tCreate export file", exportfilename)
fp = open(exportfilename, 'w')
fp.write('%s\n'%export_symbols[0])
fp.close()
@@ -181,8 +181,7 @@
# because we pass this pathname to CodeWarrior in an AppleEvent, and CW
# doesn't have a clue about our working directory.
xmlfilename = os.path.join(os.getcwd(), os.path.join(build_temp, xmlname))
- if self.verbose:
- print '\tCreate XML file', xmlfilename
+ log.debug("\tCreate XML file", xmlfilename)
xmlbuilder = mkcwproject.cwxmlgen.ProjectBuilder(settings)
xmlbuilder.generate()
xmldata = settings['tmp_projectxmldata']
@@ -191,12 +190,10 @@
fp.close()
# Generate the project. Again a full pathname.
projectfilename = os.path.join(os.getcwd(), os.path.join(build_temp, projectname))
- if self.verbose:
- print '\tCreate project file', projectfilename
+ log.debug('\tCreate project file', projectfilename)
mkcwproject.makeproject(xmlfilename, projectfilename)
# And build it
- if self.verbose:
- print '\tBuild project'
+ log.debug('\tBuild project')
mkcwproject.buildproject(projectfilename)
def _filename_to_abs(self, filename):