Browse Source

GRASS_ADDON_BASE should be single alternative GISBASE

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49913 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
350032a3d2

+ 8 - 6
gui/wxpython/core/globalvar.py

@@ -144,11 +144,13 @@ def GetGRASSCmds(scriptsOnly = False):
         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 @@ def GetGRASSCmds(scriptsOnly = False):
                     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)

+ 2 - 3
lib/init/grass.py

@@ -331,9 +331,8 @@ def set_paths():
     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')

+ 2 - 3
lib/init/grass7.html

@@ -155,11 +155,10 @@ search paths to include locally installed
 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

+ 2 - 4
macosx/app/grass.sh.in

@@ -46,10 +46,8 @@ export PATH
 
 # 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
 

+ 2 - 7
scripts/g.extension/g.extension.py

@@ -692,13 +692,8 @@ def main():
                             "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()

+ 1 - 4
scripts/g.manual/g.manual.py

@@ -46,10 +46,7 @@ def start_browser(entry):
     
     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)