X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/blobdiff_plain/41a6d8591d5962dbfe8e372fff10c60e06718083..4f5a8c722ee88f9be891297353ae26f676bb0213:/stg diff --git a/stg b/stg index ca9307e..def843c 100755 --- a/stg +++ b/stg @@ -20,6 +20,24 @@ along with this program; if not, write to the Free Software 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: + sys.prefix = prefix + sys.exec_prefix = 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.main import main -main() +if __name__ == '__main__': + main()