Skip to content
Permalink
Browse files
stage python extension only for staged plugins
  • Loading branch information
jef-n committed May 18, 2014
1 parent 3499a39 commit 07919309c41649a4bd64f9d720bebc6f9c2e3f08
Showing with 52 additions and 26 deletions.
  1. +2 −1 debian/rules
  2. +6 −5 ms-windows/osgeo4w/package-nightly.cmd
  3. +6 −6 python/CMakeLists.txt
  4. +38 −14 python/ext-libs/CMakeLists.txt
@@ -60,7 +60,8 @@ CMAKE_OPTS := \
-DWITH_INTERNAL_MARKUPSAFE=FALSE \
-DWITH_INTERNAL_PYGMENTS=FALSE \
-DWITH_INTERNAL_DATEUTIL=FALSE \
-DWITH_INTERNAL_PYTZ=FALSE
-DWITH_INTERNAL_PYTZ=FALSE \
-DWITH_INTERNAL_SIX=FALSE

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -162,11 +162,12 @@ cmake %CMAKE_OPT% ^
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/%PACKAGENAME% ^
-D FCGI_INCLUDE_DIR=%O4W_ROOT%/include ^
-D FCGI_LIBRARY=%O4W_ROOT%/lib/libfcgi.lib ^
-D WITH_INTERNAL_JINJA2=FALSE \
-D WITH_INTERNAL_MARKUPSAFE=FALSE \
-D WITH_INTERNAL_PYGMENTS=FALSE \
-D WITH_INTERNAL_DATEUTIL=FALSE \
-D WITH_INTERNAL_PYTZ=FALSE \
-D WITH_INTERNAL_JINJA2=FALSE ^
-D WITH_INTERNAL_MARKUPSAFE=FALSE ^
-D WITH_INTERNAL_PYGMENTS=FALSE ^
-D WITH_INTERNAL_DATEUTIL=FALSE ^
-D WITH_INTERNAL_PYTZ=FALSE ^
-D WITH_INTERNAL_SIX=FALSE ^
%SRCDIR%
if errorlevel 1 (echo cmake failed & goto error)

@@ -1,11 +1,5 @@
SET(PYTHON_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/python)

ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(qsci_apis)
ADD_SUBDIRECTORY(console)
ADD_SUBDIRECTORY(pyplugin_installer)
ADD_SUBDIRECTORY(ext-libs)

IF (WITH_INTERNAL_SPATIALITE)
INCLUDE_DIRECTORIES(
../src/core/spatialite/headers
@@ -18,6 +12,12 @@ FILE (MAKE_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})
SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})
SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_PYTHON_OUTPUT_DIRECTORY})

ADD_SUBDIRECTORY(plugins)
ADD_SUBDIRECTORY(qsci_apis)
ADD_SUBDIRECTORY(console)
ADD_SUBDIRECTORY(pyplugin_installer)
ADD_SUBDIRECTORY(ext-libs)

INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_PATH}
${SIP_INCLUDE_DIR}
@@ -8,35 +8,59 @@ ENDIF (WITH_PYSPATIALITE)

MACRO(EXT_PYLIB lib)
STRING(TOUPPER ${lib} ulib)
SET (WITH_INTERNAL_${ulib} TRUE CACHE BOOL "Determines whether ${ulib} should be included")
SET (WITH_INTERNAL_${ulib} TRUE CACHE BOOL "Determines whether python ${lib} should be included")
IF(WITH_INTERNAL_${ulib})
INSTALL(DIRECTORY ${lib} DESTINATION "${QGIS_PYTHON_DIR}")

ADD_CUSTOM_TARGET(py${lib} ALL)
FILE(GLOB_RECURSE files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${lib}/*)
FOREACH(file ${files})
IF(WITH_STAGED_PLUGINS)
ADD_CUSTOM_TARGET(py${lib} ALL)

FILE(GLOB_RECURSE files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${lib}/*)
ADD_CUSTOM_COMMAND(TARGET py${lib}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${file} "${PYTHON_OUTPUT_DIRECTORY}/${file}"
COMMAND ${CMAKE_COMMAND} -E copy_directory ${lib} "${PYTHON_OUTPUT_DIRECTORY}/${lib}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Copy ${file} => ${PYTHON_OUTPUT_DIRECTORY}/${file}"
DEPENDS ${file}
DEPENDS ${files}
)
ENDFOREACH(file)

IF(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(pycompile-py${lib} ALL
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/${lib}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Byte-compiling staged extension ${lib}..."
DEPENDS py${lib}
)
ENDIF(WITH_PY_COMPILE)
ENDIF(WITH_STAGED_PLUGINS)
ENDIF(WITH_INTERNAL_${ulib})
ENDMACRO(EXT_PYLIB lib)

FOREACH(pkg httplib2 jinja2 markupsafe owslib pygments dateutil pytz)
EXT_PYLIB(${pkg})
ENDFOREACH(pkg)

SET (WITH_INTERNAL_SIX TRUE CACHE BOOL "Determines whether python six should be included")
IF(WITH_INTERNAL_SIX)
INSTALL(FILES six.py DESTINATION "${QGIS_PYTHON_DIR}")

ADD_CUSTOM_COMMAND(TARGET pyutils
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy six.py "${PYTHON_OUTPUT_DIRECTORY}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS six.py
)
IF(WITH_STAGED_PLUGINS)
ADD_CUSTOM_TARGET(pysix ALL)

ADD_CUSTOM_COMMAND(TARGET pysix
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy six.py "${PYTHON_OUTPUT_DIRECTORY}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS six.py
)

IF(WITH_PY_COMPILE)
ADD_CUSTOM_TARGET(pycompile-pysix ALL
COMMAND ${PYTHON_EXECUTABLE} -m compileall -q "${PYTHON_OUTPUT_DIRECTORY}/${lib}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
COMMENT "Byte-compiling staged extension ${lib}..."
DEPENDS pysix
)
ENDIF(WITH_PY_COMPILE)
ENDIF(WITH_STAGED_PLUGINS)
ENDIF(WITH_INTERNAL_SIX)

0 comments on commit 0791930

Please sign in to comment.