Issue 818201: distutils: clean does not use build_base option from build (original) (raw)

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:

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:38

admin

set

github: 39375

2021-02-03 18:28:59

steve.dower

set

status: open -> closed

nosy: + steve.dower
messages: +

resolution: out of date
stage: test needed -> resolved

2014-07-18 21:51:10

BreamoreBoy

set

nosy: + dstufft

components: - Distutils2
versions: + Python 2.7, Python 3.4, Python 3.5

2012-01-03 16:48:09

eric.araujo

set

status: closed -> open
versions: - Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.2
messages: +

resolution: fixed -> (no value)
stage: resolved -> test needed

2011-12-16 17:45:14

davidsj2

set

nosy: + davidsj2
messages: +

2010-08-04 16:21:41

nicholas.riley

set

messages: +

2010-08-04 16:17:52

eric.araujo

set

status: open -> closed
nosy:nicholas.riley, tarek, eric.araujo
messages: +

components: + Distutils
resolution: accepted -> fixed
stage: test needed -> resolved

2010-08-02 08:53:46

eric.araujo

set

versions: + Python 2.6, Python 2.5, Python 3.1, Python 2.7, Python 3.2
nosy:nicholas.riley, tarek, eric.araujo
messages: +

assignee: tarek -> eric.araujo
components: + Distutils2, - Distutils
resolution: accepted

2010-07-28 10:06:16

eric.araujo

set

nosy: + 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:23

akitada

set

nosy: + tarek

2003-10-05 17:37:44

nicholas.riley

create