[Python-Dev] distutils & stderr
01 Feb 2002 11:11:44 +0000
Greg Ward <email@example.com> writes:
> On 31 January 2002, Jeremy Hylton said:
> > I started a thread on similar issues on the distutils-sig mailing list
> > a week or two ago. There's agreement that output is a problem.
> The amount of output, or the binary nature of control (total silence
> vs. total verbosity)? I knew that was a minor problem when I wrote that
> code initially, but had bigger fish to fry.
I'm thinking that verbose should range from about -2 (no output at
all, even from commands if we can supress it) to about 2 (stupid
amounts of output) with the default being 0, where we take our guide
from what make outputs by default.
-v and -q would then be additive on the command line, so
python setup.py -q -v -v -q -q
would be an odd way of specifying "verbose==-1".
> FWIW, my current thinking is that code that wants to be chatty should do
> something like this:
> log(1, "installing foo.bar package")
> log(2, "copying foo/bar/baz.py to /usr/local/lib/python2.1/site-packages/foo/bar")
> The first number is the logging threshold, compared against a global
> verbosity level.
This sounds good.
> In a strongly OO system like the Distutils, that should probably be
> log(N, msg)
> where the logging threshold is carried around in each object (or in some
> global object).
> This shouldn't be too hard to bolt onto the existing code -- ISTR that
> the verbose flag is readily available to every object in the system;
> just change it from a boolean to an integer and ensure that every log
> message goes through self.log().
> Oh wait: most of the low-level worker code in the Distutils falls
> outside the main class hierarchy, so the verbose flag isn't *quite* so
> readily available; it gets passed in to a heck of a lot of functions.
There are a lot of calls in disutils that go
Would it really be so bad to have a global "verbose" variable in, say,
core? (same for dry_run, too).
Of course, what I would like is CL-style special variables, but ne'er
ARTHUR: Why are there three of you?
LINTILLAS: Why is there only one of you?
ARTHUR: Er... Could I have notice of that question?
-- The Hitch-Hikers Guide to the Galaxy, Episode 11