[qmtest] [b,s]dist creation

Nathaniel Smith njs at pobox.com
Sat Sep 13 01:34:20 UTC 2003


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.

-- Nathaniel

-- 
"On arrival in my ward I was immediately served with lunch. `This is
what you ordered yesterday.' I pointed out that I had just arrived,
only to be told: `This is what your bed ordered.'"
  -- Letter to the Editor, The Times, September 2000



More information about the qmtest mailing list