[GRASS-SVN] r66479 - grass-addons/tools/addons

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 12 13:56:19 PDT 2015


Author: wenzeslaus
Date: 2015-10-12 13:56:19 -0700 (Mon, 12 Oct 2015)
New Revision: 66479

Modified:
   grass-addons/tools/addons/update_manual.py
Log:
ignore also links to nested addons when fixing URLs in addons manuals

Should fix links between addons in a group such as r.modis, r.green, r.mcda and r.futures.


Modified: grass-addons/tools/addons/update_manual.py
===================================================================
--- grass-addons/tools/addons/update_manual.py	2015-10-12 13:06:19 UTC (rev 66478)
+++ grass-addons/tools/addons/update_manual.py	2015-10-12 20:56:19 UTC (rev 66479)
@@ -9,9 +9,19 @@
 
 
 def get_addons(path):
-    return os.walk(path).next()[1]
+    """Get list of addons
 
+    Goes two levels deep to get directory names which are assumed
+    to be addon names.
+    """
+    top_dirs = os.walk(path).next()[1]
+    addons = []
+    for d in top_dirs:
+        a.extend(os.walk(d).next()[1])
+    addons.extend(top_dirs)
+    return addons
 
+
 def main(htmlfile, prefix):
     try:
         f = open(htmlfile)
@@ -25,6 +35,7 @@
 
     # find URIs
     pattern = r'''<a href="([^"]+)">([^>]+)</a>'''
+    # TODO: replace the magic 4 by passing the base addons dir as parameter
     addons = get_addons(os.sep.join(htmlfile.split(os.sep)[:4]))
     for match in re.finditer(pattern, shtml):
         # most common URLs



More information about the grass-commit mailing list