[Distutils] Bug in parsing of .cfg files
Greg Ward
gward@python.net
Thu Sep 21 23:05:01 2000
On 20 September 2000, M.-A. Lemburg said:
> Ah ok. Thanks... after having made the change I now get:
>
> error: error in setup.cfg: command 'sdist' has no such option 'no_defaults'
I'm open to config files accepting hyphens as well as underscores. The
current config parsing code was thrown together pretty quickly, and yes
it *does* use ConfigParser. Accepting hyphens would make the
documentation a bit simpler, which is always a good metric of software
complexity.
The no_default vs. use_defaults could definitely be massaged a bit.
It's not documented at *all*; in fact, the docs as written would lead
you to believe that anything you see in "--help" output can be used in a
config file (modulo the underscore/hyphen thingy).
But that's not so: some options are just "negative aliases" for others.
The underlying reason for this is sound (--use-defaults and --no-default
both set the same instance attribute: 'use_defaults'), but that's just
an explanation, not an excuse. IMHO the config file should accept as
close to what the command-line accepts as possible: this means hyphens
too, and it means handling "negative alias" options.
Hmmm. I'll look into it -- just added it to the TODO file, FWIW.
Anyone who wants to give it a shot and submit a patch should look at the
'parse_config_files()' method in dist.py.
Greg
--
Greg Ward gward@python.net
http://starship.python.net/~gward/