diff options
author | Dan Mick <dan.mick@inktank.com> | 2013-08-27 11:42:58 -0700 |
---|---|---|
committer | Gary Lowell <gary.lowell@inktank.com> | 2013-10-09 10:04:50 -0700 |
commit | 987c0dc9fe0fd6ce3753567b6e877dc894b99b5a (patch) | |
tree | 72381415924c2b4f4fb763d8be987f09c0d03841 | |
parent | 66e78bdb5b70645cae8cadef68954818e42eb31d (diff) | |
download | ceph-987c0dc9fe0fd6ce3753567b6e877dc894b99b5a.tar.gz |
ceph.in, ceph-rest-api: adapt "run from src/" hack to virtualenv
1) change python to the virtualenv version, which means
2) we can avoid setting sys.path directly
Also:
3) remove the "DEVELOPER MODE" message
Signed-off-by: Dan Mick <dan.mick@inktank.com>
-rwxr-xr-x | src/ceph-rest-api | 10 | ||||
-rwxr-xr-x | src/ceph.in | 16 |
2 files changed, 9 insertions, 17 deletions
diff --git a/src/ceph-rest-api b/src/ceph-rest-api index 98e7ce0dbcf..42015006f6b 100755 --- a/src/ceph-rest-api +++ b/src/ceph-rest-api @@ -10,7 +10,7 @@ import sys MYPATH = os.path.abspath(__file__) MYDIR = os.path.dirname(MYPATH) -DEVMODEMSG = '*** DEVELOPER MODE: setting PYTHONPATH and LD_LIBRARY_PATH' +VIRTPYTHON = './pybind/virtualenv/bin/python' if MYDIR.endswith('src') and \ os.path.exists(os.path.join(MYDIR, '.libs')) and \ @@ -19,14 +19,10 @@ if MYDIR.endswith('src') and \ if 'LD_LIBRARY_PATH' in os.environ: if MYLIBPATH not in os.environ['LD_LIBRARY_PATH']: os.environ['LD_LIBRARY_PATH'] += ':' + MYLIBPATH - print >> sys.stderr, DEVMODEMSG - os.execvp('python', ['python'] + sys.argv) + os.execvp(VIRTPYTHON, [VIRTPYTHON] + sys.argv) else: os.environ['LD_LIBRARY_PATH'] = MYLIBPATH - print >> sys.stderr, DEVMODEMSG - os.execvp('python', ['python'] + sys.argv) - sys.path.insert(0, os.path.join(MYDIR, 'pybind')) - + os.execvp(VIRTPYTHON, [VIRTPYTHON] + sys.argv) def parse_args(): parser = argparse.ArgumentParser(description="Ceph REST API webapp") diff --git a/src/ceph.in b/src/ceph.in index 075ec80c20b..c4179fef2a0 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -26,7 +26,7 @@ import sys MYPATH = os.path.abspath(__file__) MYDIR = os.path.dirname(MYPATH) -DEVMODEMSG = '*** DEVELOPER MODE: setting PATH, PYTHONPATH and LD_LIBRARY_PATH ***' +VIRTPYTHON = './pybind/virtualenv/bin/python' if MYDIR.endswith('src') and \ os.path.exists(os.path.join(MYDIR, '.libs')) and \ @@ -35,15 +35,11 @@ if MYDIR.endswith('src') and \ if 'LD_LIBRARY_PATH' in os.environ: if MYLIBPATH not in os.environ['LD_LIBRARY_PATH']: os.environ['LD_LIBRARY_PATH'] += ':' + MYLIBPATH - print >> sys.stderr, DEVMODEMSG - os.execvp('python', ['python'] + sys.argv) + os.environ['PATH'] += ':' + MYDIR + os.execvp(VIRTPYTHON, [VIRTPYTHON] + sys.argv) else: os.environ['LD_LIBRARY_PATH'] = MYLIBPATH - print >> sys.stderr, DEVMODEMSG - os.execvp('python', ['python'] + sys.argv) - sys.path.insert(0, os.path.join(MYDIR, 'pybind')) - if MYDIR not in os.environ['PATH']: - os.environ['PATH'] += ':' + MYDIR + os.execvp(VIRTPYTHON, [VIRTPYTHON] + sys.argv) import argparse import errno @@ -176,7 +172,7 @@ def do_help(parser, args): def help_for_target(target, partial=None): ret, outbuf, outs = json_command(cluster_handle, target=target, - prefix='get_command_descriptions', + prefix='get_command_descriptions', timeout=10) if ret: print >> sys.stderr, \ @@ -415,7 +411,7 @@ def new_style_command(parsed_args, cmdargs, target, sigdict, inbuf, verbose): def complete(sigdict, args, target): """ Command completion. Match as much of [args] as possible, - and print every possible match separated by newlines. + and print every possible match separated by newlines. Return exitcode. """ # XXX this looks a lot like the front of validate_command(). Refactor? |