[GRASS-SVN] r49715 - grass/branches/develbranch_6/gui/scripts
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 13 08:52:25 EST 2011
Author: martinl
Date: 2011-12-13 05:52:25 -0800 (Tue, 13 Dec 2011)
New Revision: 49715
Modified:
grass/branches/develbranch_6/gui/scripts/g.extension.py
Log:
wxGUI/g.extension.py: sync with trunk
Modified: grass/branches/develbranch_6/gui/scripts/g.extension.py
===================================================================
--- grass/branches/develbranch_6/gui/scripts/g.extension.py 2011-12-13 13:48:02 UTC (rev 49714)
+++ grass/branches/develbranch_6/gui/scripts/g.extension.py 2011-12-13 13:52:25 UTC (rev 49715)
@@ -271,9 +271,9 @@
fo.close()
except HTTPError:
grass.fatal(_("GRASS Addons <%s> not found") % options['extension'])
+
+ return 0
- grass.message(_("Installation of <%s> successfully finished.") % options['extension'])
-
# install extension
def install_extension():
gisbase = os.getenv('GISBASE')
@@ -284,10 +284,15 @@
grass.warning(_("Extension <%s> already installed. Will be updated...") % options['extension'])
if sys.platform == "win32":
- install_extension_win()
+ ret = install_extension_win()
else:
- install_extension_other()
+ ret = install_extension_other()
+ if ret != 0:
+ grass.warning(_('Installation failed, sorry. Please check above error messages.'))
+ else:
+ grass.message(_("Installation of <%s> successfully finished") % options['extension'])
+
# cleanup build cruft
if not flags['s']:
tidy_citizen()
@@ -296,30 +301,6 @@
not os.environ['GRASS_ADDON_PATH']:
grass.warning(_('This add-on module will not function until you set the '
'GRASS_ADDON_PATH environment variable (see "g.manual variables")'))
-
- # manual page: fix href
- if os.getenv('GRASS_ADDON_PATH'):
- html_man = os.path.join(os.getenv('GRASS_ADDON_PATH'), 'docs', 'html', 'description.html')
- if os.path.exists(html_man):
- fd = open(html_man)
- html_str = '\n'.join(fd.readlines())
- fd.close()
- for rep in ('grassdocs.css', 'grass_logo.png'):
- patt = re.compile(rep, re.IGNORECASE)
- html_str = patt.sub(os.path.join(gisbase, 'docs', 'html', rep),
- html_str)
-
- patt = re.compile(r'(<a href=")(d|db|g|i|m|p|ps|r|r3|s|v|wxGUI)(\.)(.+)(.html">)', re.IGNORECASE)
- while True:
- m = patt.search(html_str)
- if not m:
- break
- html_str = patt.sub(m.group(1) + os.path.join(gisbase, 'docs', 'html',
- m.group(2) + m.group(3) + m.group(4)) + m.group(5),
- html_str, count = 1)
- fd = open(html_man, "w")
- fd.write(html_str)
- fd.close()
# install extension on other plaforms
def install_extension_other():
@@ -398,14 +379,9 @@
grass.message(_("Installing <%s>...") % options['extension'])
- ret = grass.call(installCmd,
- stdout = outdev)
-
- if ret != 0:
- grass.warning(_('Installation failed, sorry. Please check above error messages.'))
- else:
- grass.message(_("Installation of <%s> successfully finished.") % options['extension'])
-
+ return grass.call(installCmd,
+ stdout = outdev)
+
# remove dir if empty
def remove_empty_dir(path):
if os.path.exists(path) and not os.listdir(path):
@@ -524,20 +500,17 @@
# check links in CSS
def check_style_files(fil):
- # check the links to grassdocs.css/grass_logo.png to a correct manual page of addons
- dist_file = os.path.join(os.getenv('GISBASE'), 'docs', 'html', fil)
+ dist_file = os.path.join(os.getenv('GISBASE'), 'docs', 'html', fil)
addons_file = os.path.join(options['prefix'], 'docs', 'html', fil)
- # check if file already exists in the grass addons docs html path
+
if os.path.isfile(addons_file):
return
- # otherwise copy the file from $GISBASE/docs/html, it doesn't use link
- # because os.symlink it work only in Linux
- else:
- try:
- shutil.copyfile(dist_file,addons_file)
- except OSError, e:
- grass.fatal(_("Unable to create '%s': %s") % (addons_file, e))
-
+
+ try:
+ shutil.copyfile(dist_file,addons_file)
+ except OSError, e:
+ grass.fatal(_("Unable to create '%s': %s") % (addons_file, e))
+
def create_dir(path):
if os.path.isdir(path):
return
More information about the grass-commit
mailing list