[Python-Dev] Re: hook for standalone executable

Thomas Heller theller at python.net
Thu Aug 14 20:29:02 EDT 2003


Thomas Heller <theller at python.net> writes:

> There has been a discussion on comp.lang.python about a cross-platform
> py2exe-like tool:
> <http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&safe=off&threadm=ptji8wgr.fsf%40python.net>
>
> The basic idea is, now that the zipimport feature is in place, to make
> it easy to convert the Python interpreter itself into a standalone
> executable by a simple operation (which can well be platform dependend,
> but on some platforms, at least, a zipfile can be appended to a copy of
> the interpreter executable itself).
>
> Alex Martelli and Oren Tirosh also came up with ideas how to do this,
> and it seems a hook in Py_Main() would be able to do the trick.
>
> This hook could be triggered by examining the filename of the executable
> itself. If the basename starts (case-insensitive) with the
> characters 'python', everything continues as it is now.

Here's another idea, based on the ancient history of Visual Smalltalk:
Let the hook be triggered by the fact that in the same directory as the
executable is another file present having the same name as the
executable, with a certain extension appended (VS used '.bnd').

This file could contain information about how to run the exe: the values
for the Py_Optimize and other flags, entries to use for sys.path, a
pointer to or the code itself for the script to run.  It was a very
flexible mechanism for Visual Smalltalk, then. If anyone want further
details how this worked, I can provide them.

Thomas




More information about the Python-Dev mailing list