[Distutils] Re: Add multiple frozen modules

James C. Ahlstrom jim@interet.com
Mon, 16 Aug 1999 12:25:11 -0400

"James C. Ahlstrom" wrote:

> I will throw out my design and re-start using your software.  But
> since I have tried this before I know it won't work.  But maybe I
> can come up with a more minimal set of changes.

OK, I have a new design with a minimal set of changes.  I am
currently testing it by using it.  All code is in
ftp://ftp.interet.com/pylib.zip and pylib.tar (identical).

The only core changes are to getpathp.c and sysmodule.c in
order to add sys.dllfullpath so that the name of Python15.dll
(the interpreter shared library) is available.  This is a
trivial change.

The magic happens in sitecustomize.py.  It installs a custom
importer which uses Greg's imputil.py.  The custom importer
searches for the single file interet.pyl in the directory of
the main executable.  Obviously this is a custom name only
usable by us, but that is what sitecustomize is for.
Sitecustomize.py is based on Greg's easygen.py, but adds a few
important features.  It adds a global "Importer" as the
SimpleArchive instance, and the methods enable() to turn the
importer on and off, __repr__() to show the importer state, and
_get_path() to get the importer name.

To boot all this, I have installed exceptions.pyc, site.pyc
and sitecustomize.pyc as frozen modules.  Actually I froze
a dozen other library files too, since this is easier than
putting them in interet.pyl.

The above works fine, and is an improvement over just using
frozen modules.  Our program files change frequently, and it
is time consuming to convert the *.pyc to C strings and
compile them.

However, this is insufficient to enable a Python programmer
to easily ship Python programs.  The remaining problems are:

1) Freezing sitecustomize.py etc. requires a compiler and not
all people have one.

2) I am using Greg's PYL file format which lacks pyc headers,
file paths, flag bits, seeks from the end (for append ability),
and multiple sections.  We need a standard PYL file format.

3) The executable main program can not be in the PYL file.  We
need the ability to run __main__() as the main if it is present
(like freeze does now), and the ability to run any main from the
PYL file.

4) On windows each Python program should have its own icon, so
we need a way to include icons.

Comments?  If there is agreement on what to do, I volunteer to
write the code.

Jim Ahlstrom