[Python-Dev] Re: Path hacking

Gordon McMillan gmcm@hypernet.com
Thu, 16 Sep 1999 13:38:03 -0400


[Greg, replying to Guido's confusion on Jim's interest in 
site.py and exceptions.py]

> When you jam every file into a module archive, you still have to
> leave these two "outside" so that Python can find them when
> starting up. 

In the soon-to-be-published beta version of my installer, I've 
got that down to exceptions.py.

Background: my (Win32) installer has, as a stated goal, the 
ability to create quasi-frozen Python apps which won't interfere 
with (or be influenced by) existing Python installations (if any). 
And it doesn't require the programmer/user to have a compiler.

Thanks to patches given me by Thomas Heller, my 
python.exe replacement is now a (minimal) embedding app, 
and I do the same things that Greg does in site.py directly 
from C code, (and turn off the SiteFlag, too).

I believe that if I freeze in exceptions.py and tweak the 
resource in python15.dll (which is just the stock python15.dll), 
I can have a completely safe executable.

I think the same techniques can be applied on *nix, (although 
I'm pretty sure programmer/users won't be able to get away 
without a compiler).

This gives me a strong interest in import hooks for two distinct 
reasons:
 - I rely completely on Greg's imputil to make this work.
 - I rely on freeze's modulefinder to help build these things. 

Bizarre import hooks in a normal Python installation will fool 
modulefinder. Take a look at what Pmw does (fortunately, 
Pmw comes with it's own packager). So I'd like to see import 
hooks follow some sort of pattern that can be followed by a 
tool like modulefinder.

I also want the hooks. Right now I use imputil with archives, 
but wouldn't it be cool if you could add another imputil importer 
that checks for more recent versions at some home site on 
the web and automatically updates the installation?

Summary: I'm very interested in seeing import and import 
hooks get rationalized, and I think Greg's stuff goes a long, 
long way towards that goal.

- Gordon