[GRASS-SVN] r70238 - in grass/branches/releasebranch_7_2: scripts/g.extension tools

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jan 4 04:12:02 PST 2017


Author: martinl
Date: 2017-01-04 04:12:02 -0800 (Wed, 04 Jan 2017)
New Revision: 70238

Modified:
   grass/branches/releasebranch_7_2/scripts/g.extension/g.extension.py
   grass/branches/releasebranch_7_2/tools/mkhtml.py
Log:
broken links to source code and history in add-ons user manuals (see #3224)
       (relb72: partial merge r70235 from trunk)


Modified: grass/branches/releasebranch_7_2/scripts/g.extension/g.extension.py
===================================================================
--- grass/branches/releasebranch_7_2/scripts/g.extension/g.extension.py	2017-01-04 12:08:44 UTC (rev 70237)
+++ grass/branches/releasebranch_7_2/scripts/g.extension/g.extension.py	2017-01-04 12:12:02 UTC (rev 70238)
@@ -1125,6 +1125,8 @@
 def install_extension_std_platforms(name, source, url):
     """Install extension on standard platforms"""
     gisbase = os.getenv('GISBASE')
+    source_url = "https://trac.osgeo.org/grass/browser/grass-addons/grass7/"
+
     if source == 'official':
         gscript.message(_("Fetching <%s> from "
                           "GRASS GIS Addons repository (be patient)...") % name)
@@ -1167,7 +1169,8 @@
         'MANBASEDIR=%s' % dirs['man'],
         'SCRIPTDIR=%s' % dirs['script'],
         'STRINGDIR=%s' % dirs['string'],
-        'ETC=%s' % os.path.join(dirs['etc'])
+        'ETC=%s' % os.path.join(dirs['etc']),
+        'SOURCE_URL=%s' % source_url
     ]
 
     install_cmd = [

Modified: grass/branches/releasebranch_7_2/tools/mkhtml.py
===================================================================
--- grass/branches/releasebranch_7_2/tools/mkhtml.py	2017-01-04 12:08:44 UTC (rev 70237)
+++ grass/branches/releasebranch_7_2/tools/mkhtml.py	2017-01-04 12:12:02 UTC (rev 70238)
@@ -305,8 +305,14 @@
 topdir = os.path.abspath(os.getenv("MODULE_TOPDIR"))
 curdir = os.path.abspath(os.path.curdir)
 pgmdir = curdir.replace(topdir, '').lstrip('/')
-url_source = urlparse.urljoin(source_url, pgmdir)
-
+if os.getenv('SOURCE_URL', ''):
+    # addons
+    pgmname = os.path.basename(pgmdir)
+    classname = index_names[pgmname[:pgmname.find('.')]]
+    url_source = urlparse.urljoin('{}{}/'.format(os.environ['SOURCE_URL'], classname),
+                                  pgmname)
+else:
+    url_source = urlparse.urljoin(source_url, pgmdir)
 if index_name:
     sys.stdout.write(sourcecode.substitute(URL_SOURCE=url_source, PGM=pgm,
                                            URL_LOG=url_source.replace('browser',  'log')))



More information about the grass-commit mailing list