Procházet zdrojové kódy

add gisenv variable - ADDON_PATH

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49907 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa před 13 roky
rodič
revize
4c7bc4dbd4
2 změnil soubory, kde provedl 14 přidání a 0 odebrání
  1. 9 0
      lib/init/grass.py
  2. 5 0
      lib/init/variables.html

+ 9 - 0
lib/init/grass.py

@@ -628,6 +628,15 @@ def load_gisrc():
     
     location = os.path.join(gisdbase, location_name, mapset)
 
+    # convert selected gisenv variables to environmental variables
+    if kv.get('ADDON_PATH'):
+        addon_path = kv.get('ADDON_PATH')
+        if os.getenv('GRASS_ADDON_PATH'):
+            os.environ['GRASS_ADDON_PATH'] += os.pathsep + addon_path
+        else:
+            os.environ['GRASS_ADDON_PATH'] = addon_path
+        path_prepend(addon_path, 'PATH')
+    
 def check_lock():
     global lockfile
     if not os.path.exists(location):

+ 5 - 0
lib/init/variables.html

@@ -423,6 +423,11 @@ g.gisenv set=DEBUG=0
     be inherited by dependent modules as the script runs. Setting either the
     GRASS_OVERWRITE environment variable or the OVERWRITE gisenv variable detailed
     below will cause maps with identical names to be overwritten.</dd>
+
+  <dt>ADDON_PATH</dt>
+  <dd>[grass startup script]<br> allows to specify additional paths to
+    local GRASS modules or user scripts extra to standard GRASS
+    distribution.</dd>
 </dl>
 
 <h2>GRASS-related Files</h2>