From: Catalin Marinas Date: Tue, 16 Aug 2005 13:47:33 +0000 (+0100) Subject: Fix gitmergeonefile.py to deal with local installation X-Git-Tag: v0.14.3~710 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/7ab9ac47ffab2ff8178fae5212c54c457177bbb3?ds=inline Fix gitmergeonefile.py to deal with local installation After a previous change, this file didn't know where to find the stgit package if it wasn't installed with the default prefix. Signed-off-by: Catalin Marinas --- diff --git a/gitmergeonefile.py b/gitmergeonefile.py index 99a6a7c..fe416bd 100755 --- a/gitmergeonefile.py +++ b/gitmergeonefile.py @@ -20,6 +20,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ import sys, os + +# Try to detect where it is run from and set prefix and the search path. +# It is assumed that the user installed StGIT using the --prefix= option +prefix, bin = os.path.split(sys.path[0]) + +if bin == 'bin' and prefix != sys.prefix: + major, minor = sys.version_info[0:2] + sys.path += [os.path.join(prefix, 'lib', 'python'), + os.path.join(prefix, 'lib', 'python%s.%s' % (major, minor)), + os.path.join(prefix, 'lib', 'python%s.%s' % (major, minor), + 'site-packages')] + from stgit.config import config from stgit.utils import append_string