[Distutils] What about an info command?

Greg Ward gward@python.net
Sun, 9 Apr 2000 19:57:26 -0400

On 07 April 2000, Bastian Kleineidam said:
> I'd like to extract some information stored in setup.py, namely
> the package version.

Yeah, good idea.

> A way to provide this is an "info" command. So you can have:
> ./setup.py info [--version,--name,--url,--author,...]

I'm not sure this is the right way to do it.  Although in general I like
the modularity of the "command" system, I think this information is so
fundamental to the distribution that it belongs in the Distribution
class -- note the query methods 'get_name()', 'has_ext_modules()',
etc. that I recently added; this would be in the same vein.

This implies hacking the 'parse_command_line()' in dist.py -- feel free
to refactor this sucker if you spot a good way to break it up.  (...he
inspects the code...)  Let me rephrase that: *please* find a way to
break this method up and refactor it.  And then work in the following

    --name               -> "Distutils"
    --version            -> "0.8"
    --fullname           -> "Distutils-0.8"
    --author             -> "Greg Ward"
    --author-email       -> "gward@python.net"
    --maintainer         -> ""
    --maintainer-email   -> ""
    --contact            -> maintainer if present, else author
    --contact-email      -> maintainer_email if present, else author_email
    --url                -> "http://www.python.org/sigs/distutils-sig/"
    --description        -> "Python Distribution Utilities"

The logic for --name, --version, and --fullname is already in the
'get_name()', 'get_version()', and 'get_full_name()' methods of
Distribution; you should add 'get_contact()' and 'get_contact_email()'
methods to support the two --contact options.  Other than that, direct
attribute access should work.

These methods should all act like --help -- not an error, but once seen,
we won't run any commands, no matter what else is on the command line.

Thanks for the idea -- looking forward to a new patch!

Greg Ward - Linux weenie                                gward@python.net
We have always been at war with Oceania.