[Distutils] Re: Add multiple frozen modules

James C. Ahlstrom jim@interet.com
Fri, 23 Jul 1999 12:26:21 -0400


OK, I put my import Python library code on
ftp://ftp.interet.com/pub/pylib.zip and
ftp://ftp.interet.com/pub/pylib.tar.gz.  The contents
are identical.  Uncompress in a temp directory.

Try listing the contents of the library file makepyl.pyl
using "python makepyl.py -t", or make a new one with
"python makepyl.py" but be aware that this OVERWRITES
makepyl.pyl.  You will need to change the config file
makepyl.cfg.

Copy makepyl.pyl to python15.pyl (in the same directory)
to make it active.  Then import string, and enter
"print string" to see that the module comes from python15.pyl.

There are two issues, the library file format and the
C-code changes to import.c.

I published a proposed library file format here on distutils
and it is described in the doc strings.  But I didn't describe
why I didn't use Greg's nor Gordon's format.  Both formats
remove the 8-byte .pyc header.  But import.c validates this
header for .pyc files and it should be retained.  There was no
file source information, but a user will want to print out the
file names in the library.  Greg's format could not be appended
to another file.  Gordon can build the library onto another
file with a program, but can not append the same file to
different programs.  The new format can append the same
library file to any other executable or dll using
    "cat library.pyl >> AnyPythonBinary[|.exe|.so|.dll].
It can also support multiple appends if desired.

The changes to import.c add another PY_LIBRARY import method
(like PY_SOURCE, PY_COMPILED, etc.) and is programmed in a
parallel fashion.  The code may be a bit rough but it is
sufficient to get an idea.

I am going away on vacation tomorrow, so I really hope all
this works OK.  I will catch up on all your comments when I
get back.

Jim Ahlstrom