469,358 Members | 1,626 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

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


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

Jul 18 '05 #1
9 2168
On Tue, 6 Jul 2004, Skip Montanaro wrote:
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! ;)

Jul 18 '05 #2
Skip Montanaro <sk**@pobox.com> writes:
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
Jul 18 '05 #3
Failing that, can I coax someone into building such a beast for me so
I can include it on http://sourceforge.net/projects/watch/?
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' c:\python23\scripts\watch.py(235)__init__()


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
Jul 18 '05 #4
On Tue, 6 Jul 2004, Skip Montanaro wrote:
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'
>> c:\python23\scripts\watch.py(235)__init__()


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.

Jul 18 '05 #5
Skip Montanaro <sk**@pobox.com> writes:
>> Failing that, can I coax someone into building such a beast for me so
>> I can include it on http://sourceforge.net/projects/watch/?
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' >> c:\python23\scripts\watch.py(235)__init__()

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
Jul 18 '05 #6
On 2004-07-06, Christopher T King <sq******@WPI.EDU> wrote:
On Tue, 6 Jul 2004, Skip Montanaro wrote:
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).


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

--
Grant Edwards grante Yow! He is the
at MELBA-BEING... the ANGEL
visi.com CAKE... XEROX him... XEROX
him --
Jul 18 '05 #7
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
Jul 18 '05 #8

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
Jul 18 '05 #9
Skip Montanaro wrote:

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 :)

--
Florent Manens
http://www.starxpert.fr
Jul 18 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Tempo | last post: by
5 posts views Thread by eranshuman | last post: by
10 posts views Thread by rory | last post: by
16 posts views Thread by Erwin Moller | last post: by
4 posts views Thread by M.-A. Lemburg | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.