bug in bdist_wininst cross compile?

R

Robin Becker

has anyone had any success with cross compilation and bdist_wininst; I have
modified build_ext very slightly to fix a small bug in cross compilation related
to library order. That seems to fix

setup.py build --plat-name=win-amd64


however, when I try to do a clean build of an exe ie

rm -rf build

setup.py bdist_wininst --plat-name=win-amd64

it appears as though build is invoked with the wrong plat-name ie I see this in
the output
running bdist_wininst
running build
running build_py
creating build
creating build\lib.win32-2.6
creating build\lib.win32-2.6\reportlab
copying src\reportlab\rl_config.py -> build\lib.win32-2.6\reportlab .......
C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nolog

followed by errors related to a missing library (the amd64 version won't work
with a win32 build).

If I build first with

setup.py build --plat-name=win-amd64

and then use

setup.py bdist_wininst --plat-name=win-amd64 --skip-build

then I seem to get a proper amd64 exe.

I think the problem can be fixed by modifying distutils/command/bdist_wininst.py
using this patch
*** bdist_wininst.py.orig Wed Mar 17 14:00:15 2010
--- bdist_wininst.py Wed Mar 17 14:29:55 2010
***************
*** 79,90 ****

def finalize_options (self):
if self.bdist_dir is None:
! if self.skip_build and self.plat_name:
! # If build is skipped and plat_name is overridden, bdist will
! # not see the correct 'plat_name' - so set that up manually.
bdist = self.distribution.get_command_obj('bdist')
bdist.plat_name = self.plat_name
! # next the command will be initialized using that name
bdist_base = self.get_finalized_command('bdist').bdist_base
self.bdist_dir = os.path.join(bdist_base, 'wininst')
if not self.target_version:
--- 79,91 ----

def finalize_options (self):
if self.bdist_dir is None:
! if self.plat_name:
! #bdist doesn't propagate plat_name so we do it here
! build = self.distribution.get_command_obj('build')
! build.plat_name = self.plat_name
bdist = self.distribution.get_command_obj('bdist')
bdist.plat_name = self.plat_name
! # next the command(s) will be initialized using that name
bdist_base = self.get_finalized_command('bdist').bdist_base
self.bdist_dir = os.path.join(bdist_base, 'wininst')
if not self.target_version:

which forces bdist_wininst's version of the plat_name forward onto both build
and bdist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,967
Messages
2,570,148
Members
46,694
Latest member
LetaCadwal

Latest Threads

Top