[Distutils] Bug in parsing of .cfg files

M.-A. Lemburg mal@lemburg.com
Fri Sep 22 04:04:00 2000


Greg Ward wrote:
> 
> 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.

Indeed :-)
 
> 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).

Right, that's what I thought... didn't work out all the way,
but would certainly make understanding distutils a lot easier.
 
> 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.

Right again :-)
 
> 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.

Apropos patch: have you seen the patch I posted here which
allows distutils to compile PYC and PYO files in one go ?
It basically adds a new util function compile() which takes
care of the logic.

Python's sys module should really support e.g. sys.setoptimization()
for this kind of task... it's on the plate, but we're in a
feature freeze so it won't make it into 2.0.
 
-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/