[Distutils] Add multiple frozen modules

James C. Ahlstrom jim@interet.com
Wed, 30 Jun 1999 10:21:06 -0400


I have been working with the Tools/freeze/freeze.py etc. utilities
in order to build a Python binary with part of the Python library
built in.  I found out you-all have been working on this.  But AFAIK
we are not there yet.  I see that using freeze.py will create a
binary Python with the libs included in the frozen module.  But:

1) The "script" argument to freeze.py is not optional.  Some module
   is always frozen with the name __main__ and so it is always
   executed when Python starts up.  This makes it impossible to
   create a python15.dll (or python15.so) which is general-purpose.
   That is, a shared binary Python with libraries but not a main
   program built in.  Since the Python interpreter and libs must
   use exactly the same version, it is useful to link them together.

2) There is only one frozen module allowed, so no further use of
   frozen modules is possible.  The frozen feature has been
   devoted to the Python libraries.  This makes it impossible to
   make a python15.dll which can be used with a variety of
   python.exe programs with further frozen modules.
   Unix translation:  A python15.so shared library for use with
   further python main programs containing frozen modules.

I have code which solves both problems.  But perhaps I have not
understood Tools/freeze, and there is already a way to do this?

I see there is a function PyImport_ExtendInittab() in import.c
which adds entries to the table of built-in modules, which is
sort of analogous to (2), but that this function is unused.  (My
code uses a different method.)

Please let me know what you think.  Is this useful enough to be
added to Python?  Or is it already there?

Jim Ahlstrom