[Distutils] More minor issues

Greg Ward gward@python.net
Sat Sep 16 12:10:01 2000


On 14 September 2000, Rene Liebscher said:
> Another problem:
> 
> python setup.py bdist --formats=zip,gztar
> 
> doesn't work. It deletes the build tree after
> creating the first archive.

OK, I've fixed the bug.  The problem was that when you ask to
reinitialize the "install" command, it doesn't reinitialize
"install_lib", "install_headers", etc.  Part of reinitializing a command
is resetting its "have run" flag to 0, so on the second run of
bdist_dumb, it looked like "install" had not run, but "install_lib" had.
So nothing actually got installed, and the directory that was supposed
to become the root of the archive didn't even exist.

The solution was to add a 'reinit_subcommands' flag to Distribution's
'reinitialize_command()' method.  Making this work required promoting
the "sub-commands" machinery -- which already had informal standing in
the "install" command -- up to the Command base class.  Now the
Distutils have formal recognition of command "families", something that
I've known for a while is needed, but hadn't gotten around to until now.

> There is a simple solution for that.
> First find out all commands to run.
> Then execute all commands, check for every command
> if it has to be run later again (eg. bdist_dumb
> with other format), if it has, check if there
> is a keep_tree option and set it.

OK, I applied your patch as an optimization.  It's not essential at all, 
but what the hell.

Also, I renamed --keep-tree to --keep-temp in the two bdist commands
that had it (bdist_dumb and bdist_wininst).  And I changed bdist_rpm so
it, too, has a --keep-tree option (it used to have --clean/--no-clean).
Now, all bdist commands must support the --keep-tree option, so there's
no need for bdist.py to check if it exists before assigning to it.

        Greg