mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
By default install bindings to QGIS directory -> no need to install as 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
This commit is contained in:
parent
880a93a220
commit
fb7b670c80
@ -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"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user