[GRASS-SVN] r39872 - in grass/trunk: general/g.gui gui/wxpython gui/wxpython/docs include/Make lib/init macosx/app mswindows

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 2 18:29:24 EST 2009


Author: martinl
Date: 2009-12-02 18:29:23 -0500 (Wed, 02 Dec 2009)
New Revision: 39872

Modified:
   grass/trunk/general/g.gui/g.gui.html
   grass/trunk/gui/wxpython/README
   grass/trunk/gui/wxpython/docs/wxGUI.html
   grass/trunk/gui/wxpython/gis_set.py
   grass/trunk/include/Make/Platform.make.in
   grass/trunk/lib/init/Makefile
   grass/trunk/lib/init/grass.bat
   grass/trunk/lib/init/grass.py
   grass/trunk/lib/init/grass7.html
   grass/trunk/lib/init/init.bat
   grass/trunk/lib/init/init.sh
   grass/trunk/lib/init/variables.html
   grass/trunk/macosx/app/grass.sh.in
   grass/trunk/mswindows/GRASS-Installer.nsi
Log:
first steps towards config dir (.grass7)


Modified: grass/trunk/general/g.gui/g.gui.html
===================================================================
--- grass/trunk/general/g.gui/g.gui.html	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/general/g.gui/g.gui.html	2009-12-02 23:29:23 UTC (rev 39872)
@@ -24,10 +24,11 @@
 
 Valid values for GRASS_GUI are <tt>text</tt> and <tt>wxpython</tt>.
 
-<em>g.gisenv</em> variables are stored in the user's home directory
-in a hidden file called "<TT>.grassrc7</TT>". They are not shell environment
-variables and the "rc" file is not a classic UNIX run command file,
-it just contains persistent GRASS variables and is not executed.
+<em>g.gisenv</em> variables are stored in the user's home directory in
+a hidden file called "<tt>.grass7/rc</tt>". They are not shell
+environment variables and the "rc" file is not a classic UNIX run
+command file, it just contains persistent GRASS variables and is not
+executed.
 
 
 <h2>SEE ALSO</h2>

Modified: grass/trunk/gui/wxpython/README
===================================================================
--- grass/trunk/gui/wxpython/README	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/gui/wxpython/README	2009-12-02 23:29:23 UTC (rev 39872)
@@ -56,7 +56,7 @@
 2 - STARTUP WITH GRASS INITIALIZATION
 
 If you want to launch wxPython GUI automatically when you start
-GRASS, edit your .grassrc7 file to replace
+GRASS, edit your .grass7/rc file to replace
 
 GRASS_GUI: tcltk (or whatever you have here)
 

Modified: grass/trunk/gui/wxpython/docs/wxGUI.html
===================================================================
--- grass/trunk/gui/wxpython/docs/wxGUI.html	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/gui/wxpython/docs/wxGUI.html	2009-12-02 23:29:23 UTC (rev 39872)
@@ -11,7 +11,7 @@
    g.gui -u wxpython& 
 </pre></div>
 
-or define in your <tt>.grassrc6</tt> file 'GRASS_GUI' variable
+or define in your <tt>.grass7/rc</tt> file 'GRASS_GUI' variable
 
 <div class="code"><pre>
     GRASS_GUI: wxpython

Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/gui/wxpython/gis_set.py	2009-12-02 23:29:23 UTC (rev 39872)
@@ -366,10 +366,8 @@
         self.Layout()
 
     def _read_grassrc(self):
+        """!Read variables from $HOME/.grass7/rc file
         """
