QGIS/cmake/QsciAPI.cmake
Larry Shaffer dc4628599e [pyqgis-console] Add targets and python script for generating console's QScintilla .pap file, for auto-completion
- Run 'make;make qsci-pap-src; make install' to update the default .pap file in source tree
- Run 'make;make qsci-pap-master[; make install]' for local-only .pap that overrides the default .pap (when testing new bindings)
- Update console to override default .pap if master.pap is available
- Include new qgis.core.NULL attribute defined in <src>/python/__init__.py for QPyNullVariant comparisons
- Update 11-month-old default .pap
2013-08-30 13:12:38 -06:00

33 lines
1.5 KiB
CMake

# Concatenation/editing of QScintilla API files for PyQGIS
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2012, Larry Shaffer <larrys@dakotacarto.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
SET(QGIS_PYTHON_API_FILE "${CMAKE_BINARY_DIR}/python/qsci_apis/PyQGIS.api")
# create empty destination api file
FILE(WRITE "${QGIS_PYTHON_API_FILE}" "")
IF(EXISTS "${CMAKE_BINARY_DIR}/python/qgis.gui.api")
FILE(READ "${CMAKE_BINARY_DIR}/python/qgis.gui.api" FILE_CONTENT)
STRING(REGEX MATCHALL "gui\\.QgisInterface([^\n]+)" MATCHED_CONTENT "${FILE_CONTENT}")
FOREACH(matchedLine ${MATCHED_CONTENT})
STRING(REGEX REPLACE "gui\\.QgisInterface(.*)" "qgis.utils.iface\\1\n" MODIFIED_MATCH "${matchedLine}")
FILE(APPEND "${QGIS_PYTHON_API_FILE}" "${MODIFIED_MATCH}")
ENDFOREACH(matchedLine)
ENDIF(EXISTS "${CMAKE_BINARY_DIR}/python/qgis.gui.api")
# add qgis.core.NULL attribute defined in <src>/python/__init__.py for QPyNullVariant
FILE(APPEND "${QGIS_PYTHON_API_FILE}" "qgis.core.NULL?7\n")
FOREACH(apiFile qgis.core.api qgis.gui.api qgis.analysis.api qgis.networkanalysis.api)
SET(api "${CMAKE_BINARY_DIR}/python/${apiFile}")
IF(EXISTS "${api}")
FILE(READ "${api}" FILE_CONTENT)
STRING(REGEX REPLACE "([^\n]+)" "qgis.\\1" MODIFIED_CONTENT "${FILE_CONTENT}")
FILE(APPEND "${QGIS_PYTHON_API_FILE}" "${MODIFIED_CONTENT}")
ENDIF(EXISTS "${api}")
ENDFOREACH(apiFile)