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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 2 13:21:51 PDT 2012


Author: martinl
Date: 2012-11-02 13:21:51 -0700 (Fri, 02 Nov 2012)
New Revision: 53670

Modified:
   grass/trunk/scripts/g.extension/g.extension.py
Log:
g.extension: fix update_manual_page for multiple modules (eg. r.modis)


Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2012-11-02 20:10:28 UTC (rev 53669)
+++ grass/trunk/scripts/g.extension/g.extension.py	2012-11-02 20:21:51 UTC (rev 53670)
@@ -467,10 +467,7 @@
             ret += install_extension_other(module)
         if len(mlist) > 1:
             print '-' * 60
-        if not flags['d']:
-            grass.verbose(_("Updating manual page for <%s>...") % module)
-            update_manual_page(module)
-
+    
     if flags['d']:
         return
 
@@ -478,7 +475,10 @@
         grass.warning(_('Installation failed, sorry. Please check above error messages.'))
     else:
         grass.message(_("Updating metadata file..."))
-        install_extension_xml(url, mlist)
+        blist = install_extension_xml(url, mlist)
+        for module in blist:
+            update_manual_page(module)
+        
         grass.message(_("Installation of <%s> successfully finished") % options['extension'])
     
     if not os.getenv('GRASS_ADDON_BASE'):
@@ -557,7 +557,7 @@
 
     write_xml_toolboxes(fXML, tree)
 
-
+# return list of executables for update_manual_page()
 def install_extension_xml(url, mlist):
     if len(mlist) > 1:
         # read metadata from remote server (toolboxes)
@@ -567,6 +567,7 @@
     url = url + "modules.xml"
 
     data = {}
+    bList = []
     try:
         f = urlopen(url)
         tree = etree.fromstring(f.read())
@@ -581,10 +582,13 @@
             if bnode is not None:
                 for fnode in bnode.findall('file'):
                     path = fnode.text.split('/')
-                    if windows:
-                        if path[0] == 'bin':
+                    if path[0] == 'bin':
+                        bList.append(path[-1])
+                        if windows:
                             path[-1] += '.exe'
-                        if path[0] == 'scripts':
+                    elif path[0] == 'scripts':
+                        bList.append(path[-1])
+                        if windows:
                             path[-1] += '.py'
                     fList.append(os.path.sep.join(path))
             
@@ -662,6 +666,8 @@
 
     write_xml_modules(fXML, tree)
 
+    return bList
+
 # install extension on MS Windows
 def install_extension_win(name):
     ### TODO: do not use hardcoded url - http://wingrass.fsv.cvut.cz/grassXX/addonsX.X.X
@@ -937,6 +943,7 @@
     if module.split('.', 1)[0] == 'wx':
         return # skip for GUI modules
 
+    grass.verbose(_("Manual page for <%s> updated") % module)
     # read original html file
     htmlfile = os.path.join(options['prefix'], 'docs', 'html', module + '.html')
     try:



More information about the grass-commit mailing list