Skip to content
Permalink
Browse files
By default install bindings to QGIS directory -> no need to install a…
…s root.

It's possible to override it with BINDINGS_GLOBAL_INSTALL set to TRUE,
that will cause bindings to be installed to global python's site-packages dir.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6516 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Feb 4, 2007
1 parent 880a93a commit fb7b670c8084094215da2cbd4a46fdffb30c6c47
Showing with 19 additions and 2 deletions.
  1. +7 −1 CMakeLists.txt
  2. +8 −1 python/CMakeLists.txt
  3. +4 −0 src/app/qgspythonutils.cpp
@@ -25,12 +25,18 @@ SET (PLUGINS_ALSO_BINARIES FALSE)


# try to configure and build GRASS plugin by default
SET (WITH_GRASS TRE CACHE BOOL "Determines whether GRASS plugin should be built")
SET (WITH_GRASS TRUE CACHE BOOL "Determines whether GRASS plugin should be built")
SET (GRASS_PREFIX "" CACHE PATH "Path to GRASS base directory")

# try to configure and build python bindings by default
SET (WITH_BINDINGS TRUE CACHE BOOL "Determines whether python bindings should be built")

# By default bindings will be installed only to QGIS directory
# Someone might want to install it to python site-packages directory
# as otherwise user has to use PYTHONPATH environemnt variable to add
# QGIS bindings to package search path
SET (BINDINGS_GLOBAL_INSTALL FALSE CACHE BOOL "Install bindings to global python directory? (might need root)")


#############################################################
# check if lexer and parser are not missing
@@ -48,6 +48,7 @@ ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_GUI_LIB} PRE_LINK
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gui
DEPENDS ${BINDINGS_GUI_MAKEFILE})

IF (BINDINGS_GLOBAL_INSTALL)

# python's site-packages dir: bindings will be installed here
IF (UNIX)
@@ -65,6 +66,12 @@ ENDIF (UNIX)

EXEC_PROGRAM(${PYTHON_EXECUTABLE} ARGS -c "\"${CMD}\"" OUTPUT_VARIABLE SITE_PKG_PATH)

ELSE (BINDINGS_GLOBAL_INSTALL)

SET (SITE_PKG_PATH ${QGIS_DATA_DIR}/python)

ENDIF (BINDINGS_GLOBAL_INSTALL)


# Step 4: install built libs to python's site packages
INSTALL(FILES __init__.py ${CMAKE_CURRENT_BINARY_DIR}/qgisconfig.py ${BINDINGS_LIBS} DESTINATION ${SITE_PKG_PATH}/qgis)

@@ -43,6 +43,10 @@ void QgsPythonUtils::initPython(QgisInterface* interface)

// import sys module
runString("import sys");

// expect that bindings are installed locally, so add the path to modules
QString pythonPath = QgsApplication::pkgDataPath() + "/python";
runString("sys.path.insert(0, \"" + pythonPath + "\")");

// import SIP
if (!runString("from sip import wrapinstance, unwrapinstance"))

0 comments on commit fb7b670

Please sign in to comment.