[GRASS-SVN] r65194 - in grass/branches/releasebranch_7_0: lib/init mswindows mswindows/osgeo4w scripts/g.manual
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue May 5 01:30:59 PDT 2015
Author: martinl
Date: 2015-05-05 01:30:59 -0700 (Tue, 05 May 2015)
New Revision: 65194
Modified:
grass/branches/releasebranch_7_0/lib/init/grass.py
grass/branches/releasebranch_7_0/mswindows/env.bat
grass/branches/releasebranch_7_0/mswindows/osgeo4w/env.bat.tmpl
grass/branches/releasebranch_7_0/scripts/g.manual/g.manual.py
Log:
g.manual: use webbrowser package (fix g.manual on Windows)
(merge r65179:65180)
Modified: grass/branches/releasebranch_7_0/lib/init/grass.py
===================================================================
--- grass/branches/releasebranch_7_0/lib/init/grass.py 2015-05-04 19:29:42 UTC (rev 65193)
+++ grass/branches/releasebranch_7_0/lib/init/grass.py 2015-05-05 08:30:59 UTC (rev 65194)
@@ -475,8 +475,9 @@
browser = gfile('etc', "html_browser_mac.sh")
os.environ['GRASS_HTML_BROWSER_MACOSX'] = "-b com.apple.helpviewer"
- if windows or cygwin:
- # MinGW startup moved to into init.bat
+ if windows:
+ browser = "start"
+ elif cygwin:
browser = "explorer"
else:
# the usual suspects
Modified: grass/branches/releasebranch_7_0/mswindows/env.bat
===================================================================
--- grass/branches/releasebranch_7_0/mswindows/env.bat 2015-05-04 19:29:42 UTC (rev 65193)
+++ grass/branches/releasebranch_7_0/mswindows/env.bat 2015-05-05 08:30:59 UTC (rev 65194)
@@ -6,8 +6,6 @@
REM To enable bash prompt please uncomment the line bellow
REM set GRASS_SH=%GISBASE%\msys\bin\sh.exe
-set GRASS_HTML_BROWSER=explorer
-
set GRASS_PYTHON=%GISBASE%\extrabin\python.exe
set PYTHONHOME=%GISBASE%\Python27
Modified: grass/branches/releasebranch_7_0/mswindows/osgeo4w/env.bat.tmpl
===================================================================
--- grass/branches/releasebranch_7_0/mswindows/osgeo4w/env.bat.tmpl 2015-05-04 19:29:42 UTC (rev 65193)
+++ grass/branches/releasebranch_7_0/mswindows/osgeo4w/env.bat.tmpl 2015-05-05 08:30:59 UTC (rev 65194)
@@ -7,8 +7,6 @@
REM To enable bash prompt please uncomment the line bellow
REM set GRASS_SH=%OSGEO4W_ROOT%\apps\msys\bin\sh.exe
-set GRASS_HTML_BROWSER=explorer
-
set GRASS_PYTHON=%OSGEO4W_ROOT%\bin\python.exe
set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27
Modified: grass/branches/releasebranch_7_0/scripts/g.manual/g.manual.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/g.manual/g.manual.py 2015-05-04 19:29:42 UTC (rev 65193)
+++ grass/branches/releasebranch_7_0/scripts/g.manual/g.manual.py 2015-05-05 08:30:59 UTC (rev 65194)
@@ -6,7 +6,7 @@
# AUTHOR(S): Markus Neteler
# Converted to Python by Glynn Clements
# PURPOSE: Display the HTML/MAN pages
-# COPYRIGHT: (C) 2003, 2008, 2010-2012 by the GRASS Development Team
+# COPYRIGHT: (C) 2003-2015 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
@@ -49,12 +49,15 @@
import sys
import os
import urllib
+import webbrowser
from grass.script.utils import basename
from grass.script import core as grass
def start_browser(entry):
- if browser != 'xdg-open' and not grass.find_program(browser):
+ if browser and \
+ browser not in ('xdg-open', 'start') and \
+ not grass.find_program(browser):
grass.fatal(_("Browser '%s' not found") % browser)
if flags['o']:
@@ -72,16 +75,19 @@
url_path = 'file://' + path
+ if browser and browser not in ('xdg-open', 'start'):
+ webbrowser.register(browser_name, None)
+
grass.verbose(_("Starting browser '%(browser)s' for manual"
- " entry '%(entry)s'...")
- % dict(browser=browser_name, entry=entry))
-
+ " entry '%(entry)s'...") % \
+ dict(browser=browser_name, entry=entry))
+
try:
- os.execlp(browser, browser_name, url_path)
- except OSError:
+ webbrowser.open(url_path)
+ except:
grass.fatal(_("Error starting browser '%(browser)s' for HTML file"
" '%(path)s'") % dict(browser=browser, path=path))
-
+
def start_man(entry):
path = os.path.join(gisbase, 'docs', 'man', 'man1', entry + '.1')
if not os.path.exists(path) and os.getenv('GRASS_ADDON_BASE'):
@@ -111,9 +117,7 @@
start = start_browser
entry = options['entry']
-
gisbase = os.environ['GISBASE']
-
browser = os.getenv('GRASS_HTML_BROWSER', '')
if sys.platform == 'darwin':
More information about the grass-commit
mailing list