]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: respect the PYTHON environment variable for dev mode. 3103/head
authorDavid Anderson <dave@natulte.net>
Sun, 7 Dec 2014 05:14:27 +0000 (21:14 -0800)
committerDavid Anderson <dave@natulte.net>
Sun, 7 Dec 2014 10:02:05 +0000 (02:02 -0800)
On OSes where `python` is python3, dev mode's re-exec makes the
ceph tool fail. The standard way to fix this is by exporting
the PYTHON envvar pointing to the python2 interpreter.

Signed-off-by: Dave Anderson <dave@natulte.net>
src/ceph.in

index d133557669c6dd2d776cdbcf5c51c5a1ace89b16..654148fba391ff2e094f4bfe54d6cfccc32f8e0f 100755 (executable)
@@ -40,16 +40,17 @@ if MYDIR.endswith('src') and \
     else:
         lib_path_var = "LD_LIBRARY_PATH"
 
+    py_binary = os.environ.get("PYTHON", "python")
     MYLIBPATH = os.path.join(MYDIR, '.libs')
     if lib_path_var in os.environ:
         if MYLIBPATH not in os.environ[lib_path_var]:
             os.environ[lib_path_var] += ':' + MYLIBPATH
             print >> sys.stderr, DEVMODEMSG
-            os.execvp('python', ['python'] + sys.argv)
+            os.execvp(py_binary, ['python'] + sys.argv)
     else:
         os.environ[lib_path_var] = MYLIBPATH
         print >> sys.stderr, DEVMODEMSG
-        os.execvp('python', ['python'] + sys.argv)
+        os.execvp(py_binary, ['python'] + sys.argv)
     sys.path.insert(0, os.path.join(MYDIR, 'pybind'))
     if os.environ.has_key('PATH') and MYDIR not in os.environ['PATH']:
         os.environ['PATH'] += ':' + MYDIR