This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nicholas.riley
Recipients
Date 2003-10-05.17:37:44
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.

<http://mail.python.org/pipermail/distutils-sig/2003-
September/003414.html>

Here's something that I think should work:

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

Nothing happens.  This works, however:

% python setup.py 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', 
'build_platlib')
        for option in build_options:
            setattr(build, option, getattr(self, option))
        build.ensure_finalized()
        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 
src_cmd_obj.ensure_finalized.

- 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 
the
  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.
History
Date User Action Args
2007-08-23 14:17:31adminlinkissue818201 messages
2007-08-23 14:17:31admincreate