[GRASS-SVN] r39664 - in grass/trunk: gem include/Make man tools

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 1 20:35:25 EST 2009


Author: glynn
Date: 2009-11-01 20:35:24 -0500 (Sun, 01 Nov 2009)
New Revision: 39664

Added:
   grass/trunk/man/build_check.py
   grass/trunk/man/build_class.py
   grass/trunk/man/build_full_index.py
   grass/trunk/man/build_html.py
   grass/trunk/man/build_index.py
   grass/trunk/man/grass_icon.png
   grass/trunk/man/grass_logo.png
   grass/trunk/man/grassdocs.css
   grass/trunk/man/grasslogo_vector.eps
   grass/trunk/man/grasslogo_vector.pdf
Removed:
   grass/trunk/tools/grass_icon.png
   grass/trunk/tools/grass_logo.png
   grass/trunk/tools/grassdocs.css
   grass/trunk/tools/grasslogo_vector.eps
   grass/trunk/tools/grasslogo_vector.pdf
Modified:
   grass/trunk/gem/Makefile
   grass/trunk/include/Make/Dir.make
   grass/trunk/include/Make/Html.make
   grass/trunk/man/Makefile
Log:
Convert tools/build_html_index.sh to Python, split into multiple scripts
Add dependency information for HTML indices
Add dependency information for linked images, CSS, etc


Modified: grass/trunk/gem/Makefile
===================================================================
--- grass/trunk/gem/Makefile	2009-11-01 22:08:12 UTC (rev 39663)
+++ grass/trunk/gem/Makefile	2009-11-02 01:35:24 UTC (rev 39664)
@@ -31,11 +31,13 @@
 	actions.o \
 	main.o
 
-default: gem
+GEM = gem$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR)$(EXE)
 
-gem: $(SRCS) $(HDRS) $(OBJS)
-	$(CC) $(OBJS) -o $@$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR) $(CFLAGS) $(CLIBS) $(LDFLAGS)
+default: $(GEM)
 
+$(GEM): $(SRCS) $(HDRS) $(OBJS)
+	$(CC) $(OBJS) -o $@ $(CFLAGS) $(CLIBS) $(LDFLAGS)
+
 %.o: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ -c $<
 
@@ -55,10 +57,13 @@
 
 main.o:	globals.h
 
-install: gem
-	strip gem$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR);
-	cp gem$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR) /usr/local/bin
+install: $(UNIX_BIN)/$(GEM)
 
+$(UNIX_BIN)/$(GEM): $(GEM)
+	$(INSTALL)  $< $@
+	strip $@
+
 clean:
-	-rm -f *.o *.bak core *~ gem$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR)
+	-rm -f *.o *.bak core *~ $(GEM)
 
+.PHONY: install

Modified: grass/trunk/include/Make/Dir.make
===================================================================
--- grass/trunk/include/Make/Dir.make	2009-11-01 22:08:12 UTC (rev 39663)
+++ grass/trunk/include/Make/Dir.make	2009-11-02 01:35:24 UTC (rev 39664)
@@ -5,6 +5,10 @@
 include $(MODULE_TOPDIR)/include/Make/Rules.make
 include $(MODULE_TOPDIR)/include/Make/Html.make
 
+# don't install *.png, *.jpg for directories
+# to prevent problems with r.out.png etc
+IMGSRC := 
+
 subdirs:
 	@list='$(SUBDIRS)'; \
 	for subdir in $$list; do \

Modified: grass/trunk/include/Make/Html.make
===================================================================
--- grass/trunk/include/Make/Html.make	2009-11-01 22:08:12 UTC (rev 39663)
+++ grass/trunk/include/Make/Html.make	2009-11-02 01:35:24 UTC (rev 39664)
@@ -9,16 +9,18 @@
 
 htmldesc = $(call run_grass,$(1) --html-description < /dev/null | grep -v '</body>\|</html>' > $(2))
 
