[GRASS-SVN] r56871 - grass/trunk/scripts/g.manual
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 21 12:01:28 PDT 2013
Author: wenzeslaus
Date: 2013-06-21 12:01:28 -0700 (Fri, 21 Jun 2013)
New Revision: 56871
Modified:
grass/trunk/scripts/g.manual/g.manual.py
Log:
g.manual: execlp raises OSError on error, message standardization
Modified: grass/trunk/scripts/g.manual/g.manual.py
===================================================================
--- grass/trunk/scripts/g.manual/g.manual.py 2013-06-21 18:29:55 UTC (rev 56870)
+++ grass/trunk/scripts/g.manual/g.manual.py 2013-06-21 19:01:28 UTC (rev 56871)
@@ -47,20 +47,25 @@
def start_browser(entry):
if browser != 'xdg-open' and not grass.find_program(browser):
- grass.fatal(_("Browser <%s> not found") % browser)
+ grass.fatal(_("Browser '%s' not found") % browser)
path = os.path.join(gisbase, 'docs', 'html', entry + '.html')
if not os.path.exists(path) and os.getenv('GRASS_ADDON_BASE'):
path = os.path.join(os.getenv('GRASS_ADDON_BASE'), 'docs', 'html', entry + '.html')
if not os.path.exists(path):
- grass.fatal(_("No HTML manual page entry for <%s>") % entry)
-
- grass.verbose(_("Starting browser <%s> for module %s...") % (browser_name, entry))
-
- os.execlp(browser, browser_name, "file://%s" % (path))
- grass.fatal(_("Error starting browser <%s> for HTML file <%s>") % (browser, entry))
-
+ grass.fatal(_("No HTML manual page entry for '%s'") % entry)
+
+ grass.verbose(_("Starting browser '%(browser)s' for manual"
+ " entry '%(entry)s'...")
+ % dict(browser=browser_name, entry=entry))
+
+ try:
+ os.execlp(browser, browser_name, "file://%s" % (path))
+ except OSError:
+ 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'):
@@ -69,8 +74,8 @@
for ext in ['', '.gz', '.bz2']:
if os.path.exists(path + ext):
os.execlp('man', 'man', path + ext)
- grass.fatal(_("Error starting 'man' for <%s>") % path)
- grass.fatal(_("No manual page entry for <%s>") % entry)
+ grass.fatal(_("Error starting 'man' for '%s'") % path)
+ grass.fatal(_("No manual page entry for '%s'") % entry)
def main():
global gisbase, browser, browser_name
More information about the grass-commit
mailing list