views:

212

answers:

2

I have a Python script that I'd like to compile into a Windows executable. Now, py2exe works fine from Windows, but I'd like to be able to run this from Linux. I do have Windows on my development machine, but Linux is my primary dev platform and I'm getting kind of sick of rebooting into Windows just to create the .exe. Any ideas?

PS: I am aware that py2exe doesn't exactly compile the python file as much as package your script with the Python interpreter. But either way, the result is that you don't need Python installed to run the script.

+1  A: 

You could run Windows in VirtualBox in order to run py2exe. VBox offers a powerful command-line client for automating tasks, so it something that you could likely integrate into your development process with ease.

Adam Crossland
That would technically require me to have a second Windows licence, something I would rather not get involved in. But +1 anyway.
Chinmay Kanchi
+3  A: 

Did you look at PyInstaller?

It seems that 1.4 support cross-compilation

http://www.pyinstaller.org/browser/tags/1.4/doc/CHANGES.txt says:

Add support for cross-compilation: PyInstaller is now able to build Windows executables when running under Linux. See documentation for more details.

I didn't try it myself.

I hope it helps

luc
Yes, that works: http://groups.google.com/group/pyinstaller/browse_thread/thread/2884993f9b070968
stephan
Aargh! This _should_ work, but the bloody thing only supports python 2.6 on *NIXes and my script requires python 2.6 to work... Looks like more effort than it's worth... I guess I just need to plan my build cycles so I only reboot into Windows a minimum number of times...
Chinmay Kanchi
@Chinmay: there was a pywin26 branch of pyinstaller that has been merged into the trunk. So, if you are the daring kind of person, you can check out the trunk using `svn co http://svn.pyinstaller.org/trunk pyinstaller-trunk` and it *should* work with 2.6 on Windows.
stephan
I will give this a try. The immediate problem has been solved by rebooting into Windows, but this _is_ likely to crop up fairly often now that I've moved almost completely over to Linux. Thanks for the heads-up!
Chinmay Kanchi