[GRASS-SVN] r64628 - grass/branches/releasebranch_7_0/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 14 09:30:55 PST 2015


Author: martinl
Date: 2015-02-14 09:30:55 -0800 (Sat, 14 Feb 2015)
New Revision: 64628

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py
Log:
attempt to fix failure when loading broken addons
report errors when unable to parse addons interface
add message when some addons failed, suggest solution to the user
(merge r64499, r64504, r64532 from trunk)


Modified: grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py	2015-02-14 17:19:27 UTC (rev 64627)
+++ grass/branches/releasebranch_7_0/gui/wxpython/core/toolboxes.py	2015-02-14 17:30:55 UTC (rev 64628)
@@ -504,6 +504,7 @@
     >>> etree.tostring(tree)
     '<items><module-item name="m.proj"><module>m.proj</module><description>Converts coordinates from one projection to another (cs2cs frontend).</description><keywords>miscellaneous,projection</keywords></module-item></items>'
     """
+    hasErrors = False
     modules = node.findall('.//module-item')
     for module in modules:
         name = module.get('name')
@@ -517,8 +518,13 @@
             n.text = _escapeXML(desc)
             n = etree.SubElement(parent=module, tag='keywords')
             n.text = _escapeXML(','.join(keywords))
-
-
+            if not desc:
+                hasErrors = True
+    
+    if hasErrors:
+        sys.stderr.write(_("WARNING: Some addons failed when loading. "
+                           "Please consider to update your addons by running 'g.extension.all -f'.\n"))
+    
 def _escapeXML(text):
     """Helper function for correct escaping characters for XML.
 
@@ -539,7 +545,8 @@
     """
     try:
         task = gtask.parse_interface(module)
-    except ScriptError:
+    except (ScriptError, UnicodeDecodeError) as e:
+        sys.stderr.write("%s: %s\n" % (module, e))
         return '', ''
 
     return task.get_description(full=True), \



More information about the grass-commit mailing list