build a binary for Windows on Linux, Solaris or Mac OSX?

S

Skip Montanaro

I'd like to package up my typing watcher script in a bundled form (no
separate Python install required) for use on Windows. (Un)fortunately, I
don't have access to a Windows computer. Do any of the packaging tools
(py2exe, MacMillan's Installer, etc) allow cross-platform bundling?

Failing that, can I coax someone into building such a beast for me so I can
include it on http://sourceforge.net/projects/watch/?

Thanks,

Skip
 
C

Christopher T King

I'd like to package up my typing watcher script in a bundled form (no
separate Python install required) for use on Windows. (Un)fortunately, I
don't have access to a Windows computer. Do any of the packaging tools
(py2exe, MacMillan's Installer, etc) allow cross-platform bundling?

I've gotten py2exe to work under Wine. It takes a little bit of work,
though, mostly downloading real Windows DLLs (if you don't have copies
lying around). The process is more or less like this:

1) Install Win32 Python under Wine. (Good for cross-platform testing,
too.)

2) Install py2exe under Win32 Python. Run your setup script using Win32
Python.

3) Point Wine to a real copy of imagehlp.dll -- functions needed by py2exe
are stubs in the Wine version.

4) py2exe should now run, but will complain about not being able to find a
DLL. Find the DLL, and dump in in your Wine system directory. If you can't
find the DLL, use the dll_exclude option (not sure what the actual command
line arg is) to tell py2exe to skip it.

5) Repeat step 4 until py2exe doesn't complain.

6) If all goes well, you should have a happy Win32 binary waiting for you.

Note: I've only tested the resulting binary under Wine; I'm not sure if it
actually works in Windows or not! ;)
 
T

Thomas Heller

Skip Montanaro said:
I'd like to package up my typing watcher script in a bundled form (no
separate Python install required) for use on Windows. (Un)fortunately, I
don't have access to a Windows computer. Do any of the packaging tools
(py2exe, MacMillan's Installer, etc) allow cross-platform bundling?

Failing that, can I coax someone into building such a beast for me so
I can include it on http://sourceforge.net/projects/watch/?

I could do it, although it seems a little work is stil required to port
watch to Windows:

C:\watch-1.1>\python23\Scripts\watch.py
Traceback (most recent call last):
File "C:\python23\Scripts\watch.py", line 667, in ?
main(sys.argv[1:])
File "C:\python23\Scripts\watch.py", line 611, in main
server=server, port=port)
File "C:\python23\Scripts\watch.py", line 235, in __init__
self.output = open("/dev/null", "w")
IOError: [Errno 2] No such file or directory: '/dev/null'
c:\python23\scripts\watch.py(235)__init__()
-> self.output = open("/dev/null", "w")
(Pdb)

Thomas
 
S

Skip Montanaro

Thomas> I could do it, although it seems a little work is stil required to port
Thomas> watch to Windows:
...
Thomas> self.output = open("/dev/null", "w")
Thomas> IOError: [Errno 2] No such file or directory: '/dev/null'
That's odd. I've run this lots on Windows in my previous job, and not
always in debug mode. I'll fix that. Is sys.stderr going to be broken on
Windows? That is, should I use something other than sys.stderr for debug
output?

Thx,

Skip
 
C

Christopher T King

Thomas> I could do it, although it seems a little work is stil required to port
Thomas> watch to Windows:
...
Thomas> self.output = open("/dev/null", "w")
Thomas> IOError: [Errno 2] No such file or directory: '/dev/null'
That's odd. I've run this lots on Windows in my previous job, and not
always in debug mode. I'll fix that. Is sys.stderr going to be broken on
Windows? That is, should I use something other than sys.stderr for debug
output?

Perhaps you're using a Cygwin- or MinGW-compiled version of Python? These
will simulate /dev/null, but MSVC- or what-have-you compiled versions will
not (ActiveState and I think the vanilla distribution).

Whether or not sys.stderr "works" (i.e. sends output to a descriptor
seperate from sys.stdout) is likely also dependant on the C library used,
but it somehow gets output to the screen in the ActiveState distribution.
 
T

Thomas Heller

Skip Montanaro said:
Thomas> I could do it, although it seems a little work is stil required to port
Thomas> watch to Windows:
...
Thomas> self.output = open("/dev/null", "w")
Thomas> IOError: [Errno 2] No such file or directory: '/dev/null'
That's odd. I've run this lots on Windows in my previous job, and not
always in debug mode. I'll fix that. Is sys.stderr going to be broken on
Windows? That is, should I use something other than sys.stderr for debug
output?

Did you use cygwin?

On Windows, sys.stderr works, and is usually connected to a console
window. But "/dev/null" doesn't exist. You could spell it "NUL", or
provide a Python implementation of a "bit sink".

Next problem is that os.spawnvp() doesn't exist on Windows:

c:\>\python23\Scripts\watch.py --debug
Traceback (most recent call last):
File "c:\python23\Scripts\watch.py", line 668, in ?
main(sys.argv[1:])
File "c:\python23\Scripts\watch.py", line 612, in main
server=server, port=port)
File "c:\python23\Scripts\watch.py", line 326, in __init__
self.setup_server(server, port)
File "c:\python23\Scripts\watch.py", line 356, in setup_server
pid = os.spawnvp(os.P_NOWAIT, cmd, args)
AttributeError: 'module' object has no attribute 'spawnvp'
c:\python23\scripts\watch.py(356)setup_server()
-> pid = os.spawnvp(os.P_NOWAIT, cmd, args)
(Pdb)

Thomas
 
G

Grant Edwards

I've gotten py2exe to work under Wine. It takes a little bit of work,
though, mostly downloading real Windows DLLs (if you don't have copies
lying around).

I use Win4Lin to run WinMe under Linux. py2exe and inno setup
both work fine on WinMe under Win4Lin.
 
S

Skip Montanaro

Thomas> Did you use cygwin?

I have in the past, but I can't recall if when I used watch on Windows I was
running with the binary distro or a cygwin-compiled Python.

Thomas> On Windows, sys.stderr works, and is usually connected to a
Thomas> console window. But "/dev/null" doesn't exist. You could spell
Thomas> it "NUL", or provide a Python implementation of a "bit sink".

This is what I checked in.

Thomas> Next problem is that os.spawnvp() doesn't exist on Windows:

*sigh* I thought the spawn* routines originated in Windows... I'll look
into this.

Thx,

Skip
 
S

Skip Montanaro

Thomas> Next problem is that os.spawnvp() doesn't exist on Windows:

I've fixed that (spawnvp->spawnl). (I had never tried starting up the
watch-server on Windows. For my own needs I always started watch up on my
Mac first, which ran the server, then on Windows, which connected to it.)
Peter Hansen offered to run py2exe for me. Unless he and I both get stuck
we'll leave you to more important things, like the next release of
py2exe. ;-)

Thanks,

Skip
 
F

Florent Manens

Skip said:
I'd like to package up my typing watcher script in a bundled form (no
separate Python install required) for use on Windows. (Un)fortunately, I
don't have access to a Windows computer. Do any of the packaging tools
(py2exe, MacMillan's Installer, etc) allow cross-platform bundling?

I just writed a doc to do that with MacMillan's Installer... it's in french
here :
http://grossac.org/python.html
I only need shel32.dll from windows dlls

One day, i'll translate to english :)
 

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,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top