-        Read variables from $HOME/.grassrc7 file
-        """
-
         grassrc = {}
 
         gisrc = os.getenv("GISRC")

Modified: grass/trunk/include/Make/Platform.make.in
===================================================================
--- grass/trunk/include/Make/Platform.make.in	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/include/Make/Platform.make.in	2009-12-02 23:29:23 UTC (rev 39872)
@@ -43,6 +43,8 @@
 GRASS_HOME          = @GRASS_HOME@
 RUN_GISBASE         = @GISBASE@
 
+GRASS_CONFIG_DIR    = .grass7
+
 GRASS_VERSION_MAJOR = @GRASS_VERSION_MAJOR@
 GRASS_VERSION_MINOR = @GRASS_VERSION_MINOR@
 GRASS_VERSION_RELEASE = @GRASS_VERSION_RELEASE@

Modified: grass/trunk/lib/init/Makefile
===================================================================
--- grass/trunk/lib/init/Makefile	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/Makefile	2009-12-02 23:29:23 UTC (rev 39872)
@@ -91,6 +91,7 @@
 	-e 's#@LD_LIBRARY_PATH_VAR@#$(LD_LIBRARY_PATH_VAR)#' \
 	-e 's#@START_UP@#$(START_UP)#' \
 	-e 's#@CONFIG_PROJSHARE@#$(PROJSHARE)#' \
+	-e 's#@GRASS_CONFIG_DIR@#$(GRASS_CONFIG_DIR)#' \
 	$< > $@
 	chmod +x $@
 
@@ -101,6 +102,7 @@
 	-e 's#@LD_LIBRARY_PATH_VAR@#$(LD_LIBRARY_PATH_VAR)#g' \
 	-e 's#@START_UP@#$(START_UP)#' \
 	-e 's#@CONFIG_PROJSHARE@#$(PROJSHARE)#' \
+	-e 's#@GRASS_CONFIG_DIR@#$(GRASS_CONFIG_DIR)#' \
 	$< > $@
 	chmod +x $@
 
@@ -109,6 +111,7 @@
 	sed \
 	-e 's#GRASS_VERSION_NUMBER#$(GRASS_VERSION_NUMBER)#' \
 	-e 's#CONFIG_PROJSHARE#$(PROJSHARE)#' \
+	-e 's#@GRASS_CONFIG_DIR@#$(GRASS_CONFIG_DIR)#' \
 	$< > $@
 	chmod +x $@
 

Modified: grass/trunk/lib/init/grass.bat
===================================================================
--- grass/trunk/lib/init/grass.bat	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/grass.bat	2009-12-02 23:29:23 UTC (rev 39872)
@@ -8,7 +8,7 @@
 rem *******Environment variables***********
 rem Uncomment and set the following values if they differ from the indicated default
 
-rem Directory where your .grassrc7 file will be stored
+rem Directory where your .grass7/rc file will be stored
 rem set HOME=%USERPROFILE%
 
 rem Name of the wish (Tk) executable

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/grass.py	2009-12-02 23:29:23 UTC (rev 39872)
@@ -36,6 +36,7 @@
 grass_version = "@GRASS_VERSION_NUMBER@"
 ld_library_path_var = '@LD_LIBRARY_PATH_VAR@'
 config_projshare = "@CONFIG_PROJSHARE@"
+grass_config_dir = os.path.join(os.getenv('HOME'), "@GRASS_CONFIG_DIR@")
 
 gisbase = os.path.normpath(gisbase)
 
@@ -840,11 +841,11 @@
 # Set the global grassrc file
 batch_job = os.getenv('GRASS_BATCH_JOB')
 if batch_job:
-    gisrcrc = os.path.join(os.getenv('HOME'), ".grassrc7.%s" % os.uname()[1])
+    gisrcrc = os.path.join(grass_config_dir, "rc.%s" % os.uname()[1])
     if not os.access(gisrcrc, os.R_OK):
-	gisrcrc = os.path.join(os.getenv('HOME'), ".grassrc7")
+	gisrcrc = os.path.join(grass_config_dir, "rc")
 else:
-    gisrcrc = os.path.join(os.getenv('HOME'), ".grassrc7")
+    gisrcrc = os.path.join(grass_config_dir, "rc")
 
 # Set the username and working directory
 get_username()
@@ -948,6 +949,8 @@
 
 # Save GISRC
 s = readfile(gisrc)
+if not os.path.exists(grass_config_dir):
+    os.mkdir(grass_config_dir)
 writefile(gisrcrc, s)
 
 cleanup()

Modified: grass/trunk/lib/init/grass7.html
===================================================================
--- grass/trunk/lib/init/grass7.html	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/grass7.html	2009-12-02 23:29:23 UTC (rev 39872)
@@ -108,7 +108,7 @@
 
 <P>
 In addition to these shell environment variables GRASS maintains a number of
-GIS environment variables in the <tt>$HOME/.grassrc7</tt> file. User changes
+GIS environment variables in the <tt>$HOME/.grass7/rc</tt> file. User changes
 to this file will be read during the next startup of GRASS. If this file
 becomes corrupted the user may edit it by hand or remove it to start afresh.
 See the list of <a href=variables.html>implemented GRASS variables</a> for
@@ -122,7 +122,7 @@
 The <EM>grass70</EM> program will check for the existence of an environment
 variable called GRASS_GUI which indicates the type of user interface for
 GRASS to use. If this variable is not set when <EM>grass70</EM> is run, then
-it will be created and then saved in the <tt>$HOME/.grassrc7</tt> file for
+it will be created and then saved in the <tt>$HOME/.grass7/rc</tt> file for
 the next time GRASS is run. It can be set to "text" or "wxpython".
 
 <P>
@@ -134,7 +134,7 @@
  <DT><B>Interface precedence</B>
  <DD>&bull; Command line argument<BR>
      &bull; Environment variable GRASS_GUI<BR>
-     &bull; Value set in <tt>$HOME/.grassrc7</tt><BR>
+     &bull; Value set in <tt>$HOME/.grass7/rc</tt><BR>
      &bull; Default value - wxpython
 </DL>
 

Modified: grass/trunk/lib/init/init.bat
===================================================================
--- grass/trunk/lib/init/init.bat	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/init.bat	2009-12-02 23:29:23 UTC (rev 39872)
@@ -30,7 +30,7 @@
 
 set GRASS_VERSION=GRASS_VERSION_NUMBER
 if "%HOME%"=="" set HOME=%USERPROFILE%
-set WINGISRC=%HOME%\.grassrc7
+set WINGISRC=%HOME%\.grass7\rc
 rem Make sure %GISRC% is set so g.dirseps will work
 rem (not actually used)
 set GISRC=junk

Modified: grass/trunk/lib/init/init.sh
===================================================================
--- grass/trunk/lib/init/init.sh	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/init.sh	2009-12-02 23:29:23 UTC (rev 39872)
@@ -14,7 +14,7 @@
 #   	    	command line options for setting the GISDBASE, LOCATION, and/or
 #   	    	MAPSET. Finally it starts GRASS with the appropriate user
 #   	    	interface and cleans up after it is finished.
-# COPYRIGHT:    (C) 2000 by the GRASS Development Team
+# COPYRIGHT:    (C) 2000-2009 by the GRASS Development Team
 #
 #               This program is free software under the GNU General Public
 #   	    	License (>=v2). Read the file COPYING that comes with GRASS
@@ -67,12 +67,12 @@
 
 # Set the global grassrc file
 if [ -n "$GRASS_BATCH_JOB" ] ; then
-	GISRCRC="$HOME/.grassrc7.`uname -n`"
+	GISRCRC="$HOME/$GRASS_CONFIG_DIR/rc.`uname -n`"
 	if [ ! -f "$GISRCRC" ] ; then
-		GISRCRC="$HOME/.grassrc7"
+		GISRCRC="$HOME/$GRASS_CONGIG_DIR/rc"
 	fi
 else
-	GISRCRC="$HOME/.grassrc7"
+	GISRCRC="$HOME/$GRASS_CONFIG_DIR/rc"
 fi
 
 # Set PATH to GRASS bin, ETC to GRASS etc

Modified: grass/trunk/lib/init/variables.html
===================================================================
--- grass/trunk/lib/init/variables.html	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/lib/init/variables.html	2009-12-02 23:29:23 UTC (rev 39872)
@@ -75,7 +75,7 @@
 <h2>Setting GRASS variables</h2>
 
 Use <em><a href="g.gisenv.html">g.gisenv</a></em> within GRASS. This permanently
-predefines GRASS variables in the <tt>.grassrc7</tt> file.
+predefines GRASS variables in the <tt>.grass7/rc</tt> file.
 <br><br>
 Usage:
 <div class="code"><pre>
@@ -106,7 +106,7 @@
     startup script.</dd>
   
   <dt>GISRC</dt>
-  <dd>name of <tt>.grassrc7</tt> file. Defines the system wide value
+  <dd>name of <tt>.grass7/rc</tt> file. Defines the system wide value
     while in a GRASS session.</dd>
   
   <dt>GRASS_ADDON_PATH</dt>
@@ -532,7 +532,7 @@
 <h2>GRASS-related Files</h2>
 
 <dl>
-  <dt>$HOME/.grassrc7</dt>
+  <dt>$HOME/.grass7/rc</dt>
   <dd>stores the GRASS variables (but not environment variables)</dd>
   
   <dt>$HOME/.grasslogin7</dt>

Modified: grass/trunk/macosx/app/grass.sh.in
===================================================================
--- grass/trunk/macosx/app/grass.sh.in	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/macosx/app/grass.sh.in	2009-12-02 23:29:23 UTC (rev 39872)
@@ -205,7 +205,7 @@
 
 # if grassrc has text startup, switch back to Terminal (gotta duplicate some init.sh stuff)
 # only applies to Tiger - Leopard X11 opens automatically as needed
-GRASSRC="$HOME/.grassrc7"
+GRASSRC="$HOME/$GRASS_CONFIG_DIR/rc"
 if [ ! "$GRASS_GUI" ] ; then
 	if [ -f "$GRASSRC" ] ; then
 		GRASS_GUI=`awk '/GRASS_GUI/ {print $2}' "$GRASSRC"`

Modified: grass/trunk/mswindows/GRASS-Installer.nsi
===================================================================
--- grass/trunk/mswindows/GRASS-Installer.nsi	2009-12-02 02:53:38 UTC (rev 39871)
+++ grass/trunk/mswindows/GRASS-Installer.nsi	2009-12-02 23:29:23 UTC (rev 39872)
@@ -544,7 +544,7 @@
 	FileWrite $0 'rem Set GRASS Installation Directory Variable$\r$\n'
 	FileWrite $0 'set GRASSDIR=$INSTALL_DIR$\r$\n'
 	FileWrite $0 '$\r$\n'
-	FileWrite $0 'rem Directory where your .grassrc6 file will be stored$\r$\n'
+	FileWrite $0 'rem Directory where your .grass7\rc file will be stored$\r$\n'
 	FileWrite $0 'set HOME=%USERPROFILE%$\r$\n'
 	FileWrite $0 '$\r$\n'
 	FileWrite $0 'rem Name of the wish (Tk) executable$\r$\n'	
@@ -700,18 +700,19 @@
 	;replace \ with / in $GIS_DATABASE
 	${StrReplace} "$UNIX_LIKE_GIS_DATABASE_PATH" "\" "/" "$GIS_DATABASE"
   
-	;create $PROFILE\.grassrc6
+	;create $PROFILE\.grass7
+	;create $PROFILE\.grass7\rc
 	SetShellVarContext current
 	ClearErrors
-	FileOpen $0 $PROFILE\.grassrc6 w
-	IfErrors done_create_.grassrc6
+	FileOpen $0 $PROFILE\.grass7\rc w
+	IfErrors done_create_.grass7\rc
 	FileWrite $0 'GISDBASE: $UNIX_LIKE_GIS_DATABASE_PATH$\r$\n'
 	FileWrite $0 'LOCATION_NAME: demolocation$\r$\n'
 	FileWrite $0 'MAPSET: PERMANENT$\r$\n'
 	FileClose $0	
-	done_create_.grassrc6:
+	done_create_.grass7\rc:
 	
-	CopyFiles $PROFILE\.grassrc6 $INSTALL_DIR\msys\home\$USERNAME
+	CopyFiles $PROFILE\.grass7\rc $INSTALL_DIR\msys\home\$USERNAME
                  
 SectionEnd
 
@@ -852,9 +853,9 @@
 	SetShellVarContext all
 	RMDir /r "$SMPROGRAMS\${GRASS_BASE}"
 	
-	;remove the .grassrc6 file
+	;remove the .grass7\rc file
 	SetShellVarContext current
-	Delete "$PROFILE\.grassrc6"	
+	RMDir \r "$PROFILE\.grass7"
 
 	;remove the Registry Entries
 	DeleteRegKey HKLM "Software\${GRASS_BASE}"



More information about the grass-commit mailing list