Mailing List Archive

Simple module installation
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.

The only thing that makes it extremely mildly painful is that it requires
setting a few environment variables:

FNORB_HOME
PYTHONPATH
PATH

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.

FNORB_HOME seems to only exist in order to implement a feature that Andrew
Kuchling has asked for before. Fnorb has a bunch of tiny scripts that do
this:

@python.exe "%FNORB_HOME%"\Fnorb\script\fnendian %1 %2 %3 %4 %5 %6 %7 %8
%9

If Python could find scripts in its PYTHONPATH then this wouldn't be
necessary. So this is a feature request for that feature. I can implement
it if people agree it would be a good idea:

python -r script: run the script named "script.py" in the PYTHONPATH

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

--
Paul Prescod - ISOGEN Consulting Engineer speaking for only himself
http://itrc.uwaterloo.ca/~papresco

"In spite of everything I still believe that people are basically
good at heart." - Anne Frank
Simple module installation [ In reply to ]
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/ :
---------------------------------------------------------
Simple module installation [ In reply to ]
On 16 Apr 99, Ce'Nedra took her magical amulet and heard Paul Prescod say:

>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.
>
>The only thing that makes it extremely mildly painful is that it requires
>setting a few environment variables:
>
>FNORB_HOME
>PYTHONPATH
>PATH
>
>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.

Yes, please don't use the Windows registry! Using it doesn't actually
*reduce* the "pain". (I never quite understood what good it was, anyway,
aside of a feeble attempt at making copy protection more fool proof.)

The Python-based registry as you describe it sounds neat. It sounds like it
would be fairly easy to register and unregister programs and things, without
messing up your whole system, unlike a certain other registry.

>If Python could find scripts in its PYTHONPATH then this wouldn't be
>necessary. So this is a feature request for that feature. I can implement
>it if people agree it would be a good idea:
>
>python -r script: run the script named "script.py" in the PYTHONPATH

This looks good too.

>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

Hmm... but how do you *un*register?

Nice ideas,

+ Hans Nowak (Zephyr Falcon)
+ Homepage (under construction): http://www.cuci.nl/~hnowak/
+ You call me a masterless man. You are wrong. I am my own master.
+ May 60 trolls cut your chicken feathers out with your bad self!
Simple module installation [ In reply to ]
-->"Marc-Andre" == M -A Lemburg <mal@lemburg.com> writes:
Marc-Andre> Paul Prescod wrote:

>> The PYTHONPATH and PATH would be unneccessary if Fnorb used
>> the Windows registry.

in previous versions, Fnorb used the windows registry. however, this
has now been removed because it caused endless problems: users would
reinstall python, and all their fnorb code would break (since it used
the previous installation's paths). so then they had to reinstall
fnorb, even though nothing had changed, and then they had two fnorb
installations, and ...

so now you have a couple of environment variables, and a batch file
which sets them to the "guessed" values. when you python installation
changes, you can edit the batch file (easier and safer than editing
the 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.

we're hoping that the distutil-sig will come up with a nice solution
;-)



d