Skip to content

Commit

Permalink
stage python extension only for staged plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 18, 2014
1 parent 3499a39 commit 0791930
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 26 deletions.
3 changes: 2 additions & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down
11 changes: 6 additions & 5 deletions ms-windows/osgeo4w/package-nightly.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
12 changes: 6 additions & 6 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}
Expand Down
52 changes: 38 additions & 14 deletions python/ext-libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.