[GRASS-SVN] r61273 - grass/trunk/lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 18 01:16:19 PDT 2014
Author: martinl
Date: 2014-07-18 01:16:19 -0700 (Fri, 18 Jul 2014)
New Revision: 61273
Modified:
grass/trunk/lib/init/grass.py
Log:
grass.py: revert "do not override already set GRASS environmental variables"
http://lists.osgeo.org/pipermail/grass-dev/2014-July/069986.html
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2014-07-18 03:43:21 UTC (rev 61272)
+++ grass/trunk/lib/init/grass.py 2014-07-18 08:16:19 UTC (rev 61273)
@@ -744,24 +744,11 @@
return
for line in readfile(grass_env_file).split(os.linesep):
- if not line.lower().startswith('export'):
- continue
-
try:
k, v = map(lambda x: x.strip(), line.strip().split(' ', 1)[1].split('=', 1))
except:
continue
-
- evalue = os.getenv(k)
- if evalue:
- if k == 'GRASS_ADDON_PATH':
- os.environ[k] = evalue + os.pathsep + v
- else:
- warning(_("Environmental variable '%s' already set, ignoring value '%s'") % \
- (k, v))
- else:
- os.environ[k] = v
-
+ os.environ[k] = v
# Allow for mixed ISIS-GRASS Environment
if os.getenv('ISISROOT'):
isis = os.getenv('ISISROOT')
@@ -1142,30 +1129,12 @@
_("Raster MASK present"),
_("3D raster MASK present")))
- # read environmental variables from GRASS 6 (left for backward
- # compatibility)
- path = os.path.join(userhome, ".grass.bashrc")
+ # 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')
-
- # write GRASS environmental variables to $LOCATION/.bashrc
- for env in os.environ.keys():
- if env.startswith('GRASS'):
- val = os.environ[env]
- if ' ' in val:
- val = '"%s"' % val
- f.write('export %s=%s\n' % (env, val))
-
- # write aliases and custom settings from grass_env_file to
- # $LOCATION/.bashrc
if os.access(grass_env_file, os.R_OK):
- for line in readfile(grass_env_file).split(os.linesep):
- if line.lower().startswith('export'):
- continue
- f.write(line + '\n')
- ### Replaced by code above (do not override already set up environment variables)
- ### if os.access(grass_env_file, os.R_OK):
- ### f.write(readfile(grass_env_file) + '\n')
+ f.write(readfile(grass_env_file) + '\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