classification
Title: bdist_wininst ignores build_lib from build command
Type: behavior Stage: patch review
Components: Distutils Versions: Python 3.2, Python 3.1, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: tarek Nosy List: aimacintyre, atuining, eric.araujo, mhammond, nick.martin, tarek
Priority: normal Keywords: patch

Created on 2005-01-26 15:52 by atuining, last changed 2011-01-11 00:05 by eric.araujo.

Files
File name Uploaded Description Edit
python_issue_1109963.patch aimacintyre, 2009-04-23 11:03 patch to remove build_lib override when target_version == building version
Messages (5)
msg60642 - (view) Author: Anthony Tuininga (atuining) Date: 2005-01-26 15:52
As of Python 2.4, some code got added to the
bdist_wininst command to override the build_lib option
on the build command. I had successfully been using the
following command which now fails:

D:\Python24\python.exe setup.py build --force
--compiler=mingw32 --build-lib
D:\Anthony\Build\Dev\cx_Oracle\HEAD\9i-py24\win32
--build-temp
D:\Anthony\Build\Dev\cx_Oracle\HEAD\9i-py24\win32
bdist_wininst --bdist-dir
D:\Anthony\Build\Dev\cx_Oracle\HEAD\9i-py24\win32\temp
--dist-dir
D:\Anthony\Build\Dev\cx_Oracle\HEAD\9i-py24\win32

Here is the offending code from the run() method of the
bdist_wininst command:

        if self.distribution.has_ext_modules():
            # If we are building an installer for a
Python version other
            # than the one we are currently running,
then we need to ensure
            # our build_lib reflects the other Python
version rather than ours.             # Note that for
target_version!=sys.version, we must have skipped the
            # build step, so there is no issue with
enforcing the build of this
            # version.
            target_version = self.target_version
            if not target_version:
                assert self.skip_build, "Should have
already checked this"
                target_version = sys.version[0:3]
            plat_specifier = ".%s-%s" %
(get_platform(), target_version)
            build = self.get_finalized_command('build')
            build.build_lib =
os.path.join(build.build_base,
                                           'lib' +
plat_specifier)

The last line is the problem here. If I comment it out,
the problem goes away.
msg75323 - (view) Author: Anthony Tuininga (atuining) Date: 2008-10-29 17:59
This problem also occurs in the bdist_msi command.
msg75450 - (view) Author: Nick Martin (nick.martin) Date: 2008-11-01 21:57
This is exactly the same problem I was having with bdist_msi.
msg86361 - (view) Author: Andrew I MacIntyre (aimacintyre) * Date: 2009-04-23 11:03
The offending code appears to have been introduced in r33090 and tweaked
in r37025, which both originated from Mark Hammond.

From the comments, there seems to be no reason why the build_lib
override should apply when the target version is specifically different
from the version being used to build the extension, hence I've attached
a patch which applies the override only when the versions are different
(for both bdist_wininst and bdist_msi).

This doesn't solve the problem that exists when the target and build
versions are different and build_lib has been overridden in setup.py (as
I understand is the case with cx_Oracle).

I've added Mark to the nosy list in the hope he might, as originator of
the problematic changes, be able to provide some insight.
msg86382 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2009-04-23 23:01
So it looks like I broke the ability to override --build-lib :(  Without
testing, I think you might also need to handle the cross-compile case -
the version may be the same, but the platform different.  I know
distutils is a PITA so might make this difficult, but it might be better
that we only set build_lib if the user didn't - ie, trust the user knows
what they are doing if they specify that option, even in these
'mismatched version/platform' cases.
History
Date User Action Args
2011-01-11 00:05:41eric.araujosetnosy: + eric.araujo
2010-08-19 18:58:05BreamoreBoysetstage: patch review
type: behavior
versions: + Python 3.1, Python 3.2, - Python 2.6
2009-04-23 23:01:39mhammondsetmessages: + msg86382
2009-04-23 11:03:17aimacintyresetfiles: + python_issue_1109963.patch

nosy: + mhammond, aimacintyre
messages: + msg86361

keywords: + patch
2009-02-11 02:57:44ajaksu2setassignee: tarek
nosy: + tarek
versions: + Python 2.7, - Python 2.5, Python 2.4
2008-11-01 21:57:28nick.martinsetnosy: + nick.martin
messages: + msg75450
2008-10-29 17:59:07atuiningsetmessages: + msg75323
versions: + Python 2.6, Python 2.5
2005-01-26 15:52:56atuiningcreate