[Distutils] Installing applications

James C. Ahlstrom jim@interet.com
Fri, 08 Oct 1999 15:35:48 -0400


> "Paul F. Dubois" wrote:
> 
> I know that I don't read a lot of what goes on in our manuals,
> newsgroups and sigs, so if this problem has a known answer I would
> appreciate a pointer.
> 
> Distutils solves the "install a package" problem. Now, how do we solve
> the "make it an application" problem?

In general, this is an unsolved problem.  We have it too since
we are shipping a major Python app to customers, as well as using
this app and a few others internally.  See:
  ftp.interet.com/pub/bootmodule.html
  ftp.interet.com/pub/pylib.html

> #!/usr/bin/env python
> import Pyfort.driver
> import sys
> Pyfort.driver.run(sys.argv[1:])
> The first problem for me is that this chooses the python on the path,
> not necessarily the python into which I have installed this package.
> ...
> But if I hardwire the path into the first line, I can't tar
> it up and send it to somebody somewhere else. (Like to my customers,
> for example).

As a Windows dweeb, it took me a while to understand this.  It
looks like you have compiled the various Python versions with
a different $prefix, so each carries its own custom
PYTHONPATH.  Otherwise the Python binary used can not affect
which version of Pyfort/driver.py gets imported.  Although
the directory of the Python binary is appended to PYTHONPATH,
these are all bin directories, and the packages are in lib
directories so the modification to PYTHONPATH doesn't matter.

The directory of the Python script is prepended to PYTHONPATH
so specifying a script name almost works.  The problem is that
you put pyfort.py into a bin directory too, so prepending this
to PYTHONPATH does not help get the package from the lib
directory either.

I think if you move pyfort to the lib directory it will work.
But you must still specify which pyfort you want.  If the lib
directory is on PATH, "pyfort" works.  For a different pyfort,
you will need to specify the whole path.

I am not sure I have understood this correctly, so please
complain if I did not.

Jim Ahlstrom