[GRASS-dev] [GRASS-SVN] r61051 - grass/trunk/lib/init
Huidae Cho
grass4u at gmail.com
Fri Jul 4 12:02:06 PDT 2014
Martin,
Please explain why we need this change. It breaks custom PS1 and aliases in
$HOME/.grass7/bashrc.
Thank you.
Huidae
On Sun, Jun 29, 2014 at 6:22 AM, <svn_grass at osgeo.org> wrote:
> Author: martinl
> Date: 2014-06-29 03:22:23 -0700 (Sun, 29 Jun 2014)
> New Revision: 61051
>
> Modified:
> grass/trunk/lib/init/grass.py
> Log:
> grass.py: do not override already set GRASS environmental variables
>
> Modified: grass/trunk/lib/init/grass.py
> ===================================================================
> --- grass/trunk/lib/init/grass.py 2014-06-29 10:07:13 UTC (rev 61050)
> +++ grass/trunk/lib/init/grass.py 2014-06-29 10:22:23 UTC (rev 61051)
> @@ -746,7 +746,17 @@
> k, v = map(lambda x: x.strip(), line.strip().split(' ',
> 1)[1].split('=', 1))
> except:
> continue
> - os.environ[k] = v
> +
> + 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
> +
> # Allow for mixed ISIS-GRASS Environment
> if os.getenv('ISISROOT'):
> isis = os.getenv('ISISROOT')
> @@ -1131,8 +1141,14 @@
> 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 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))
> + # if os.access(grass_env_file, os.R_OK):
> + # 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
>
> _______________________________________________
> grass-commit mailing list
> grass-commit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-commit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20140704/cac38dc7/attachment.html>
More information about the grass-dev
mailing list