-$(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC)
-	-test -d $(HTMLDIR) || $(MKDIR) $(HTMLDIR)
+IMGSRC := $(wildcard *.png) $(wildcard *.jpg)
+
+$(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC) | $(HTMLDIR)
 	$(GISBASE)/tools/mkhtml.sh $* > $@
-	-for file in  *.png *.jpg ; do \
-		head -n 1 $$file | grep '^\#!' > /dev/null ; \
-		if [ $$? -ne 0 ] ; then \
-		   $(INSTALL_DATA) $$file $(HTMLDIR) ; \
-		fi \
-		done 2> /dev/null ; true
+	$(MAKE) $(patsubst %,$(HTMLDIR)/%,$(IMGSRC))
 
+$(HTMLDIR)/%.png: %.png | $(HTMLDIR)
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/%.jpg: %.jpg | $(HTMLDIR)
+	$(INSTALL_DATA) $< $@
+
 $(MANDIR)/%.$(MANSECT): $(HTMLDIR)/%.html
 	$(HTML2MAN) $< $@
 

Modified: grass/trunk/man/Makefile
===================================================================
--- grass/trunk/man/Makefile	2009-11-01 22:08:12 UTC (rev 39663)
+++ grass/trunk/man/Makefile	2009-11-02 01:35:24 UTC (rev 39664)
@@ -4,10 +4,96 @@
 
 MANPAGES = $(patsubst $(HTMLDIR)/%.html,$(MANDIR)/%.$(MANSECT),$(wildcard $(HTMLDIR)/*.html))
 
-default: indices
+GEM_PNG := $(wildcard ../gem/docs/GEM-Manual/*.png)
+GEM_HTML := $(wildcard ../gem/docs/GEM-Manual/*.html)
+GEM_DST := $(patsubst ../gem/docs/GEM-Manual/%,$(HTMLDIR)/gem/%,$(GEM_PNG) $(GEM_HTML))
+
+DSTFILES := \
+	$(HTMLDIR)/grassdocs.css \
+	$(HTMLDIR)/grass_logo.png \
+	$(HTMLDIR)/nviz/grassdocs.css \
+	$(HTMLDIR)/nviz/grass_logo.png \
+	$(HTMLDIR)/nviz/grass_icon.png \
+	$(GEM_DST)
+
+IDXSRC = full_index index \
+	display database general imagery misc postscript raster raster3D vector
+INDICES := $(patsubst %,$(HTMLDIR)/%.html,$(IDXSRC))
+
+default: $(DSTFILES)
+	@echo "Generating HTML manual pages index (help system)..."
+	$(MAKE) $(INDICES)
+	$(call build,check)
+	$(MAKE) manpages
+
+# This must be a separate target so that evaluation of $(MANPAGES)
+# is delayed until the indices have been generated
+manpages:
 	$(MAKE) $(MANPAGES)
 
-indices:
-	cd ../tools && \
-	GISBASE="$(GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
-	sh build_html_index.sh
+.PHONY: manpages
+
+define build
+GISBASE="$(GISBASE)" ARCH="$(ARCH)" ARCH_DISTDIR="$(ARCH_DISTDIR)" \
+	$(PYTHON) ./build_$(1).py $(2)
+endef
+
+$(HTMLDIR)/full_index.html: $(wildcard $(HTMLDIR)/*.*.html)
+	$(call build,full_index)
+
+$(HTMLDIR)/index.html:
+	$(call build,index)
+
+$(HTMLDIR)/display.html: $(wildcard $(HTMLDIR)/d.*.html)
+	$(call build,class,d display)
+
+$(HTMLDIR)/database.html: $(wildcard $(HTMLDIR)/db.*.html)
+	$(call build,class,db database)
+
+$(HTMLDIR)/general.html: $(wildcard $(HTMLDIR)/g.*.html)
+	$(call build,class,g general)
+
+$(HTMLDIR)/imagery.html: $(wildcard $(HTMLDIR)/i.*.html)
+	$(call build,class,i imagery)
+
+$(HTMLDIR)/misc.html: $(wildcard $(HTMLDIR)/m.*.html)
+	$(call build,class,m misc)
+
+$(HTMLDIR)/postscript.html: $(wildcard $(HTMLDIR)/ps.*.html)
+	$(call build,class,ps postscript)
+
+$(HTMLDIR)/raster.html: $(wildcard $(HTMLDIR)/r.*.html)
+	$(call build,class,r raster)
+
+$(HTMLDIR)/raster3D.html: $(wildcard $(HTMLDIR)/r3.*.html)
+	$(call build,class,r3 raster3D)
+
+$(HTMLDIR)/vector.html: $(wildcard $(HTMLDIR)/v.*.html)
+	$(call build,class,v vector)
+
+$(HTMLDIR)/grassdocs.css: grassdocs.css
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/nviz/grassdocs.css: grassdocs.css | $(HTMLDIR)/nviz
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/grass_logo.png: grass_logo.png
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/nviz/grass_logo.png: grass_logo.png | $(HTMLDIR)/nviz
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/nviz/grass_icon.png: grass_icon.png | $(HTMLDIR)/nviz
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/gem/%.png: ../gem/docs/GEM-Manual/%.png | $(HTMLDIR)/gem
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/gem/%.html: ../gem/docs/GEM-Manual/%.html | $(HTMLDIR)/gem
+	$(INSTALL_DATA) $< $@
+
+$(HTMLDIR)/nviz:
+	$(MKDIR) $@
+
+$(HTMLDIR)/gem:
+	$(MKDIR) $@

Added: grass/trunk/man/build_check.py
===================================================================
--- grass/trunk/man/build_check.py	                        (rev 0)
+++ grass/trunk/man/build_check.py	2009-11-02 01:35:24 UTC (rev 39664)
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+# checks for HTML files missing DESCRIPTION section
+# (c) The GRASS Development Team, Markus Neteler, Glynn Clements 2003, 2004, 2005, 2006, 2009
+
+import sys
+import os
+import string
+
+from build_html import *
+
+os.chdir(html_dir)
+
+sys.stdout.write(message_tmpl.substitute(html_dir = html_dir))
+
+for cmd in html_files('*'):
+    if "DESCRIPTION" not in read_file(cmd):
+	sys.stdout.write("%s\n" % cmd[:-5])
+
+sys.stdout.write(r"""
+----------------------------------------------------------------------
+""")

Added: grass/trunk/man/build_class.py
===================================================================
--- grass/trunk/man/build_class.py	                        (rev 0)
+++ grass/trunk/man/build_class.py	2009-11-02 01:35:24 UTC (rev 39664)
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+# generates HTML man pages docs/html/<category>.html
+# (c) The GRASS Development Team, Markus Neteler, Glynn Clements 2003, 2004, 2005, 2006, 2009
+
+import sys
+import os
+import string
+
+from build_html import *
+
+os.chdir(html_dir)
+
+#write separate module pages:
+
+#for all module groups:
+cls = sys.argv[1]
+modclass = sys.argv[2]
+
+filename = modclass + ".html"
+
+f = open(filename + ".tmp", 'wb')
+
+write_html_header(f, "GRASS GIS %s Reference Manual: %s" % (grass_version, modclass))
+f.write(modclass_tmpl.substitute(modclass = modclass))
+
+#for all modules:
+for cmd in html_files(cls):
+    basename = os.path.splitext(cmd)[0]
+    desc = check_for_desc_override(basename)
+    if desc is None:
+        desc = get_desc(cmd)
+    f.write(desc2_tmpl.substitute(cmd = cmd,
+    			      basename = basename,
+    			      desc = desc))
+f.write("</table>\n")
+
+write_html_footer(f, "index.html")
+
+f.close()
+replace_file(filename)
+

Added: grass/trunk/man/build_full_index.py
===================================================================
--- grass/trunk/man/build_full_index.py	                        (rev 0)
+++ grass/trunk/man/build_full_index.py	2009-11-02 01:35:24 UTC (rev 39664)
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+# generates docs/html/full_index.html
+# (c) The GRASS Development Team, Markus Neteler, Glynn Clements 2003, 2004, 2005, 2006, 2009
+
+import sys
+import os
+import string
+
+from build_html import *
+
+os.chdir(html_dir)
+
+classes = []
+for cmd in html_files('*'):
+    prefix = cmd.split('.')[0]
+    if prefix not in classes:
+	classes.append(prefix)
+classes.sort()
+
+#begin full index:
+filename = "full_index.html"
+f = open(filename + ".tmp", 'wb')
+
+write_html_header(f, "GRASS GIS %s Reference Manual: Full index" % grass_version)
+
+#generate main index of all modules:
+f.write(full_index_header)
+#"
+
+for cls in classes:
+    f.write(cmd1_tmpl.substitute(cmd = cls))
+    if cls != classes[-1]:
+	f.write(" | ")
+
+f.write(sections)
+
+#for all module groups:
+for cls in classes:
+    f.write(cmd2_tmpl.substitute(cmd = cls))
+    #for all modules:  
+    for cmd in html_files(cls):
+	basename = os.path.splitext(cmd)[0]
+	desc = check_for_desc_override(basename)
+	if desc is None:
+	    desc = get_desc(cmd)
+	f.write(desc1_tmpl.substitute(cmd = cmd,
+				      basename = basename,
+				      desc = desc))
+    f.write("</table>\n")
+
+write_html_footer(f, "index.html")
+
+f.close()
+replace_file(filename)
+
+# done full index
+

Added: grass/trunk/man/build_html.py
===================================================================
--- grass/trunk/man/build_html.py	                        (rev 0)
+++ grass/trunk/man/build_html.py	2009-11-02 01:35:24 UTC (rev 39664)
@@ -0,0 +1,339 @@
+#!/usr/bin/env python
+
+# utilities for generating HTML indices
+# (c) The GRASS Development Team, Markus Neteler, Glynn Clements 2003, 2004, 2005, 2006, 2009
+
+import sys
+import os
+import string
+
+## TODO: better fix this in include/Make/Html.make, see bug RT #5361
+
+# exclude following list of modules from help index:
+
+exclude_mods = [
+    "i.find",
+    "r.watershed.ram",
+    "r.watershed.seg",
+    "v.topo.check",
+    "helptext.html"]
+
+# these modules don't use G_parser()
+
+desc_override = {
+    "g.parser": "Provides automated parser, GUI, and help support for GRASS scipts.",
+    "r.li.daemon": "Support module for r.li landscape index calculations."
+    }
+
+############################################################################
+
+header1_tmpl = string.Template(\
+r"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <title>${title}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="Author" content="GRASS Development Team">
+""")
+
+macosx_tmpl = string.Template(\
+r"""
+ <meta name="AppleTitle" content="GRASS GIS ${grass_version} Help">
+ <meta name="AppleIcon" content="GRASS-${grass_mmver}/grass_icon.png">
+ <meta name="robots" content="anchors">
+""")
+
+header2_tmpl = string.Template(\
+r""" <link rel="stylesheet" href="grassdocs.css" type="text/css">
+</head>
+<body bgcolor="#FFFFFF">
+
+<!-- this file is generated by tools/build_html_index.sh -->
+
+<img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
+
+<h2>GRASS GIS ${grass_version} Reference Manual</h2>
+
+<p><b>Geographic Resources Analysis Support System</b>, commonly
+referred to as <a href="http://grass.osgeo.org">GRASS</a>, is a <a
+href="http://en.wikipedia.org/wiki/Geographic_information_system">Geographic
+Information System</a> (GIS) used for geospatial data management and
+analysis, image processing, graphics/maps production, spatial
+modeling, and visualization. GRASS is currently used in academic and
+commercial settings around the world, as well as by many governmental
+agencies and environmental consulting companies.</p>
+
+<p>This reference manual details the use of modules distributed with
+Geographic Resources Analysis Support System (GRASS), an open source (GNU
+GPLed), image processing and geographic information system (GIS).</p>
+
+""")
+#"
+
+overview_tmpl = string.Template(\
+r"""<!-- the files grass7.html & helptext.html file live in lib/init/ -->
+
+<table align="center" border="0" cellspacing="8">
+  <tbody>
+    <tr>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Quick Introduction</h3>
+      <ul>
+      <li><a href="grass6.html">GRASS startup manual page</a></li>
+      <li><a href="helptext.html">How to start with GRASS</a></li>
+      </ul></td>
+
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;General</h3>
+      <ul>
+      <li><a href="general.html">General commands manual</a></li>
+      </ul></td>
+    </tr>
+    <tr>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Raster/Image processing</h3>
+
+       <ul>
+        <li><a href="rasterintro.html">Intro 2D raster map processing</a></li>
+        <li><a href="raster.html">Raster commands manual</a></li>
+        <li><a href="raster3dintro.html">Intro 3D raster map (voxel) processing</a></li>
+        <li><a href="raster3D.html">Raster3D commands manual</a></li>
+      </ul></td>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Vector processing</h3>
+
+       <ul>
+        <li><a href="vectorintro.html">Intro vector map processing and network analysis</a></li>
+        <li><a href="vector.html">Vector commands manual</a></li>
+       </ul></td>
+    </tr>
+    <tr>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Display/Graphical User Interfaces</h3>
+
+       <ul>
+        <li><a href="wxGUI.html">wxGUI</a> wxPython-based GUI frontend</li>
+       </ul>
+
+       <ul>
+        <li><a href="display.html">Display commands manual</a></li>
+        <li><a href="displaydrivers.html">Display drivers</a></li>
+       </ul>
+
+       <ul>
+        <li><a href="nviz.html">nviz</a> 3D visualization and animation tool</li>
+        <li><a href="xganim.html">xganim</a> tool  for animating a raster map series</li>
+       </ul></td>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Database</h3>
+
+       <ul>
+       <li><a href="databaseintro.html">Intro database management</a></li>
+       <li><a href="sql.html">SQL support in GRASS GIS</a></li>
+       <li><a href="database.html">Database commands manual</a></li>
+       </ul></td>
+    </tr>
+    <tr>
+
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Projections</h3>
+       <ul>
+        <li><a href="projectionintro.html">Intro projections and spatial transformations</a></li>
+       </ul></td>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Miscellaneous</h3>
+       <ul>
+        <li><a href="variables.html">GRASS variables and environment variables</a></li>
+
+        <li><a href="gem/index.html">The GRASS Extensions Manager (GEM)</a></li>
+        <li><a href="misc.html">Misc. commands manual</a></li>
+       </ul></td>
+    </tr>
+    <tr>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Image processing</h3>
+       <ul>
+
+        <li><a href="imageryintro.html">Intro image processing</a></li>
+        <li><a href="imagery.html">Imagery commands manual</a></li>
+      </ul></td>
+      <td valign="top" bgcolor="${box_color}" class="box"><h3>&nbsp;Printing</h3>
+       <ul>
+        <li><a href="postscript.html">Postscript commands manual</a></li>
+       </ul></td>
+
+    </tr>
+  </tbody>
+</table>
+""")
+#"
+
+footer_tmpl = string.Template(\
+r"""<BR><BR>
+<hr>
+<p><a href="${index_url}">Help Index</a> | <a href="full_index.html">Full Index</a><br>
+&copy; 2003-2009 <a href="http://grass.osgeo.org">GRASS Development Team</a></p>
+</body>
+</html>
+""")
+#"
+
+cmd1_tmpl = string.Template(\
+r"""<b><a href="#${cmd}">${cmd}.*</a></b>""")
+#"
+
+cmd2_tmpl = string.Template(\
+r"""<a name="${cmd}"></a>
+<BR><BR><h3>${cmd}.* commands:</h3>
+<table>
+""")
+#"
+
+desc1_tmpl = string.Template(\
+r"""<tr><td valign="top"><a href="${cmd}">${basename}</a></td> <td>${desc}</td></tr>
+""")
+#"
+
+sections = \
+r""" ]
+<BR><BR>
+
+<table border=0>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#d">d.*</a> </td><td>display commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#db">db.*</a> </td><td>database commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#g">g.*</a> </td><td>general commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#i">i.*</a> </td><td>imagery commands</td></tr>
+
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#m">m.*</a> </td><td>miscellaneous commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#ps">ps.*</a> </td><td>postscript commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#r">r.*</a> </td><td>raster commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#r3">r3.*</a> </td><td>raster3D commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="full_index.html#v">v.*</a> </td><td>vector commands</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="nviz.html">nviz</a> </td><td>visualization suite</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="wxGUI.html">wxGUI</a> </td><td>wxPython-based GUI frontend</td></tr>
+<tr><td>&nbsp;&nbsp;<a href="xganim.html">xganim</a> </td><td>raster map slideshow</td></tr>
+</table>
+"""
+#"
+
+modclass_tmpl = string.Template(\
+r"""Go <a href="index.html">back to help overview</a><BR><BR><BR>
+<b>${modclass} commands:</b>
+<table>
+""")
+#"
+
+desc2_tmpl = string.Template(\
+r"""<tr><td valign="top"><a href="${cmd}">${basename}</a></td> <td>${desc}</td></tr>
+""")
+#"
+
+
+full_index_header = \
+r"""Go <a href="index.html">back to help overview</a><BR>
+<BR><h3>Full command index:</h3>
+[ 
+"""
+#"
+
+gem_ext_marker = r"""
+<!-- GEM Extensions StartHTML. Do not delete or change this comment! -->
+
+"""
+#"
+
+message_tmpl = string.Template(\
+r"""Generated HTML docs in ${html_dir}/index.html
+----------------------------------------------------------------------
+Following modules are missing the 'description.html' file in src code:
+""")
+#"
+
+############################################################################
+
+def check_for_desc_override(basename):
+    return desc_override.get(basename)
+
+def read_file(name):
+    f = open(name, 'rb')
+    s = f.read()
+    f.close()
+    return s
+
+def write_file(name, contents):
+    f = open(name, 'wb')
+    f.write(contents)
+    f.close()
+
+def try_mkdir(path):
+    try:
+	os.mkdir(path)
+    except OSError, e:
+	pass
+
+def replace_file(name):
+    temp = name + ".tmp"
+    if os.path.exists(name) and os.path.exists(temp) and read_file(name) == read_file(temp):
+	os.remove(temp)
+    else:
+	try:
+	    os.remove(name)
+	except OSError, e:
+	    pass
+	os.rename(temp, name)
+
+def copy_file(src, dst):
+    write_file(dst, read_file(src))
+
+def html_files(cls = None):
+    for cmd in sorted(os.listdir(html_dir)):
+	if cmd.endswith(".html") and \
+	   (cls in [None, '*'] or cmd.startswith(cls + ".")) and \
+	   (cls != '*' or len(cmd.split('.')) >= 3) and \
+	   cmd not in ["full_index.html", "index.html"] and \
+	   cmd not in exclude_mods and \
+	   not cmd.startswith("wxGUI."):
+	    yield cmd
+
+def write_html_header(f, title, ismain = False):
+    f.write(header1_tmpl.substitute(title = title))
+    if ismain and macosx:
+	f.write(macosx_tmpl.substitute(grass_version = grass_version,
+				       grass_mmver = grass_mmver))
+    f.write(header2_tmpl.substitute(grass_version = grass_version))
+
+def write_html_cmd_overview(f):
+    box_color = "#e1ecd0"
+    f.write(overview_tmpl.substitute(box_color = box_color))
+
+def write_html_footer(f, index_url):
+    f.write(footer_tmpl.substitute(index_url = index_url))
+
+def get_desc(cmd):
+    f = open(cmd, 'r')
+    while True:
+	line = f.readline()
+	if not line:
+	    return ""
+	if "NAME" in line:
+	    break
+
+    while True:
+	line = f.readline()
+	if not line:
+	    return ""
+	if "SYNOPSIS" in line:
+	    break
+	if "<em>" in line:
+	    sp = line.split('-',1)
+	    if len(sp) > 1:
+		return sp[1].strip()
+	    else:
+		return None
+
+    return ""
+
+############################################################################
+
+gem_dir = os.path.join("..", "gem")
+arch_dist_dir = os.environ['ARCH_DISTDIR']
+html_dir = os.path.join(arch_dist_dir, "docs", "html")
+gisbase = os.environ['GISBASE']
+ver = read_file(os.path.join(gisbase, "etc", "VERSIONNUMBER"))
+grass_version = ver.strip()
+grass_mmver = '.'.join(ver.split('.')[0:2])
+macosx = "darwin" in os.environ['ARCH'].lower()
+
+############################################################################
+

Added: grass/trunk/man/build_index.py
===================================================================
--- grass/trunk/man/build_index.py	                        (rev 0)
+++ grass/trunk/man/build_index.py	2009-11-02 01:35:24 UTC (rev 39664)
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# generates docs/html/index.html
+# (c) The GRASS Development Team, Markus Neteler, Glynn Clements 2003, 2004, 2005, 2006, 2009
+
+import sys
+import os
+import string
+
+from build_html import *
+
+os.chdir(html_dir)
+
+filename = "index.html"
+f = open(filename + ".tmp", 'wb')
+
+write_html_header(f, "GRASS GIS %s Reference Manual" % grass_version, True)
+write_html_cmd_overview(f)
+
+f.write(gem_ext_marker)
+
+write_html_footer(f, "index.html")
+
+f.close()
+replace_file(filename)
+

Copied: grass/trunk/man/grass_icon.png (from rev 39655, grass/trunk/tools/grass_icon.png)
===================================================================
(Binary files differ)

Copied: grass/trunk/man/grass_logo.png (from rev 39655, grass/trunk/tools/grass_logo.png)
===================================================================
(Binary files differ)

Copied: grass/trunk/man/grassdocs.css (from rev 39655, grass/trunk/tools/grassdocs.css)
===================================================================
--- grass/trunk/man/grassdocs.css	                        (rev 0)
+++ grass/trunk/man/grassdocs.css	2009-11-02 01:35:24 UTC (rev 39664)
@@ -0,0 +1,71 @@
+/* GRASS documentation site style sheet
+ * (copied by 'tools/build_html_index.sh')
+ *
+ * send improvements to GRASS Developers list
+ * 
+ *  (eg how to reach the same result on netscape, mozilla konqueror?)
+ *
+ * Fonts:
+ *	http://www.w3.org/TR/REC-CSS2/fonts.html
+ * Tables:
+ *	http://www.w3.org/TR/REC-CSS2/tables.html
+ */
+
+BODY{	background: white;
+	color: black;
+	font-family: arial,sans-serif;
+}
+
+H1{	background-color: white;
+	color: rgb(25%, 60%, 25%);
+	font-family: arial,sans-serif;
+	font-weight: bold;
+	font-size: x-large;
+}
+
+H2{	background-color: white;
+	color: rgb(25%, 60%, 25%);
+	font-family: arial,sans-serif;
+	font-weight: bold;
+	font-size: large;
+}
+
+H3{	background-color: white;
+	color: rgb(25%, 60%, 25%);
+	font-family: arial,sans-serif;
+	font-weight: bold;
+	font-size: large;
+}
+
+H4{	background-color: white;
+	color: rgb(25%, 60%, 25%);
+	font-family: arial,sans-serif;
+	font-weight: bold;
+	font-size: medium;
+}
+
+DIV.code{	width: 95%;
+		color : black;
+		background-color: rgb(90%, 90%, 90%);
+		padding-left: 1em;
+		padding-right: 1em;
+}
+
+SPAN.code{	width: 95%;
+		color : black;
+		background-color: rgb(90%, 90%, 90%);
+		padding-left: 1em;
+		padding-right: 1em;
+}
+
+.leftmenu {
+	padding-left: 10px;
+}
+
+.BOX {
+	border:  1px solid #c9c9c9;
+	margin: 0px 2px 2px 10px;
+	padding: 0px 4px 2px 6px;
+	-moz-border-radius: 6px ;
+}
+

Copied: grass/trunk/man/grasslogo_vector.eps (from rev 39655, grass/trunk/tools/grasslogo_vector.eps)
===================================================================
(Binary files differ)

Copied: grass/trunk/man/grasslogo_vector.pdf (from rev 39655, grass/trunk/tools/grasslogo_vector.pdf)
===================================================================
(Binary files differ)

Deleted: grass/trunk/tools/grass_icon.png
===================================================================
(Binary files differ)

Deleted: grass/trunk/tools/grass_logo.png
===================================================================
(Binary files differ)

Deleted: grass/trunk/tools/grassdocs.css
===================================================================
--- grass/trunk/tools/grassdocs.css	2009-11-01 22:08:12 UTC (rev 39663)
+++ grass/trunk/tools/grassdocs.css	2009-11-02 01:35:24 UTC (rev 39664)
@@ -1,71 +0,0 @@
-/* GRASS documentation site style sheet
- * (copied by 'tools/build_html_index.sh')
- *
- * send improvements to GRASS Developers list
- * 
- *  (eg how to reach the same result on netscape, mozilla konqueror?)
- *
- * Fonts:
- *	http://www.w3.org/TR/REC-CSS2/fonts.html
- * Tables:
- *	http://www.w3.org/TR/REC-CSS2/tables.html
- */
-
-BODY{	background: white;
-	color: black;
-	font-family: arial,sans-serif;
-}
-
-H1{	background-color: white;
-	color: rgb(25%, 60%, 25%);
-	font-family: arial,sans-serif;
-	font-weight: bold;
-	font-size: x-large;
-}
-
-H2{	background-color: white;
-	color: rgb(25%, 60%, 25%);
-	font-family: arial,sans-serif;
-	font-weight: bold;
-	font-size: large;
-}
-
-H3{	background-color: white;
-	color: rgb(25%, 60%, 25%);
-	font-family: arial,sans-serif;
-	font-weight: bold;
-	font-size: large;
-}
-
-H4{	background-color: white;
-	color: rgb(25%, 60%, 25%);
-	font-family: arial,sans-serif;
-	font-weight: bold;
-	font-size: medium;
-}
-
-DIV.code{	width: 95%;
-		color : black;
-		background-color: rgb(90%, 90%, 90%);
-		padding-left: 1em;
-		padding-right: 1em;
-}
-
-SPAN.code{	width: 95%;
-		color : black;
-		background-color: rgb(90%, 90%, 90%);
-		padding-left: 1em;
-		padding-right: 1em;
-}
-
-.leftmenu {
-	padding-left: 10px;
-}
-
-.BOX {
-	border:  1px solid #c9c9c9;
-	margin: 0px 2px 2px 10px;
-	padding: 0px 4px 2px 6px;
-	-moz-border-radius: 6px ;
-}
-

Deleted: grass/trunk/tools/grasslogo_vector.eps
===================================================================
(Binary files differ)

Deleted: grass/trunk/tools/grasslogo_vector.pdf
===================================================================
(Binary files differ)



More information about the grass-commit mailing list