70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
From: mal at lemburg.com (M.-A. Lemburg)
|
|
Date: Fri, 16 Apr 1999 12:53:32 GMT
|
|
Subject: Simple module installation
|
|
References: <37170674.F77233A6@prescod.net>
|
|
Message-ID: <371732CC.201012AF@lemburg.com>
|
|
Content-Length: 2414
|
|
X-UID: 1184
|
|
|
|
Paul Prescod wrote:
|
|
>
|
|
> I was just installing Fnorb and it was as painless an installation as a
|
|
> sane person could ask for but I got to thinking...couldn't this be less
|
|
> painless? The reason I ask is because I'm thinking of distributing code
|
|
> that depends on code that depends on code that depends on Fnorb and I need
|
|
> each installation part to be as simple as possible. So this isn't meant to
|
|
> pick on Fnorb in particular but to use it as a random sample package with
|
|
> binary and Python parts.
|
|
|
|
Maybe the distutils package that is being developped by the distutils
|
|
sig could help.
|
|
|
|
> ...
|
|
> The PYTHONPATH and PATH would be unneccessary if Fnorb used the Windows
|
|
> registry. Even so, I think that a Python-managed, portable, text
|
|
> file-based registry (like JPython's) would be better than depending upon
|
|
> the over-centralized Windows registry.
|
|
> ...
|
|
> If we put my idea for a Python-managed registry together with the "-r"
|
|
> idea then Fnorb could register itself on Windows or Unix like this:
|
|
>
|
|
> python -r register Fnorb /path/to/fnorb
|
|
|
|
You should take the idea even a bit further and have Python use
|
|
the registry per default for all lookups and only have it revert
|
|
to PYTHONPATH in case it doesn't find anything appropriate.
|
|
|
|
A while back I wrote a patch called fastpath that made Python
|
|
use a callback (sys.fastback I think it was named) in the import
|
|
loader:
|
|
|
|
A little Python function read a marshalled version of
|
|
a module lookup table the first time it was called and then
|
|
tried to find the module in that table. If it did find something,
|
|
the module loader would stop the search and use the returned
|
|
path to the module, otherwise it would do its normal actions.
|
|
|
|
The nice thing about this callback is that you can modify the
|
|
module locator's action without having to modify the Python
|
|
source code (well, apart from the few lines needed to add the
|
|
callback).
|
|
|
|
BTW, using the above fastpath trick reduces IO overhead on
|
|
startup quite a bit: from a few 100 stat()s to a few 10s for
|
|
an average script.
|
|
|
|
The (old) code is still available for anyone to play with:
|
|
|
|
http://starship.skyport.net/~lemburg/fastpath.zip
|
|
|
|
--
|
|
Marc-Andre Lemburg Y2000: 259 days left
|
|
---------------------------------------------------------------------
|
|
: Python Pages >>> http://starship.skyport.net/~lemburg/ :
|
|
---------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|