[GRASS-SVN] r65585 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 14 05:50:24 PDT 2015


Author: martinl
Date: 2015-07-14 05:50:24 -0700 (Tue, 14 Jul 2015)
New Revision: 65585

Modified:
   grass/trunk/lib/init/grass.py
Log:
partly re-introduce r65307 (see r65584)

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2015-07-14 05:41:36 UTC (rev 65584)
+++ grass/trunk/lib/init/grass.py	2015-07-14 12:50:24 UTC (rev 65585)
@@ -1443,11 +1443,13 @@
                                     _("3D raster MASK present")))
 
     # read environmental variables
-    path = os.path.join(userhome, ".grass.bashrc") # left for backward compatibility
-    if os.access(path, os.R_OK):
-        f.write(readfile(path) + '\n')
-    if os.access(grass_env_file, os.R_OK):
-        f.write(readfile(grass_env_file) + '\n')
+    for env_file in [os.path.join(userhome, ".grass.bashrc"),
+                      grass_env_file]:
+        if not os.access(env_file, os.R_OK):
+            continue
+        for line in readfile(env_file).splitlines():
+            if not line.startswith('export'):
+                f.write(line + '\n')
     
     f.write("export PATH=\"%s\"\n" % os.getenv('PATH'))
     f.write("export HOME=\"%s\"\n" % userhome) # restore user home path



More information about the grass-commit mailing list