[GRASS-SVN] r48892 - grass/trunk/scripts/g.extension
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 21 04:39:48 EDT 2011
Author: lucadelu
Date: 2011-10-21 01:39:48 -0700 (Fri, 21 Oct 2011)
New Revision: 48892
Modified:
grass/trunk/scripts/g.extension/g.extension.py
Log:
add function to check if grass_logo.png and grassdocs.css are present on /docs/html to a correct web page style
Modified: grass/trunk/scripts/g.extension/g.extension.py
===================================================================
--- grass/trunk/scripts/g.extension/g.extension.py 2011-10-21 08:35:48 UTC (rev 48891)
+++ grass/trunk/scripts/g.extension/g.extension.py 2011-10-21 08:39:48 UTC (rev 48892)
@@ -92,6 +92,7 @@
import sys
import re
import atexit
+import shutil
import urllib
@@ -438,10 +439,27 @@
grass.fatal(_("Unable to create '%s': %s") % (path, e))
grass.debug("'%s' created" % path)
-
+
+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)
+ 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))
+
def check_dirs():
create_dir(os.path.join(options['prefix'], 'bin'))
create_dir(os.path.join(options['prefix'], 'docs', 'html'))
+ check_style_files('grass_logo.png')
+ check_style_files('grassdocs.css')
create_dir(os.path.join(options['prefix'], 'man', 'man1'))
create_dir(os.path.join(options['prefix'], 'scripts'))
More information about the grass-commit
mailing list