[GRASS-SVN] r37873 - grass/trunk/lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 13 22:27:48 EDT 2009
Author: glynn
Date: 2009-06-13 22:27:48 -0400 (Sat, 13 Jun 2009)
New Revision: 37873
Modified:
grass/trunk/lib/init/Makefile
grass/trunk/lib/init/grass.py
Log:
Windows fixes
Handle missing ~/.grassrc7
Call wxgui.py, not wxgui shell script
Modified: grass/trunk/lib/init/Makefile
===================================================================
--- grass/trunk/lib/init/Makefile 2009-06-14 01:36:35 UTC (rev 37872)
+++ grass/trunk/lib/init/Makefile 2009-06-14 02:27:48 UTC (rev 37873)
@@ -31,7 +31,6 @@
FILES = \
$(ARCH_BINDIR)/$(START_UP).sh \
- $(ARCH_BINDIR)/$(START_UP) \
$(ETC)/Init.sh \
$(ETC)/functions.sh \
$(ETC)/prompt.sh \
@@ -55,8 +54,13 @@
ifneq ($(strip $(MINGW)),)
FILES += \
+ $(ARCH_BINDIR)/$(START_UP).py \
$(ARCH_BINDIR)/$(START_UP).bat \
$(ETC)/Init.bat
+else
+ FILES += \
+ $(ARCH_BINDIR)/$(START_UP)
+
endif
default: $(FILES)
@@ -75,10 +79,14 @@
sed -e 's#GISBASE_VALUE#$(RUN_GISBASE)#' $< | tr '/' '\\' > $@
chmod a+x $@
+ifneq ($(strip $(MINGW)),)
+$(ARCH_BINDIR)/$(START_UP).py: grass.py
+else
$(ARCH_BINDIR)/$(START_UP): grass.py
+endif
rm -f $@
sed \
- -e 's#@GISBASE@#$(GISBASE)#' \
+ -e 's#@GISBASE@#$(RUN_GISBASE)#' \
-e 's#@GRASS_VERSION_NUMBER@#$(GRASS_VERSION_NUMBER)#' \
-e 's#@LD_LIBRARY_PATH_VAR@#$(LD_LIBRARY_PATH_VAR)#' \
-e 's#@START_UP@#$(START_UP)#' \
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2009-06-14 01:36:35 UTC (rev 37872)
+++ grass/trunk/lib/init/grass.py 2009-06-14 02:27:48 UTC (rev 37873)
@@ -37,6 +37,8 @@
ld_library_path_var = '@LD_LIBRARY_PATH_VAR@'
config_projshare = "@CONFIG_PROJSHARE@"
+gisbase = os.path.normpath(gisbase)
+
tmpdir = None
lockfile = None
location = None
@@ -190,13 +192,17 @@
# not set. So we check if it is not set
if not grass_gui:
# Check for a reference to the GRASS user interface in the grassrc file
- kv = read_gisrc()
- if 'GRASS_GUI' not in kv:
- # Set the GRASS user interface to the default if needed
- grass_gui = default_gui
+ if os.access(gisrc, os.R_OK):
+ kv = read_gisrc()
+ if 'GRASS_GUI' not in kv:
+ # Set the GRASS user interface to the default if needed
+ grass_gui = default_gui
else:
grass_gui = kv['GRASS_GUI']
+ if not grass_gui:
+ grass_gui = default_gui
+
if grass_gui == 'gui':
grass_gui = default_gui
@@ -270,7 +276,7 @@
# GRASS_PYTHON
if not os.getenv('GRASS_PYTHON'):
if windows:
- os.environ['GRASS_PYTHON'] = "pythonw.exe"
+ os.environ['GRASS_PYTHON'] = "python.exe"
else:
os.environ['GRASS_PYTHON'] = "python"
@@ -319,8 +325,11 @@
os.environ['GRASS_HTML_BROWSER'] = browser
def grass_intro():
- path = gfile("locale", locale, "etc", "grass_intro")
- if not os.access(path, os.R_OK):
+ if locale:
+ path = gfile("locale", locale, "etc", "grass_intro")
+ if not os.access(path, os.R_OK):
+ path = gfile("etc", "grass_intro")
+ else:
path = gfile("etc", "grass_intro")
f = open(path, 'r')
for line in f:
@@ -582,7 +591,7 @@
# Check for gui interface
if grass_gui == "wxpython":
- call([gfile("etc", "wxpython", "scripts", "wxgui")])
+ call([gfile("etc", "wxpython", "wxgui.py")])
def clear_screen():
if windows:
@@ -801,6 +810,10 @@
# Set GISBASE
os.environ['GISBASE'] = gisbase
+# set HOME
+if windows and not os.getenv('HOME'):
+ os.environ['HOME'] = os.path.join(os.getenv('HOMEDRIVE'), os.getenv('HOMEPATH'))
+
atexit.register(cleanup)
# Set default GUI
More information about the grass-commit
mailing list