[Distutils] Re: Opening up backdoors to 'setup()'
Tue Aug 29 21:35:01 2000
> So distutils.core.setup(script_name=file, script_args=commands) is the
> same as distutils.core.run_setup(file, commands)?
No. Passing 'script_name' to 'setup()' is just a "fool yourself" thing;
it doesn't actually change the script being run. It's mainly there for
completism's sake; if you can override sys.argv[1:], you ought to be
able to override sys.argv.
Here's a summary of what I'm thinking right now:
- the traditional and usual way to invoke the Distutils
- parses sys.argv (unless you override it) and carries out
all actions implied by the command line and config files
- currently returns nothing -- not much point, because it's all about
side-effect, and the intended use is from a setup script, which is
run by an installer who doesn't give a whit about the Distribution
run_setup(file, script_args=sys.argv[1:], stop_after="run")
- execfile's the setup script named by 'file'
- this causes 'setup()' to be called in the normal way, so that
a Distribution instance is created in the normal way, etc.
- but some strings are pulled behind the scenes so that we don't
necessarily run to completion
- and something -- probably the Distribution instance -- is
returned, which the caller can than query to discover the
state of the distribution (eg. metadata, contents of config
> If so, is there any need for a run_setup function?
I still think so. The differences are subtle but important.
Greg Ward - Unix geek firstname.lastname@example.org
"He's dead, Jim. You get his tricorder and I'll grab his wallet."