summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/dist.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2002-06-04 20:14:43 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2002-06-04 20:14:43 (GMT)
commitcd8a1148e19116db109f27d26c02e1de536dc76e (patch)
treee3969bc16f8ef0c540f1d0e72fb0da711344d758 /Lib/distutils/dist.py
parent6fa82a34775576b90c8ec38e8968dfbb0b02e11d (diff)
downloadcpython-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/dist.py')
-rw-r--r--Lib/distutils/dist.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/Lib/distutils/dist.py b/Lib/distutils/dist.py
index b648f24..a84004f 100644
--- a/Lib/distutils/dist.py
+++ b/Lib/distutils/dist.py
@@ -15,7 +15,7 @@ from copy import copy
from distutils.errors import *
from distutils.fancy_getopt import FancyGetopt, translate_longopt
from distutils.util import check_environ, strtobool, rfc822_escape
-
+from distutils import log
# Regex to define acceptable Distutils command names. This is not *quite*
# the same as a Python NAME -- I don't allow leading underscores. The fact
@@ -46,7 +46,8 @@ class Distribution:
# since every global option is also valid as a command option -- and we
# don't want to pollute the commands with too many options that they
# have minimal control over.
- global_options = [('verbose', 'v', "run verbosely (default)"),
+ # The fourth entry for verbose means that it can be repeated.
+ global_options = [('verbose', 'v', "run verbosely (default)", 1),
('quiet', 'q', "run quietly (turns verbosity off)"),
('dry-run', 'n', "don't actually do anything"),
('help', 'h', "show detailed help message"),
@@ -392,6 +393,7 @@ class Distribution:
parser.set_aliases({'licence': 'license'})
args = parser.getopt(args=self.script_args, object=self)
option_order = parser.get_option_order()
+ log.set_verbosity(self.verbose)
# for display options we return immediately
if self.handle_display_options(option_order):
@@ -876,13 +878,7 @@ class Distribution:
# -- Methods that operate on the Distribution ----------------------
def announce (self, msg, level=1):
- """Print 'msg' if 'level' is greater than or equal to the verbosity
- level recorded in the 'verbose' attribute (which, currently, can be
- only 0 or 1).
- """
- if self.verbose >= level:
- print msg
-
+ log.debug(msg)
def run_commands (self):
"""Run each command that was seen on the setup script command line.
@@ -907,7 +903,7 @@ class Distribution:
if self.have_run.get(command):
return
- self.announce("running " + command)
+ log.info("running %s", command)
cmd_obj = self.get_command_obj(command)
cmd_obj.ensure_finalized()
cmd_obj.run()