[GRASS-SVN] r49913 - in grass/trunk: gui/wxpython/core lib/init macosx/app scripts/g.extension scripts/g.manual

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Dec 25 19:22:39 EST 2011


Author: martinl
Date: 2011-12-25 16:22:39 -0800 (Sun, 25 Dec 2011)
New Revision: 49913

Modified:
   grass/trunk/gui/wxpython/core/globalvar.py
   grass/trunk/lib/init/grass.py
   grass/trunk/lib/init/grass7.html
   grass/trunk/macosx/app/grass.sh.in
   grass/trunk/scripts/g.extension/g.extension.py
   grass/trunk/scripts/g.manual/g.manual.py
Log:
GRASS_ADDON_BASE should be single alternative GISBASE


Modified: grass/trunk/gui/wxpython/core/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/core/globalvar.py	2011-12-26 00:06:14 UTC (rev 49912)
+++ grass/trunk/gui/wxpython/core/globalvar.py	2011-12-26 00:22:39 UTC (rev 49913)
@@ -144,11 +144,13 @@
         cmd = cmd + os.listdir(os.path.join(gisbase, 'etc', 'gui', 'scripts'))
     
     # scan addons (base)
-    if os.getenv('GRASS_ADDON_BASE'):
-        for path in os.getenv('GRASS_ADDON_BASE').split(os.pathsep):
-            if not os.path.exists(path) or not os.path.isdir(path):
-                continue
-            bpath = os.path.join(path, 'bin')
+    addons_base = os.getenv('GRASS_ADDON_BASE')
+    if addons_base:
+        if not os.path.exists(addons_base) or not os.path.isdir(addons_base):
+            sys.stderr.write(_("%s (%s) is not valid\n") % \
+                                 ("GRASS_ADDON_BASE", addons_base))
+        else:
+            bpath = os.path.join(addons_base, 'bin')
             if not scriptsOnly and os.path.exists(bpath) and \
                     os.path.isdir(bpath):
                 for fname in os.listdir(bpath):
@@ -158,7 +160,7 @@
                     elif ext == EXT_BIN:
                         cmd.append(name)
             
-            spath = os.path.join(path, 'scripts')            
+            spath = os.path.join(addons_base, 'scripts')            
             if os.path.exists(spath) and os.path.isdir(spath):
                 for fname in os.listdir(spath):
                     name, ext = os.path.splitext(fname)

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2011-12-26 00:06:14 UTC (rev 49912)
+++ grass/trunk/lib/init/grass.py	2011-12-26 00:22:39 UTC (rev 49913)
@@ -331,9 +331,8 @@
     if not addon_base:
         addon_base = os.path.join(grass_config_dir, 'addons')
         os.environ['GRASS_ADDON_BASE'] = addon_base
-    for path in addon_base.split(os.pathsep):
-        path_prepend(os.path.join(path, 'scripts'), 'PATH')
-        path_prepend(os.path.join(path, 'bin'), 'PATH')
+    path_prepend(os.path.join(addon_base, 'scripts'), 'PATH')
+    path_prepend(os.path.join(addon_base, 'bin'), 'PATH')
     
     # standard installation
     path_prepend(gfile('scripts'), 'PATH')

Modified: grass/trunk/lib/init/grass7.html
===================================================================
--- grass/trunk/lib/init/grass7.html	2011-12-26 00:06:14 UTC (rev 49912)
+++ grass/trunk/lib/init/grass7.html	2011-12-26 00:22:39 UTC (rev 49913)
@@ -155,11 +155,10 @@
 modules which are not distributed with the standard GRASS release.
 <div class="code"><pre>
    GRASS_ADDON_BASE=/usr/grass-addons
-   GRASS_ADDON_BASE=/usr/grass-addons:/usr/local/grass-addons
 </pre></div>
 
-<p>In this example above path(s) would be added to the standard GRASS path
-environment.
+<p>In this example above path would be added to the standard GRASS
+path environment.
 
 <p>If not defined by user, this variable is set by GRASS startup program
 to <tt>$HOME/.grass7/addons</tt> on GNU/Linux

Modified: grass/trunk/macosx/app/grass.sh.in
===================================================================
--- grass/trunk/macosx/app/grass.sh.in	2011-12-26 00:06:14 UTC (rev 49912)
+++ grass/trunk/macosx/app/grass.sh.in	2011-12-26 00:22:39 UTC (rev 49913)
@@ -46,10 +46,8 @@
 
 # add some OS X style app support paths, and create user one if missing.
 mkdir -p "$GISBASE_USER/Modules/bin"
-if [ "$GRASS_ADDON_BASE" ] ; then
-	GRASS_ADDON_BASE="$GRASS_ADDON_BASE:$GISBASE_USER/Modules:$GISBASE_SYSTEM/Modules"
-else
-	GRASS_ADDON_BASE="$GISBASE_USER/Modules:$GISBASE_SYSTEM/Modules"
+if [ ! "$GRASS_ADDON_BASE" ] ; then
+	GRASS_ADDON_BASE="$GISBASE_USER/Modules"
 fi
 export GRASS_ADDON_BASE
 

Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py	2011-12-26 00:06:14 UTC (rev 49912)
+++ grass/trunk/scripts/g.extension/g.extension.py	2011-12-26 00:22:39 UTC (rev 49913)
@@ -692,13 +692,8 @@
                             "installing to ~/.grass%d/addons") % major_version)
             options['prefix'] = os.path.join(os.environ['HOME'], '.grass%d' % major_version, 'addons')
         else:
-            path_list = os.environ['GRASS_ADDON_BASE'].split(os.pathsep)
-            if len(path_list) < 1:
-                grass.fatal(_("Invalid GRASS_ADDON_BASE value - '%s'") % os.environ['GRASS_ADDON_BASE'])
-            if len(path_list) > 1:
-                grass.warning(_("GRASS_ADDON_BASE has more items, using first defined - '%s'") % path_list[0])
-            options['prefix'] = path_list[0]
-                
+            options['prefix'] = os.environ['GRASS_ADDON_BASE']
+    
     # list available extensions
     if flags['l'] or flags['c'] or flags['g']:
         list_available_extensions()

Modified: grass/trunk/scripts/g.manual/g.manual.py
===================================================================
--- grass/trunk/scripts/g.manual/g.manual.py	2011-12-26 00:06:14 UTC (rev 49912)
+++ grass/trunk/scripts/g.manual/g.manual.py	2011-12-26 00:22:39 UTC (rev 49913)
@@ -46,10 +46,7 @@
     
     path = os.path.join(gisbase, 'docs', 'html', entry + '.html')
     if not os.path.exists(path) and os.getenv('GRASS_ADDON_BASE'):
-        for apath in os.getenv('GRASS_ADDON_BASE').split(os.pathsep):
-            path = os.path.join(apath, 'docs', 'html', entry + '.html')
-            if os.path.exists(path):
-                break
+        path = os.path.join(os.getenv('GRASS_ADDON_BASE'), 'docs', 'html', entry + '.html')
     
     if not os.path.exists(path):
         grass.fatal(_("No HTML manual page entry for <%s>") % entry)



More information about the grass-commit mailing list