[Distutils] re: Opening up backdoors to 'setup()'
Amos Latteier
amos@digicool.com
Tue, 29 Aug 2000 15:10:55 -0700
Greg Ward:
> On 28 August 2000, Amos Latteier said:
> > I've thought about this a little. It seems to me that the basic desire
> > is to be able to run setup from python, not the command line. I think we
> > could accommodate this with something like this
> >
> > distutils.core.run_setup(file, commands)
>
> Hmmm, that does look cleaner for your needs than setting a global mode
> variable. (Of course, it might end up setting a global mode variable
> behind the scenes, but never mind that. If I break 'setup()' up into
> its constituent parts, or farm more of it off to the Distribution class,
> that shouldn't be necessary.)
>
> However, since I just went ahead and implemented 'script_name' and
> 'script_args' arguments to 'setup()', this is not needed for Paul's
> case.
So distutils.core.setup(script_name=file, script_args=commands) is the
same as distutils.core.run_setup(file, commands)?
If so, is there any need for a run_setup function?
> > In my case I'll probably write a new command called something like
> > 'metadata' that doesn't do anything but return meta-data about the
> > distribution.
>
> We've been down this road before! The outcome was the
> DistributionMetadata class, defined in dist.py. Once you have a
> Distribution object, you can query its metadata using
> 'get_description()', 'get_fullname()', etc.
...
> I think I would spell this:
>
> dist = distutils.core.run_setup('foo-1.0/setup.py', stop_after="init")
>
> and then you can do this:
>
> print "%s (version %s), provided by %s" %
> (dist.get_name(), dist.get_version(), dist.get_contact())
>
> Seem reasonable?
Yes!
I don't care about the exact spelling, I just want access to the
Distribution object from Python. However... to me run_setup seems
different enough from setup to be a different function. Also
stop_after=init seems fairly close to a command to me. But I promise to
stop quibbling ;-) Whatever you decide is great.
Thanks!
-Amos
--
Amos Latteier mailto:amos@digicool.com
Digital Creations http://www.digicool.com