[Python-Dev] distutils & stderr

Greg Ward gward@python.net
Thu, 31 Jan 2002 22:11:43 -0500

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.

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.

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.

Greg Ward - programmer-at-big                           gward@python.net
"He's dead, Jim.  You get his tricorder and I'll grab his wallet."