[GRASS-SVN] r70546 - grass/trunk/tools

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 13 01:13:28 PST 2017


Author: martinl
Date: 2017-02-13 01:13:28 -0800 (Mon, 13 Feb 2017)
New Revision: 70546

Modified:
   grass/trunk/tools/mkhtml.py
Log:
broken links to source code and history in add-ons user manuals (see #3224)
       (another attempt to fix wingrass addons builds)


Modified: grass/trunk/tools/mkhtml.py
===================================================================
--- grass/trunk/tools/mkhtml.py	2017-02-12 21:21:50 UTC (rev 70545)
+++ grass/trunk/tools/mkhtml.py	2017-02-13 09:13:28 UTC (rev 70546)
@@ -316,13 +316,19 @@
 curdir = os.path.abspath(os.path.curdir)
 pgmdir = curdir.replace(topdir, '').lstrip('/')
 if os.getenv('SOURCE_URL', ''):
-    import tempfile
     # addons
-    basename = os.getcwd()[len(tempfile.gettempdir())+1:]
-    pgmname = basename[basename.find(os.path.sep)+1:]
-    classname = index_names[pgmname[:pgmname.find('.')]]
-    url_source = urlparse.urljoin('{0}{1}/'.format(os.environ['SOURCE_URL'], classname),
-                                  pgmname)
+    url_source = ''
+    for prefix in index_names.keys():
+        cwd = os.getcwd()
+        idx = cwd.find('{0}{1}.'.format(os.path.sep, prefix))
+        if idx > -1:
+            pgmname = cwd[idx+1:]
+            classname = index_names[prefix]
+            url_source = urlparse.urljoin('{0}{1}/'.format(
+                    os.environ['SOURCE_URL'], classname),
+                    pgmname
+            )
+            break
 else:
     url_source = urlparse.urljoin(source_url, pgmdir)
 if index_name:



More information about the grass-commit mailing list