[issue1075] Use shell script to set PYTHONPATH

Kannan Goundan mercurial-bugs at selenic.com
Fri Apr 4 04:28:29 UTC 2008


New submission from Kannan Goundan <cakoose at yahoo.com>:

I installed Mercurial 1.0 with a non-default PREFIX and got an error when trying
to run it.  Luckily, a web search took me to the Mercurial wiki, which told me
that I needed to set PYTHONPATH.  It would be nice if this wasn't necessary.

I didn't want to modify the PYTHONPATH environment variable globally, so I added
the following to the top of the "$PREFIX/bin/hg" launcher script:

   import sys
   prefix = "/usr/local/stow/Mercurial-1.0"
   sys.path.append(prefix + "/lib/python2.5/site-packages")

(This might not be the best solution, but it worked for me.)

There is a chance that we're modifying sys.path unnecessarily (since most people
will probably install with the default PREFIX).  One solution is for the extra
code to be inserted into the script by "make install" only if the PREFIX isn't
the default.  Another solution is to have the Python code not do the ".append"
if the script's location is in the default PREFIX.

----------
messages: 5816
nosy: cakoose
priority: bug
status: unread
title: Use shell script to set PYTHONPATH

____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1075>
____________________________________________________




More information about the Mercurial-devel mailing list