Skip to content
Permalink
Browse files

Fix package data and svg paths for cmake and pyqgis tests on Mac

  • Loading branch information
dakcarto committed Aug 25, 2012
1 parent 6811abd commit 9e73629d92980de698a7396be10ce49ee2d41992
Showing with 19 additions and 1 deletion.
  1. +6 −0 cmake/UsePythonTest.cmake
  2. +1 −1 tests/CMakeLists.txt
  3. +12 −0 tests/src/python/utilities.py
@@ -45,6 +45,12 @@ ELSE(WIN32)
SET(ENV{PYTHONPATH} \"${QGIS_OUTPUT_DIRECTORY}/python/:\$ENV{PYTHONPATH}\")
MESSAGE(\"LD_LIBRARY_PATH:\$ENV{LD_LIBRARY_PATH}\")
ENDIF(WIN32)
IF(APPLE)
SET(ENV{QGIS_MAC_PKGDATA_DIR} \"${CMAKE_SOURCE_DIR}\")
SET(ENV{QGIS_MAC_SVG_DIR} \"${CMAKE_SOURCE_DIR}/images/svg\")
ENDIF(APPLE)
MESSAGE(\"PYTHONPATH:\$ENV{PYTHONPATH}\")
MESSAGE(STATUS \"Running ${PYTHON_EXECUTABLE} ${loc} ${wo_semicolon}\")
EXECUTE_PROCESS(
@@ -1,7 +1,7 @@
IF (ENABLE_TESTS)
IF (APPLE)
# override default data path, otherwise looks for Resources in app bundle
SET (QGIS_DATA_SUBDIR "${CMAKE_CURRENT_SOURCE_DIR}/resources")
SET (QGIS_DATA_SUBDIR "${CMAKE_SOURCE_DIR}/resources")
ENDIF (APPLE)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(bench)
@@ -73,6 +73,18 @@ def getQgisTestApp():
myUseDefaultPathFlag = True
QGISAPP.setPrefixPath(myPath, myUseDefaultPathFlag)

if sys.platform.startswith('darwin'):
# override resource paths, otherwise looks for Resources in app
if 'QGIS_MAC_PKGDATA_DIR' in os.environ:
myPkgPath = os.environ['QGIS_MAC_PKGDATA_DIR']
QGISAPP.setPkgDataPath(myPkgPath)
if 'QGIS_MAC_SVG_DIR' in os.environ:
mySVGPath = os.environ['QGIS_MAC_SVG_DIR']
mySVGPaths = QGISAPP.svgPaths()
# doesn't get rid of incorrect path, just adds correct one
mySVGPaths.prepend(mySVGPath)
QGISAPP.setDefaultSvgPaths(mySVGPaths)

QGISAPP.initQgis()
s = QGISAPP.showSettings()
print s

0 comments on commit 9e73629

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