[qmtest] running qmtest on bash in cygwin...
Zack Weinberg
zack at codesourcery.com
Sun Aug 24 02:02:03 UTC 2003
Mark Mitchell <mark at codesourcery.com> writes:
> On Sat, 2003-08-23 at 11:11, Zack Weinberg wrote:
>> I normally hate the #! /usr/bin/env python trick, but this seems like
>> exactly the case it was meant to handle - where all that is known is
>> that the python interpreter is somewhere on the user's path. The Unix
>> just-unpack-this-tarball distribution could use that, and the
>> documentation say that you have to put /path/to/qmtest/bin in your
>> PATH.
>
> We actually should not require that. Some people don't know how to do
> that, and some people will forget and get the wrong PATH.
>
> Now, if we can fancy up the /usr/bin/env trick to get us the Python next
> to QMTest (if it exists), that would be fine. We should also preserve
> the QM_PYTHON/QM_HOME bits from the current shell script.
>
> I bet thiis is possible if we get clever enough, somehow.
It's not clear to me just how much cleverness we need. On the Unix
side of things, there are three cases:
* a good python is installed in a well-known location.
#! /usr/bin/python will work.
* a good python is installed in a strange location, but it's on the path.
#! /usr/bin/env python will work.
* there is no good python interpreter on the system other than the one
that got unpacked from the tarball.
A small shell script to invoke the python interpreter is necessary.
It may be possible to do very clever things so that the shell script
is embedded in qmtest.py -- like this:
#! /bin/sh
""":" # null command to sh, beginning of docstring to python
case "$0" in
*/*)
pydir=`echo "$0" | sed 's|/[^/]*$|/|'` ;;
*)
pydir=./
esac
exec "$pydir"python "$0" "$@" # shell never sees past this line
""" # end docstring
python code here
but frankly I would rather that the just-unpack-the-tarball distro
continue to contain separate "qmtest" shell wrapper and "qmtest.py"
real program. The above hasn't a prayer of working on Windows, and is
liable to break in other places too.
zw
More information about the qmtest
mailing list