[GRASS-SVN] r50844 - grass/trunk/scripts/g.extension

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Feb 17 15:29:49 EST 2012


Author: martinl
Date: 2012-02-17 12:29:49 -0800 (Fri, 17 Feb 2012)
New Revision: 50844

Modified:
   grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extension: catch error when unable to parse modules.xml


Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2012-02-17 20:25:48 UTC (rev 50843)
+++ grass/trunk/scripts/g.extension/g.extension.py	2012-02-17 20:29:49 UTC (rev 50844)
@@ -271,9 +271,14 @@
 def list_available_modules(mlist = None):
     # try to download XML metadata file first
     url = "http://grass.osgeo.org/addons/grass%s/modules.xml" % version[0]
+    grass.debug("url=%s" % url, 1)
     try:
         f = urlopen(url)
-        tree = etree.fromstring(f.read())
+        try:
+            tree = etree.fromstring(f.read())
+        except:
+            grass.fatal(_("Unable to parse '%s'") % url)
+        
         for mnode in tree.findall('task'):
             name = mnode.get('name').strip()
             if mlist and name not in mlist:
@@ -647,6 +652,7 @@
     ### TODO: do not use hardcoded url - http://wingrass.fsv.cvut.cz/grassXX/addonsX.X.X
     grass.message(_("Downloading precompiled GRASS Addons <%s>...") % options['extension'])
     url = "http://wingrass.fsv.cvut.cz/grass%s%s/addons" % (version[0], version[1])
+    
     if version[2][-3:] != 'svn':
         url += '%s.%s.%s' % (version[0], version[1], version[2])
     grass.debug("url=%s" % url, 1)



More information about the grass-commit mailing list