Skip to content
Permalink
Browse files

PyQScintilla api files setup for local compiling of pap file

- Update and concatenate sip-built api files into PyQGIS.api
- Move python/qgis/api to python/qsci_apis for future api selection and compiling module
- Add base version api files for python components
  • Loading branch information
dakcarto committed Oct 4, 2012
1 parent ec4e25c commit 064c0c054b686600e481af97d974f04649e13885
@@ -76,6 +76,8 @@ IF (WITH_BINDINGS)
# 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)")
# concatenate QScintilla2 API files
SET (WITH_QSCIAPI TRUE CACHE BOOL "Determines whether the QScintilla2 API files will be updated and concatenated")
ENDIF (WITH_BINDINGS)

#BUILD WITH QtMobility by default on android only. Other platform can force it
@@ -0,0 +1,19 @@
SET(QGIS_PYTHON_API_FILE "${CMAKE_BINARY_DIR}/python/qsci_apis/PyQGIS.api")

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")

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)
@@ -1,5 +1,5 @@
ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(api)
ADD_SUBDIRECTORY(qsci_apis)

SET (PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)
SET (QGIS_PYTHON_OUTPUT_DIRECTORY ${PYTHON_OUTPUT_DIRECTORY}/qgis)
@@ -125,7 +125,23 @@ SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.n
ADD_SIP_PYTHON_MODULE(qgis.networkanalysis analysis/network/networkanalysis.sip qgis_core qgis_networkanalysis)
ADD_DEPENDENCIES(python_module_qgis_networkanalysis python_module_qgis_core ${sip_files_network_analysis})

SET (QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)
SET(QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)

IF(WITH_QSCIAPI)
# wait until after python module builds for api files to be available
SET(QGIS_PYTHON_API_FILE "${CMAKE_BINARY_DIR}/python/qsci_apis/PyQGIS.api")
# create empty destination api file
FILE(WRITE "${QGIS_PYTHON_API_FILE}" "")

# run update/concatenate command after last python module is built (currently python_module_qgis_gui)
ADD_CUSTOM_COMMAND(TARGET python_module_qgis_gui
POST_BUILD
COMMAND "${CMAKE_COMMAND}" -P "${CMAKE_SOURCE_DIR}/cmake/QsciAPI.cmake"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Generating pyqgis api file" VERBATIM)

INSTALL(FILES ${QGIS_PYTHON_API_FILE} DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/qsci_apis")
ENDIF(WITH_QSCIAPI)

ADD_CUSTOM_TARGET(compile_python_files ALL)

This file was deleted.

@@ -174,7 +174,7 @@ def setLexers(self, lexer):
self.lexer.setFont(font, 3)
self.lexer.setFont(font, 4)
self.api = QsciAPIs(self.lexer)
self.api.loadPrepared(QString(os.path.dirname(__file__) + "/api/pyqgis_master.pap"))
self.api.loadPrepared(QString(os.path.dirname(os.path.dirname(__file__)) + "/qsci_apis/pyqgis_master.pap"))
self.setLexer(self.lexer)

## TODO: show completion list for file and directory
@@ -525,4 +525,4 @@ def runCommand(self, cmd):
def write(self, txt):
self.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(txt), 1)
self.append(txt)
self.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(txt), 1)
self.SendScintilla(QsciScintilla.SCI_SETSTYLING, len(txt), 1)
@@ -0,0 +1,3 @@
SET (QSCI_OUTPUT_DIR ${PYTHON_SITE_PACKAGES_DIR}/qsci_apis)
FILE(GLOB API_FILES *.pap *.api)
INSTALL(FILES ${API_FILES} DESTINATION ${QSCI_OUTPUT_DIR})
File renamed without changes.

Large diffs are not rendered by default.

File renamed without changes.

0 comments on commit 064c0c0

Please sign in to comment.
You can’t perform that action at this time.