[GRASS-SVN] r66007 - in grass-addons/grass7/gui/wxpython/wx.metadata: r.info.iso t.info.iso v.info.iso

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 24 11:46:16 PDT 2015


Author: krejcmat
Date: 2015-08-24 11:46:16 -0700 (Mon, 24 Aug 2015)
New Revision: 66007

Modified:
   grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py
   grass-addons/grass7/gui/wxpython/wx.metadata/t.info.iso/t.info.iso.py
   grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py
Log:
wx.metadata addons: improved import err msg

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py	2015-08-24 16:27:10 UTC (rev 66006)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/r.info.iso/r.info.iso.py	2015-08-24 18:46:16 UTC (rev 66007)
@@ -41,15 +41,18 @@
 from grass.pygrass.utils import get_lib_path
 
 
-def load_mdlib():
-    path = get_lib_path(modname=os.path.join('wx.metadata','mdlib') ,libname='mdgrass')
-    if path is None:
-        fatal("Not able to find the metadata library directory")
-    sys.path.append(path)
+def load_mdlib(libs):
+    for lib in libs:
+        path = get_lib_path(modname=os.path.join('wx.metadata','mdlib') ,libname=lib)
+        if path is not None and path not in sys.path:
+            sys.path.append(path)
+        elif path is  None:
+            fatal("Fatal error: library < %s > not found "%lib)
 
+
 def main():
     # load metadata library
-    load_mdlib()
+    load_mdlib(['mdgrass'])
     from mdgrass import GrassMD
 
     if not options['output']:

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/t.info.iso/t.info.iso.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/t.info.iso/t.info.iso.py	2015-08-24 16:27:10 UTC (rev 66006)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/t.info.iso/t.info.iso.py	2015-08-24 18:46:16 UTC (rev 66007)
@@ -41,15 +41,18 @@
 from grass.pygrass.utils import get_lib_path
 
 
-def load_mdlib():
-    path = get_lib_path(modname=os.path.join('wx.metadata','mdlib') ,libname='mdgrass')
-    if path is None:
-        fatal("Not able to find the metadata library directory")
-    sys.path.append(path)
+def load_mdlib(libs):
+    for lib in libs:
+        path = get_lib_path(modname=os.path.join('wx.metadata','mdlib') ,libname=lib)
+        if path is not None and path not in sys.path:
+            sys.path.append(path)
+        elif path is  None:
+            fatal("Fatal error: library < %s > not found "%lib)
 
 
 def main():
-    load_mdlib()
+    # load metadata library
+    load_mdlib(['mdgrass'])
     from mdgrass import GrassMD
 
     if not options['output']:

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py	2015-08-24 16:27:10 UTC (rev 66006)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/v.info.iso/v.info.iso.py	2015-08-24 18:46:16 UTC (rev 66007)
@@ -40,16 +40,17 @@
 from grass.pygrass.utils import get_lib_path
 
 
-def load_mdlib():
-    path = get_lib_path(modname=os.path.join('wx.metadata','mdlib') ,libname='mdgrass')
-    if path is None:
-        fatal("Not able to find the metadata library directory")
-    sys.path.append(path)
+def load_mdlib(libs):
+    for lib in libs:
+        path = get_lib_path(modname=os.path.join('wx.metadata','mdlib') ,libname=lib)
+        if path is not None and path not in sys.path:
+            sys.path.append(path)
+        elif path is  None:
+            fatal("Fatal error: library < %s > not found "%lib)
 
-
 def main():
     # load metadata library
-    load_mdlib()
+    load_mdlib(['mdgrass'])
     from mdgrass import GrassMD
 
     if not options['output']:



More information about the grass-commit mailing list