[qmtest] [b,s]dist creation
Stefan Seefeld
seefeld at sympatico.ca
Sat Sep 13 16:12:39 UTC 2003
Nathaniel Smith wrote:
> On Fri, Sep 12, 2003 at 05:46:15PM -0700, Mark Mitchell wrote:
>
>>OK, so that means that the idea of writing out QM_HOME in install_data
>>doesn't work. We have to be able to autodetect QM_HOME -- but we wanted
>>to do that anyhow.
>>
>>Now, on UNIX, we (used to) use the logic in the "qmtest" shell script to
>>find QM_HOME. Now that we're invoking "qmtest.py" directly, this might
>>be even easier. Presumably, sys.argv[0] contains the path to qmtest.py
>>(possibly relative to the current directory). So, maybe now is the time
>>to get rid of QM_HOME? Instead, deduce it in qmtest.py, based on
>>sys.argv[0].
>
>
> It may be slightly better to use __file__ rather than sys.argv[0];
> __file__ is a global variable set inside each module to the filename
> containing that module. It does appear to be relative if Python is
> invoked with a relative filename, so an os.normpath is in order before
> any chdir's.
but __file__ tells you only about the module that uses it.
The python module path however may be more or less unrelated to
the path the data files are installed in ('/usr/local/share/' typically
on unix).
I would assume that there is a much stronger relation among the paths
of the qmtest executable and the data files than there is among the qm
modules and the data files. Therefor, if we use '__file__', it should
be that of the qmtest executable, not any module inside the qm package.
Stefan
More information about the qmtest
mailing list