[Distutils] EasyInstall: verbosity

Phillip J. Eby pje at telecommunity.com
Mon May 30 05:12:46 CEST 2005

At 09:02 PM 5/29/2005 -0500, Ian Bicking wrote:
>As different kinds of indirection and detection are added to
>easy_install, it should probably have a verbosity option.  I think this
>would probably best work by using the logging module, so that Installer
>takes a logger object or name, and reports all messages to that logger,
>and in main() it directs the logger to stdout and sets the log level
>based on the verbosity indicated.  Tools that work with easy_install
>outside of the command-line could probably also make good use of the
>logging output.

Yeah, this is actually exactly what I plan to do in an unspecified future 
release, probably after I add filesystem virtualization/sandboxing, or 
maybe in conjunction with it.  I hadn't really thought about the part where 
main() would set it up, but that part makes good sense too.  I was planning 
to pass verbosity options through to the setup() script, and temporarily 
redirect its stdout/stderr to pass through the logger.

The idea there is that GUI tools that wrap easy_install may want to display 
the progress messages, etc. in a progress dialog or status bar or something 
of that sort.  This is especially true for the downloading part, which can 
take a while.

By the way, the sandboxing feature is where I plan to replace a few key 
'os' module functions and builtins with ones that "notice" if the setup 
script is trying to modify files outside the installer's temporary 
directory.  Initially this will just be so I can analyze those scripts' 
behavior, but it might eventually grow into a facility to make them think 
they're modifying files in the real filesystem, but they would actually be 
getting redirected to the right temporary subdirectory for stuff to be 
added into the egg.  I don't know if this feature is really achievable, but 
most all file access in Python boils down to either 'open()' or a call to 
an 'os' function imported from the platform-specific extension ('nt', 
'mac', 'posix', etc.).

Anyway, arguably people should "fix" their packages, but in practice some 
folks won't, so a working sandbox could be helpful.  But I'll probably want 
the sandbox tools to do a lot of output at various levels of detail, hence 
why I'd probably use the logging package to do this.

>I could add this, but the number of parallel patches is probably going
>to leave everyone (including me) confused.  (I'm working on installation
>of packages without setup.py files right now)

Cool.  You're really taking the ball and running with it, which is what I 
hoped would happen, as it's the specific reason I felt I had to release an 
initial, usable version of EasyInstall this very weekend.  :)

More information about the Distutils-SIG mailing list