]> arthur.barton.de Git - bup.git/commitdiff
'make stupid' stopped working when I moved subcommands into their own dir.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 3 Mar 2010 04:59:08 +0000 (23:59 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 3 Mar 2010 04:59:08 +0000 (23:59 -0500)
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.

lib/bup/client.py
main.py

index cbd007a275dca2532eacdee608c34a3153407d55..7b3e7c35700dbc914f5301c35e872f42e43082a1 100644 (file)
@@ -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 2629ea283be046610565d7f02970a57fd9e18e3e..34871e20ef8e71679037a106875ea0374ffd8aec 100755 (executable)
--- 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 *