[GRASS-SVN] r44520 - grass/branches/develbranch_6/scripts/v.krige

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 2 09:08:05 EST 2010


Author: aghisla
Date: 2010-12-02 06:08:04 -0800 (Thu, 02 Dec 2010)
New Revision: 44520

Modified:
   grass/branches/develbranch_6/scripts/v.krige/v.krige.py
Log:
Merged r44503,44516,44517 from trunk.

Modified: grass/branches/develbranch_6/scripts/v.krige/v.krige.py
===================================================================
--- grass/branches/develbranch_6/scripts/v.krige/v.krige.py	2010-12-02 13:05:53 UTC (rev 44519)
+++ grass/branches/develbranch_6/scripts/v.krige/v.krige.py	2010-12-02 14:08:04 UTC (rev 44520)
@@ -398,22 +398,21 @@
     # rpy2
     global robjects
     global rinterface
-    grass.message(_('Loading packages, please wait...'))
+    grass.message(_('Loading dependencies, please wait...'))
     try:
         import rpy2.robjects as robjects
         import rpy2.rinterface as rinterface #to speed up kriging? for plots.
-        haveRpy2 = True
     except ImportError:
-        print >> sys.stderr, _("Python module 'Rpy2' not found. Please install it and re-run v.krige.") # ok for other OSes?
-        haveRpy2 = False
-        if not haveRpy2:
-            sys.exit(1)
+        grass.fatal(_("Python module 'Rpy2' not found. Please install it and re-run v.krige.")) # ok for other OSes?
         
-    # R packages check.
-    # @FIXME: it leaves a Rtmpxxxx folder into the make tempfolder and causes make complain. [markus]
+    # R packages check. Will create one error message after check of all packages.
+    missingPackagesList = []
     for each in ["gstat", "spgrass6", "maptools"]:
         if not robjects.r.require(each, quietly = True)[0]:
-            sys.exit(_("R package '%s' is missing. Install it and re-run v.krige.") % each)
+            missingPackagesList.append(each)
+    if missingPackagesList:
+        errorString = _("R package(s) ") + ", ".join(map(str, missingPackagesList)) +  _(" missing. Install it/them and re-run v.krige.")
+        grass.fatal(errorString)
     
 if __name__ == '__main__':
     if len(sys.argv) > 1:



More information about the grass-commit mailing list