From 85b4a360fcead6fc8d1724bc605840e5c62e3eaa Mon Sep 17 00:00:00 2001 From: Tim Sutton Date: Mon, 27 Aug 2012 16:21:18 +0200 Subject: [PATCH] Added comment about origin of qgis path var --- tests/src/python/utilities.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/src/python/utilities.py b/tests/src/python/utilities.py index 8b57438e62db..e8ec45a7f3b6 100644 --- a/tests/src/python/utilities.py +++ b/tests/src/python/utilities.py @@ -67,8 +67,25 @@ def getQgisTestApp(): if QGISAPP is None: myGuiFlag = True # All test will run qgis in gui mode - QGISAPP = QgsApplication(sys.argv, myGuiFlag) + # Note: QGIS_PREFIX_PATH is set by cmake to the output dir + if 'QGIS_PREFIX_PATH' in os.environ: + myPath = os.environ['QGIS_PREFIX_PATH'] + 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