X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FSENFSCons.py;h=a9961d60a7f2b61b5677576f74b318b371623fae;hb=aec1302f91b51edb58f8a97985ab2e0aa9c8db66;hp=34604142a6037a239f66e33daced5c1f3329f2e4;hpb=032707d24b1059febe83ce56b11fd79df106c6e2;p=senf.git diff --git a/senfscons/SENFSCons.py b/senfscons/SENFSCons.py index 3460414..a9961d6 100644 --- a/senfscons/SENFSCons.py +++ b/senfscons/SENFSCons.py @@ -9,7 +9,7 @@ SCONS_TOOLS = [ opts = None finalizers = [] -basedir = os.path.split(__file__)[0] +basedir = os.path.abspath(os.path.split(__file__)[0]) def InitOpts(): global opts @@ -147,23 +147,57 @@ def Objects(env, sources, testSources = None, LIBS = []): return objects def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []): - docs = env.Doxygen(doxyfile) + # ARGHHH !!! without the [:] we are changing the target list + # ||| WITHIN THE DOXYGEN BUILDER + docs = env.Doxygen(doxyfile)[:] + xmlnode = None + htmlnode = None + tagnode = None for doc in docs: if isinstance(doc,SCons.Node.FS.Dir): continue - if os.path.basename(str(doc)) == '.stamp' : continue # file stamp + if doc.name == 'xml.stamp' : xmlnode = doc + if doc.name == 'html.stamp' : htmlnode = doc + if os.path.splitext(doc.name)[1] == '.stamp' : continue # ignore other file stamps # otherwise it must be the tag file - break - else: - doc = None - if doc: + tagnode = doc + + if tagnode: # Postprocess the tag file to remove the (broken) namespace # references env.AddPostAction( - doc, - env.Action([ "xsltproc -o TARGET.temp %s TARGET" - % os.path.join(basedir,"tagmunge.xsl"), - "mv TARGET.temp TARGET" ])) - env.Clean(doc,"$TARGET.temp") + docs, + env.Action("xsltproc --nonet -o %(target)s.temp %(template)s %(target)s && mv %(target)s.temp %(target)s" + % { 'target': tagnode.abspath, + 'template': os.path.join(basedir,"tagmunge.xsl") })) + + if htmlnode and env.get('DOXY_HTML_XSL'): + xslfile = env.File(env['DOXY_HTML_XSL']) + env.AddPostAction( + docs, + env.Action(("for html in %s/*.html; do " + + "xsltproc --nonet --html -o $${html}.new %s $${html} && mv $${html}.new $${html}; " + + "done") + % (htmlnode.dir.abspath, xslfile.abspath))) + for doc in docs: + env.Depends(doc,xslfile) + + if xmlnode: + xrefs = [] + for type in env.get("DOXY_XREF_TYPES",[ "bug", "todo" ]): + xref = os.path.join(xmlnode.dir.abspath,type+".xml") + xref_pp = env.Command(xref+'i', [ xref, os.path.join(basedir,'xrefxtract.xslt'), xmlnode ], + [ "test -s $SOURCE && xsltproc -o $TARGET" + + " --stringparam module $MODULE" + + " --stringparam type $TYPE" + + " ${SOURCES[1]} $SOURCE || touch $TARGET" ], + MODULE = xmlnode.dir.dir.dir.name, + TYPE = type) + env.SideEffect(xref, xmlnode) + env.AddPreAction(docs, "rm -f %s" % (xref,)) + env.AddPostAction(docs, "test -r %s || touch %s" % (xref,xref)) + xrefs.extend(xref_pp) + docs.extend(xrefs) + env.Depends(docs,extra_sources) for doc in docs : env.Alias('all_docs', doc) @@ -171,41 +205,13 @@ def Doxygen(env, doxyfile = "Doxyfile", extra_sources = []): env.Clean('all', doc) return docs -def DoxyXRef(env, - TYPES = ('bug','todo'), +def DoxyXRef(env, docs=None, HTML_HEADER = None, HTML_FOOTER = None, TITLE = "Cross-reference of action points"): - # Hmm .. this looks a bit scary :-) ... - xrefis = [] - - # This iterates over all doc targets. These are all .stamp and .tag files - for node in env.Alias('all_docs')[0].sources: - # We are only interested in the xml targets. This is Doxyfile dependent :-( - if node.abspath.endswith('/xml/.stamp'): - # This is the list of xref categories - for type in TYPES: - # Here we construct the pathname of the xml file for the category - xref = os.path.join(node.dir.abspath,type+'.xml') - # And now apply the xrefxtract.xslt tempalte to it. However, we must - # only call xsltproc if the source xml file is not empty (therefore the - # 'test') - xrefi = env.Command(xref+'i', [ xref, '%s/xrefxtract.xslt' % basedir, node ], - [ "test -s $SOURCE && xsltproc -o $TARGET" + - " --stringparam module $MODULE" + - " --stringparam type $TYPE" + - " ${SOURCES[1]} $SOURCE || touch $TARGET" ], - MODULE = node.dir.dir.dir.name, - TYPE = type) - # If the xref xml file does not exist we create it here as an empty - # file since doxygen will only create it if it is non-empty. - if not env.GetOption('clean') and not os.path.exists(xref): - if not os.path.exists(node.dir.abspath): - env.Execute(SCons.Defaults.Mkdir(node.dir.abspath)) - env.Execute(SCons.Defaults.Touch(xref)) - xrefis.append(xrefi) - - # And here we can now simply combine all the xrefi files - xref = env.Command("doc/html/xref.xml", xrefis, + if docs is None: + docs = env.Alias('all_docs')[0].sources + xrefs = [ doc for doc in docs if os.path.splitext(doc.name)[1] == ".xmli" ] + xref = env.Command("doc/html/xref.xml", xrefs, [ "echo -e '\\n' >$TARGET", "cat $SOURCES >> $TARGET", "echo '' >>$TARGET" ]) @@ -225,7 +231,8 @@ def DoxyXRef(env, "sed -e 's/\\$$title/$TITLE/g' -e 's/\\$$projectname/Overview/g' ${SOURCES[%d]} >> $TARGET" % (HTML_HEADER and 3 or 2)) - xref = env.Command("doc/html/xref.html", sources, commands) + xref = env.Command("doc/html/xref.html", sources, commands, + TITLE = TITLE) env.Alias('all_docs',xref) return xref