Packaging packages?

Gordon McMillan gmcm at hypernet.com
Thu Dec 9 11:54:57 EST 1999


Jeffrey Kunce writes:

> Is there a way to collect all the python modules in a package
> into one file? 
> 
> I've been a big fan of Fredrik's "Squeeze" and Gordon's "Win32
> Installer", but as far as I know, they pakage an entire
> application into one file. 

Look more closely. Just create a config file with a PYZ section 
pointing to your package. Run Builder.py on it. Make sure 
imputil.py and archive_rt.py are available outside the archive. 
Then the magic incantation:

imputil.FuncImporter(
 archive_rt.ZlibArchive("mypyz.pyz",0).get_code).install()

will make everything in your package available to normal 
"import" statements.


- Gordon




More information about the Python-list mailing list