Skip to content
Permalink
Browse files
Create Python package for core, gui, analysis, networkanalysis
Rename sip generated modules to _{name}
  • Loading branch information
NathanW2 committed May 19, 2014
1 parent 7127e58 commit 0ff49856e68bc7904088e807624f4d9f4791b964
@@ -85,7 +85,7 @@ ENDIF(PYQT4_VERSION_NUM LESS 264196)
FILE(GLOB_RECURSE sip_files_core core/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.core.api)
ADD_SIP_PYTHON_MODULE(qgis.core core/core.sip qgis_core)
ADD_SIP_PYTHON_MODULE(qgis._core core/core.sip qgis_core)

# additional gui includes
INCLUDE_DIRECTORIES(
@@ -106,7 +106,7 @@ IF(UNIX AND NOT SIP_VERSION_NUM LESS 265984)
ADD_DEFINITIONS(-Dprotected=public)
ENDIF(UNIX AND NOT SIP_VERSION_NUM LESS 265984)

ADD_SIP_PYTHON_MODULE(qgis.gui gui/gui.sip qgis_core qgis_gui)
ADD_SIP_PYTHON_MODULE(qgis._gui gui/gui.sip qgis_core qgis_gui)

# additional analysis includes
INCLUDE_DIRECTORIES(
@@ -129,13 +129,13 @@ FILE(GLOB sip_files_analysis
)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
ADD_SIP_PYTHON_MODULE(qgis.analysis analysis/analysis.sip qgis_core qgis_analysis)
ADD_SIP_PYTHON_MODULE(qgis._analysis analysis/analysis.sip qgis_core qgis_analysis)

# network-analysis module
FILE(GLOB_RECURSE sip_files_network_analysis analysis/network/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_network_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.networkanalysis.api)
ADD_SIP_PYTHON_MODULE(qgis.networkanalysis analysis/network/networkanalysis.sip qgis_core qgis_networkanalysis)
ADD_SIP_PYTHON_MODULE(qgis._networkanalysis analysis/network/networkanalysis.sip qgis_core qgis_networkanalysis)

SET(QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)

@@ -144,7 +144,7 @@ IF(WITH_QSCIAPI)
SET(QGIS_PYTHON_API_FILE "${CMAKE_BINARY_DIR}/python/qsci_apis/PyQGIS.api")

ADD_CUSTOM_TARGET(qsci-api ALL
DEPENDS python_module_qgis_gui python_module_qgis_core python_module_qgis_analysis python_module_qgis_networkanalysis)
DEPENDS python_module_qgis__gui python_module_qgis__core python_module_qgis__analysis python_module_qgis__networkanalysis)

# run update/concatenate command
ADD_CUSTOM_COMMAND(TARGET qsci-api
@@ -194,6 +194,21 @@ FOREACH(pyfile ${PY_FILES})
)
ENDFOREACH(pyfile)

FOREACH(module core gui analysis networkanalysis)
ADD_CUSTOM_TARGET(py${module} ALL)
FILE(GLOB_RECURSE PY_FILES "${module}/*.py")
INSTALL(FILES ${PY_FILES} DESTINATION "${QGIS_PYTHON_DIR}/${module}")

ADD_CUSTOM_COMMAND(TARGET py${module}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}"
COMMAND ${CMAKE_COMMAND} -E copy ${PY_FILES} "${QGIS_PYTHON_OUTPUT_DIRECTORY}/${module}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${pyfile}
)
ENDFOREACH(module)


# Byte-compile staged PyQGIS utilities
IF(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(pycompile-pyutils ALL
@@ -0,0 +1 @@
from qgis._analysis import *
@@ -1,4 +1,4 @@
%Module(name=qgis.analysis,
%Module(name=qgis._analysis,
version=0,
keyword_arguments="Optional")

@@ -1,4 +1,4 @@
%Module(name=qgis.networkanalysis,
%Module(name=qgis._networkanalysis,
version=0,
keyword_arguments="Optional")

@@ -0,0 +1 @@
from qgis._core import *
@@ -1,4 +1,4 @@
%Module(name=qgis.core,
%Module(name=qgis._core,
version=0,
keyword_arguments="Optional")

@@ -0,0 +1 @@
from qgis._gui import *
@@ -1,4 +1,4 @@
%Module(name=qgis.gui,
%Module(name=qgis._gui,
version=0,
keyword_arguments="Optional")

@@ -0,0 +1 @@
from qgis._networkanalysis import *

0 comments on commit 0ff4985

Please sign in to comment.