Français English
This page is not up to date, come back later for new versions
For easily creating a Linux and Windows version from my Python and
wxPython programs, I have experimented with creating executables for
Windows from Linux
- Objective
- Prerequisites
- Procedure
- Install wine
- Installation of
python, wxpython
- Configuration
of Wine
- Version = winxp
- shell32.dll
- Use of Python
- Installation of
the
McMillan's Python Installer
- Installation
- Configuration
- Usage
- Inno Setup
- Installation
- Compilation
- Conclusion
- License
- Authors
- Changelog
For easily creating a Linux and Windows version from my Python and
wxPython programs, I have experimented with creating executables for
Windows from Linux
Objective
Construct an environment for the creation of Windows exe files
(including installer) from Linux
Prerequisites
The solution I have created is based on the following tools:
Procedure
Install wine
urpmi wine
should do the trick with Mandrake 10.
Take a look at your distribution documentation to know how to install
Wine. I did not test with any version other than wine-20040213-3mdk.
Installation of
python, wxpython
The installations should run without any problems, simply use
Wine with:
wine setupname.exe
and follow the instructions
Configuration
of Wine
Look at the
wine
documentation for the general configuration
Version = winxp
For the configuration of Wine, I have to specify:
[Version]
"Windows" = "winxp"
If I used a different value here, python would not start.
shell32.dll
If you run python without installing the shell32.dll, you receive the
following error message:
$ /usr/bin/wine /var/lib/wine/Python23/python.exe
err:module:import_dll Loading module (file) SHELL32.dll (which is
needed by L"C:\\windows\\system\\python23.dll") failed (error c0000020).
err:module:import_dll No implementation for SHELL32.dll.ShellExecuteA
imported from L"C:\\windows\\system\\python23.dll", setting to
0xdeadbeef
Begin with installing the dll in your
Wine installation into the directory corresponding to :
c:\windows\system32\
(c: is defined in
~/.wine/config
)
For the configuration of the dll options (in
~/.wine/config
),
I used the basic Mandrake
configuration:
[DllOverrides]
"oleaut32" = "builtin, native"
"ole32" = "builtin, native"
"comdlg32" = "builtin, native"
"shell32" = "builtin, native"
"shfolder" = "builtin, native"
"shlwapi" = "builtin, native"
"shdocvw" = "builtin, native"
"advapi32" = "builtin, native"
"msvcrt" = "native, builtin"
"mciavi.drv" = "native, builtin"
"mcianim.drv" = "native, builtin"
"msi" = "native, builtin"
"riched32" = "native, builtin"
"stdole.tlb" = "native, builtin"
"stdole2.tlb" = "native, builtin"
"stdole32.tlb" = "native, builtin"
"MFC42" = "native, builtin"
"*" = "builtin, native"
Use of Python
At this point you should be able to launch Python under Wine:
$ /usr/bin/wine /var/lib/wine/Python23/python.exe
fixme:console:SetConsoleCtrlHandler (0x77c331db,1) - no error checking
or testing yet
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
for running a python program, do not forget the -- for separating the
Wine parameters and the Python parameters :
/usr/bin/wine /var/lib/wine/Python23/python.exe -- foobar.py
Installation of
the McMillan's Python Installer
Installation
Decompress the installer to a sub-directory of the root directory of
your project.
It does not work if the installer is on
another disk (wine configuration) or in a parent folder.
Configuration
According to the documentation:
python Configure.py
We get:
fixme:console:SetConsoleCtrlHandler (0x77c331db,1) - no error
checking
or testing yet
fixme:console:SetConsoleCtrlHandler (0x1e081940,1) - no error checking
or testing yet
I: computing EXE_dependencies
err:module:import_dll No implementation for
ADVAPI32.dll.GetEffectiveRightsFromAclW imported from
L"C:\\windows\\system\\pywintypes23.dll", setting to 0xdeadbeef
err:module:import_dll No implementation for
ADVAPI32.dll.GetAuditedPermissionsFromAclW imported from
L"C:\\windows\\system\\pywintypes23.dll", setting to 0xdeadbeef
I: Finding TCL/TK...
I: found TCL/TK version 8.4
I: testing for Zlib...
I: ... Zlib available
I: Testing for ability to set icons, version resources...
Configure.py:113: DeprecationWarning: Non-ASCII character '\x92' in
file E:\PROJETS\PACK~ZH3\OOOPM\OOOPM\INST~4Z2\versionInfo.py on line
171, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details
import win32api, icon, versionInfo
fixme:resource:BeginUpdateResourceA ("H:\\me_test_exe.tmp",0): stub
I: ... resource update unavailable - win32api.BeginUpdateResource failed
I: Testing for Unicode support...
I: ... Unicode available
I: testing for UPX...
I: ...exception result in testing for UPX
[Errno 2] No such file or directory: 'upx.txt' (2, 'No such file or
directory')
I: computing PYZ dependencies...
We can note several things:
- TCL/TK = OK (not
tested)
- Zlib = OK (not
tested)
- "ability to set icons" = Not
OK We can not include icons into executables, not a big problem
- Unicode = OK (not
tested)
- UPX = Not OK* Even though installed,
upx is not detected. It is always
possible to use
it independently . Note: The installer will be
smaller if you do not
use upx.
Usage
Creation of the spec file :
/usr/bin/wine /var/lib/wine/Python23/python.exe
Installer/Makespec.py monscript.py
A text editor for the spec file will be better than the command
line.
Note:
--onefile does not work
--icon does not work (no icon in the exe)
Create the executable with :
/usr/bin/wine /var/lib/wine/Python23/python.exe
Installer/Build.py monscript.spec
Inno Setup
Installation
Install inno with wine. I could use inno with my iss file while placing
inno in a subdirectory of the root directory of the project.
Compilation
To compile without using the GUI use :
wine Inno/ISCC.exe -- setup.iss
a file setup.exe is created in the Output/ directory.
I have not yet been able to run an exe created with McMillan's Python
Installer from GNU/Linux. At this time, Windows is necessary for
testing.
Conclusion
I hope that this "documentation" (taken notes) will be useful to
somebody one day.
License
GPL
Authors
Florent Manens
Translated to
English by Stefaan
Verscheure
and Brian van den Broek
Changelog
jui 19 2004:
* translated to English thanks to the help of
Stefaan Verscheure and Brian
van den Broek
* corrected sentence with no sens
jui 18 2004:
* initial revision