homepage

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.

classification
Title: distutils: clean does not use build_base option from build
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: davidsj2, dstufft, eric.araujo, nicholas.riley, steve.dower, tarek
Priority: normal Keywords:

Created on 2003年10月05日 17:37 by nicholas.riley, last changed 2022年04月10日 16:11 by admin. This issue is now closed.

Messages (7)
msg18567 - (view) Author: Nicholas Riley (nicholas.riley) * Date: 2003年10月05日 17:37
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.
msg112430 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010年08月02日 08:53
Sorry for the long delay without reply. Thank you for the report, I’ll look into it in the following weeks. In distutils2, I think clean could use the configure command (#8254) or maybe it’ll be simpler to just set_undefined_options from build. I’ll ask Tarek whether we can backport this to distutils after it’s done.
msg112829 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2010年08月04日 16:17
This is actually already fixed. Thanks for the report nonetheless!
msg112830 - (view) Author: Nicholas Riley (nicholas.riley) * Date: 2010年08月04日 16:21
Good to know - thanks!
msg149632 - (view) Author: Josh (davidsj2) Date: 2011年12月16日 17:45
Where was this fixed? It is still a problem in Python 2.6.6.
For example, if I do: 
python setup.py build_ext --compiler=mingw32 build --build-platlib=build\win64
Then follow it up with:
python setup.py clean --build-base=build\win64 -a
This is what it does:
running clean
'build\lib.win-amd64-2.6' does not exist -- can't clean it
removing 'build\bdist.win-amd64' (and everything under it)
'build\scripts-2.6' does not exist -- can't clean it
As you can see, the base directory argument is ignored.
msg150514 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年01月03日 16:48
> Where was this fixed? It is still a problem in Python 2.6.6.
I assumed it was fixed after looking at the code: clean does take build-* options from the build command.
> For example, if I do: 
> python setup.py build_ext --compiler=mingw32 build --build-platlib=build\win64
> Then follow it up with:
> python setup.py clean --build-base=build\win64 -a
> This is what it does:
> running clean
> 'build\lib.win-amd64-2.6' does not exist -- can't clean it
> removing 'build\bdist.win-amd64' (and everything under it)
> 'build\scripts-2.6' does not exist -- can't clean it
> As you can see, the base directory argument is ignored.
I’m not sure if this is a distutils bug or if you have to use the same options (i.e. build-lib both times, not build-platlib then build-base). The original report used -b (build-base) for both commands, so I’ll turn that into a test (unless you’d like to do it?) to see if it works as intended or not.
msg386398 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2021年02月03日 18:28
Distutils is now deprecated (see PEP 632) and all tagged issues are being closed. From now until removal, only release blocking issues will be considered for distutils.
If this issue does not relate to distutils, please remove the component and reopen it. If you believe it still requires a fix, most likely the issue should be re-reported at https://github.com/pypa/setuptools 
History
Date User Action Args
2022年04月10日 16:11:38adminsetgithub: 39375
2021年02月03日 18:28:59steve.dowersetstatus: open -> closed

nosy: + steve.dower
messages: + msg386398

resolution: out of date
stage: test needed -> resolved
2014年07月18日 21:51:10BreamoreBoysetnosy: + dstufft

components: - Distutils2
versions: + Python 2.7, Python 3.4, Python 3.5
2012年01月03日 16:48:09eric.araujosetstatus: closed -> open
versions: - Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.2
messages: + msg150514

resolution: fixed -> (no value)
stage: resolved -> test needed
2011年12月16日 17:45:14davidsj2setnosy: + davidsj2
messages: + msg149632
2010年08月04日 16:21:41nicholas.rileysetmessages: + msg112830
2010年08月04日 16:17:52eric.araujosetstatus: open -> closed
nosy: nicholas.riley, tarek, eric.araujo
messages: + msg112829

components: + Distutils
resolution: accepted -> fixed
stage: test needed -> resolved
2010年08月02日 08:53:46eric.araujosetversions: + Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.2
nosy: nicholas.riley, tarek, eric.araujo
messages: + msg112430

assignee: tarek -> eric.araujo
components: + Distutils2, - Distutils
resolution: accepted
2010年07月28日 10:06:16eric.araujosetnosy: + eric.araujo
title: distutils: clean -b ignored; set_undefined_options doesn't -> distutils: clean does not use build_base option from build
assignee: tarek
versions: - Python 2.3
type: behavior
stage: test needed
2009年02月10日 16:43:23akitadasetnosy: + tarek
2003年10月05日 17:37:44nicholas.rileycreate

AltStyle によって変換されたページ (->オリジナル) /