[Python-Dev] hook for standalone executable
Thomas Heller
theller at python.net
Mon Aug 11 11:22:20 EDT 2003
Jack Jansen <Jack.Jansen at cwi.nl> writes:
> On zaterdag, aug 9, 2003, at 07:34 Europe/Amsterdam, Mark Hammond wrote:
>> * Propose a new executable that some Python platforms can choose to
>> distribute - eg, 'python-package{.exe}'. This is really just
>> identical to
>> python.exe, but with the only 'if doesnt start with 'python'' parts
>> of your
>> proposal.
>
> Even though having the one Python interpreter fill a dual role is a hack
> I still think you should try to go for it, and I say this from
> experience.
>
> MacPython-OS9 has had applets (which is basically what you're after)
> since about 1.3 or 1.4. Initially, applets had a special main
> program. At some point I hacked something up (now that I think about
> it it may not have been me, it may have been Just who did it) so that
> the two main programs were united, and this really made life a lot
> simpler and less error-prone.
>
> On the Mac life was easy, though, because of the resource fork. The main
> program simply started with
> if (there's a 'PYC ' resource named '__main__')
> I'm an applet;
> else
> I'm a normal interpreter;
And, IMO, that's also the way to go on Windows.
> But: now that I'm thinking this whole idea through a little bit: if
> this is all meant for packaging applications, how are you going to
> handle extension modules? These can't be put into zipfiles, or can
> they?
No, they cannot. py2exe currently only has a 'single directory' target -
it creates a directory which must be distributed as whole, containing an
app.exe, python22.dll, and zlib.pyd, _sre.pyd, and maybe other extension
modules. Although the zipfile makes sure that the extensions are loaded
from this directory and not from somewhere else.
That's good enough for me at the moment, although single file
executables would be nicer.
Thomas
More information about the Python-Dev
mailing list