[GRASS-SVN] r66912 - grass/trunk/lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 24 07:42:25 PST 2015
Author: martinl
Date: 2015-11-24 07:42:25 -0800 (Tue, 24 Nov 2015)
New Revision: 66912
Modified:
grass/trunk/lib/init/grass.py
Log:
grass.py: fix initialization script when gis_set.py is not available, explain to the user how to solve this issue
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2015-11-24 13:40:04 UTC (rev 66911)
+++ grass/trunk/lib/init/grass.py 2015-11-24 15:42:25 UTC (rev 66912)
@@ -921,6 +921,10 @@
The gisrc (GRASS environment file) is written at the end.
"""
+ if not os.path.exists(wxpath("gis_set.py")) and grass_gui != 'text':
+ debug("No GUI available, switching to text mode")
+ return False
+
# Check for text interface
if grass_gui == 'text':
# TODO: maybe this should be removed and solved from outside
@@ -935,6 +939,7 @@
fatal(_("Invalid user interface specified - <%s>. "
"Use the --help option to see valid interface names.") % grass_gui)
+ return True
def gui_startup(grass_gui):
"""Start GUI for startup (setting gisrc file)"""
@@ -1340,7 +1345,7 @@
"""
# Start the chosen GUI but ignore text
debug("GRASS GUI should be <%s>" % grass_gui)
-
+
# Check for gui interface
if grass_gui == "wxpython":
Popen([os.getenv('GRASS_PYTHON'), wxpath("wxgui.py")])
@@ -1820,7 +1825,11 @@
if not params.mapset:
# Try interactive startup
# User selects LOCATION and MAPSET if not set
- set_mapset_interactive(grass_gui)
+ if not set_mapset_interactive(grass_gui):
+ # No GUI available, update gisrc file
+ fatal(_("<{}> requested, but not available. Run GRASS in text "
+ "mode (-text) or install missing package (usually "
+ "'grass-gui').").format(grass_gui))
else:
# Try non-interactive start up
if params.create_new and params.geofile:
@@ -1846,10 +1855,9 @@
cleaner.mapset_path = mapset_settings.full_mapset
# check and create .gislock file
- cleaner.lockfile = lock_mapset(
- mapset_settings.full_mapset, user=user,
- force_gislock_removal=params.force_gislock_removal,
- grass_gui=grass_gui)
+ cleaner.lockfile = lock_mapset(mapset_settings.full_mapset, user=user,
+ force_gislock_removal=params.force_gislock_removal,
+ grass_gui=grass_gui)
# build user fontcap if specified but not present
make_fontcap()
More information about the grass-commit
mailing list