[Distutils] Installing applications

Paul F. Dubois dubois1@llnl.gov
Fri, 8 Oct 1999 08:04:54 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01BF1163.CE218140
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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?

Here is what I mean. I have a Python package with a driver routine =
inside. I need some way of starting up Python with that script as the =
input. So I end up writing something like this example from the Pyfort =
package, file pyfort:

#!/usr/bin/env python=20
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. In =
our environment we have multiple Pythons since we version our software =
package. So if someone runs "pyfort" all is well, but if they do=20

/usr/local/cdat/experimental/bin/pyfort <args>

but their path finds /usr/local/cdat/public/bin/python, the import =
Pyfort.driver gets the "public" rather than the "experimental" version. =
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).

Python has a -c option, but I can't expect the users to cram the above =
into a -c line.=20

The second problem is that I had to write (and more seriously, install) =
this little file in the first place. Seems dumb when all I want is the =
effect of=20
python =
/usr/local/cdat/experimental/lib/python1.5/site-packages/Pyfort/driver.py=
 <args>

We have another app where essentially we want to run python, import some =
stuff, and go to the prompt.


------=_NextPart_000_0007_01BF1163.CE218140
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>I know that I don't read a lot of what goes on in =
our manuals,=20
newsgroups and sigs, so if this problem has a known answer I would =
appreciate a=20
pointer.</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Distutils solves the "install a package" problem. =
Now, how do=20
we solve the "make it an application" problem?</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Here is what I mean. I have a Python package with a =
driver=20
routine inside. I need some way of starting up Python with that script =
as the=20
input. So I end up writing something like this example from the Pyfort =
package,=20
file pyfort:</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>#!/usr/bin/env python <BR>import =
Pyfort.driver<BR>import=20
sys<BR>Pyfort.driver.run(sys.argv[1:])<BR></FONT></DIV>
<DIV><FONT size=3D2>The first problem for me is that this chooses the =
python on=20
the path, not necessarily the python into which I have installed this =
package.=20
In our environment we have multiple Pythons since we version our =
software=20
package. So if someone runs "pyfort" all is well, but if they do =
</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>/usr/local/cdat/experimental/bin/pyfort=20
&lt;args&gt;</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>but their path finds =
/usr/local/cdat/public/bin/python, the=20
import Pyfort.driver gets the "public" rather than the "experimental" =
version.=20
But if I hardwire the path into the first line, I can't tar it up and =
send it to=20
somebody somewhere else. (Like to my customers, for =
example).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>Python has a -c option, but I can't expect the users =
to cram=20
the above into a -c line. </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>The second problem is that I had to write (and more =
seriously,=20
install) this little file in the first place. Seems dumb when all I want =
is the=20
effect of </FONT></DIV>
<DIV><FONT size=3D2>python=20
/usr/local/cdat/experimental/lib/python1.5/site-packages/Pyfort/driver.py=
=20
&lt;args&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>We have another app where essentially we want to run =
python,=20
import some stuff, and go to the prompt.</FONT></DIV>
<DIV>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0007_01BF1163.CE218140--