X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/blobdiff_plain/8c737ba4564389ca40f2309e299f37ed1fb79249..c23e93ff42f19ab5b2ff5701bbccbedb15882941:/gitmergeonefile.py?ds=inline diff --git a/gitmergeonefile.py b/gitmergeonefile.py index 99a6a7c..4f79958 100755 --- a/gitmergeonefile.py +++ b/gitmergeonefile.py @@ -20,6 +20,19 @@ 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] + local_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')] + sys.path = local_path + sys.path + from stgit.config import config from stgit.utils import append_string