Browse Source

partly re-introduce https://trac.osgeo.org/grass/changeset/65307 (see https://trac.osgeo.org/grass/changeset/65584)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65585 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 years ago
parent
commit
c7eadfe21f
1 changed files with 7 additions and 5 deletions
  1. 7 5
      lib/init/grass.py

+ 7 - 5
lib/init/grass.py

@@ -1443,11 +1443,13 @@ PROMPT_COMMAND=grass_prompt\n""" % (_("2D and 3D raster MASKs present"),
                                     _("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