Skip to content

Commit

Permalink
MB-10682: Make the script relocatable
Browse files Browse the repository at this point in the history
Previously we hardcoded the absolute path of the installed binary
into the wrapper script. This patch determines the path at
runtime.

Limitation:
  The directory layout have to be:

  bin/tools/program
  lib/python/python-file

Change-Id: Ia2139ec59c7cb92bdf28b2caabc504075f03f282
Reviewed-on: http://review.couchbase.org/35543
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>
Tested-by: Trond Norbye <trond.norbye@gmail.com>
  • Loading branch information
trondn committed Apr 10, 2014
1 parent 67fefb3 commit f10b38f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PROJECT(CouchbasePythonClient)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Generate the python wrappers
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper.in
CONFIGURE_FILE (${CMAKE_CURRENT_SOURCE_DIR}/wrapper/wrapper
${CMAKE_CURRENT_BINARY_DIR}/wrapper/cbdocloader)

INSTALL(PROGRAMS
Expand Down
7 changes: 6 additions & 1 deletion wrapper/wrapper.in → wrapper/wrapper
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#! /bin/sh
root=${CMAKE_INSTALL_PREFIX}/lib/python

CWD="`pwd`"
D0="`dirname "$0"`"
cd $D0/../../lib/python
root="`pwd`"
cd "$CWD"

if test -z "$PYTHONPATH"; then
PYTHONPATH="$root"
Expand Down

0 comments on commit f10b38f

Please sign in to comment.