From: Avery Pennarun Date: Wed, 3 Mar 2010 04:59:08 +0000 (-0500) Subject: 'make stupid' stopped working when I moved subcommands into their own dir. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=5bac5e5d943b3094aaaea65dfa5a50d8a16d0c6c;p=packages%2Fb%2Fbup.git 'make stupid' stopped working when I moved subcommands into their own dir. Remote server mode tries to add the directory of argv[0] (the currently-running program) to the PATH on the remote server, just in case bup isn't installed in the PATH there, so that it can then run 'bup server'. However, now that bup-save is in a different place than bup, argv[0] is the wrong place to look. Instead, have the bup executable export an environment variable containing its location, and client.py can use that instead of argv[0]. Slightly gross, but it works. --- diff --git a/lib/bup/client.py b/lib/bup/client.py index cbd007a..7b3e7c3 100644 --- a/lib/bup/client.py +++ b/lib/bup/client.py @@ -14,7 +14,8 @@ class Client: self.p = None self.conn = None rs = remote.split(':', 1) - nicedir = os.path.split(os.path.abspath(sys.argv[0]))[0] + main_exe = os.environ.get('BUP_MAIN_EXE') or sys.argv[0] + nicedir = os.path.split(os.path.abspath(main_exe))[0] nicedir = re.sub(r':', "_", nicedir) if len(rs) == 1: (host, dir) = ('NONE', remote) diff --git a/main.py b/main.py index 2629ea2..34871e2 100755 --- a/main.py +++ b/main.py @@ -10,6 +10,7 @@ libpath = os.path.join(exepath, 'lib') cmdpath = os.path.join(exepath, 'cmd') sys.path[:0] = [libpath] os.environ['PYTHONPATH'] = libpath + ':' + os.environ.get('PYTHONPATH', '') +os.environ['BUP_MAIN_EXE'] = os.path.abspath(exe) from bup.helpers import *