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: bdist_wininst ignores build_lib from build command
Type: behavior Stage: resolved
Components: Distutils Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: tarek Nosy List: aimacintyre, atuining, eric.araujo, mhammond, nick.martin, tarek, vstinner
Priority: normal Keywords: patch

Created on 2005-01-26 15:52 by atuining, last changed 2022-04-11 14:56 by admin. This issue is now closed.

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 (6)
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) * (Python triager) 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.
msg384831 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-01-11 12:52
The distutils bdist_wininst command has been removed in Python 3.10: see bpo-42802.
History
Date User Action Args
2022-04-11 14:56:09adminsetgithub: 41490
2021-01-11 12:52:43vstinnersetstatus: open -> closed

nosy: + vstinner
messages: + msg384831

resolution: wont fix
stage: patch review -> resolved
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