<div dir="ltr">Martin,<div><br></div><div>Please explain why we need this change. It breaks custom PS1 and aliases in $HOME/.grass7/bashrc.</div><div><br></div><div>Thank you.</div><div>Huidae</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Jun 29, 2014 at 6:22 AM,  <span dir="ltr"><<a href="mailto:svn_grass@osgeo.org" target="_blank">svn_grass@osgeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: martinl<br>
Date: 2014-06-29 03:22:23 -0700 (Sun, 29 Jun 2014)<br>
New Revision: 61051<br>
<br>
Modified:<br>
   grass/trunk/lib/init/grass.py<br>
Log:<br>
grass.py: do not override already set GRASS environmental variables<br>
<br>
Modified: grass/trunk/lib/init/grass.py<br>
===================================================================<br>
--- grass/trunk/lib/init/grass.py       2014-06-29 10:07:13 UTC (rev 61050)<br>
+++ grass/trunk/lib/init/grass.py       2014-06-29 10:22:23 UTC (rev 61051)<br>
@@ -746,7 +746,17 @@<br>
             k, v = map(lambda x: x.strip(), line.strip().split(' ', 1)[1].split('=', 1))<br>
         except:<br>
             continue<br>
-        os.environ[k] = v<br>
+<br>
+        evalue = os.getenv(k)<br>
+        if evalue:<br>
+            if k == 'GRASS_ADDON_PATH':<br>
+                os.environ[k] = evalue + os.pathsep + v<br>
+            else:<br>
+                warning(_("Environmental variable '%s' already set, ignoring value '%s'") % \<br>
+                            (k, v))<br>
+        else:<br>
+            os.environ[k] = v<br>
+<br>
     # Allow for mixed ISIS-GRASS Environment<br>
     if os.getenv('ISISROOT'):<br>
         isis = os.getenv('ISISROOT')<br>
@@ -1131,8 +1141,14 @@<br>
     path = os.path.join(userhome, ".grass.bashrc") # left for backward compatibility<br>
     if os.access(path, os.R_OK):<br>
         f.write(readfile(path) + '\n')<br>
-    if os.access(grass_env_file, os.R_OK):<br>
-        f.write(readfile(grass_env_file) + '\n')<br>
+    for env in os.environ.keys():<br>
+        if env.startswith('GRASS'):<br>
+            val = os.environ[env]<br>
+            if ' ' in val:<br>
+                val = '"%s"' % val<br>
+            f.write('export %s=%s\n' % (env, val))<br>
+    #    if os.access(grass_env_file, os.R_OK):<br>
+    #        f.write(readfile(grass_env_file) + '\n')<br>
<br>
     f.write("export PATH=\"%s\"\n" % os.getenv('PATH'))<br>
     f.write("export HOME=\"%s\"\n" % userhome) # restore user home path<br>
<br>
_______________________________________________<br>
grass-commit mailing list<br>
<a href="mailto:grass-commit@lists.osgeo.org">grass-commit@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-commit" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-commit</a><br>
</blockquote></div><br></div>