Author nicholas.riley
Date 2003-10-05.17:37:44
SpamBayes Score
Marked as misclassified
I reported this on the distutils-sig list and didn't receive 
any response. I'd be happy to provide a patch, but I'm not 
sure which way to go.


Here's something that I think should work:

% python --help clean
Options for 'clean' command:
  --build-base (-b)  base build directory (default: 
% python clean -b ../builds
running clean

Nothing happens.  This works, however:

% python build -b ../builds clean
running build
running build_py
running build_ext
running config
gcc -E -I/Library/Frameworks/Python.framework/Versions/
2.3/include/python2.3 -o_configtest.i _configtest.c
removing: _configtest.c _configtest.i
running clean
removing '../builds/temp.darwin-6.8-Power_Macintosh-2.3' 
(and everything under it)

The logic to set build_temp from build_base (-b) is only 
present in the build command, not in the clean command.  
The code to set this option runs from 
clean.set_undefined_options.  But it's clean's build_base 
option which is set at the time, not build's, so it 
propagates an empty path.

The test command class I found posted to the distutils-sig 
mailing list has a workaround for the above problem, which 
looks like this:

    def finalize_options(self):
        build = self.distribution.get_command_obj('build')
        build_options = ('build_base', 'build_purelib', 
        for option in build_options:
            setattr(build, option, getattr(self, option))
        for option in build_options:
            setattr(self, option, getattr(build, option))

and doesn't call self.set_undefined_options at all, though 
the last three lines could be replaced by it.

There are several solutions I can think of:

- set_undefined_options should be changed to propagate 
set options to
  the source command object before calling 

- another method should be added to the cmd class, which 
does the above
  propagation then calls set_undefined_options.

- a workaround such as the one above should be placed in 
  distutils.command.clean.clean class.

Does this make sense?  Unless there's a huge compatibility 
issue, I'd favor the first option, but my experience with 
distutils is limited.
Date User Action Args
2007-08-23 14:17:31adminlinkissue818201 messages
2007-08-23 14:17:31admincreate