From: g0dil Date: Thu, 25 Jan 2007 23:34:48 +0000 (+0000) Subject: Fix relative pathname handling in Doxyfiles X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=f11bb3f5a7eeb232a74d13b7d7ddc6746ca2c2d2;p=senf.git Fix relative pathname handling in Doxyfiles git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@186 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/Doxyfile b/Doxyfile index 59fb6de..8b758e1 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1,14 +1,9 @@ +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" + PROJECT_NAME = Overview PROJECT_NUMBER = "(Revision $(REVISION), generated $(TODAY))" -OUTPUT_DIRECTORY = doc -INPUT = . -FILE_PATTERNS = *.dox -IMAGE_PATH = . EXAMPLE_PATH = Sniffer -HTML_HEADER = doclib/doxy-header-overview.html -HTML_FOOTER = doclib/doxy-footer.html -GENERATE_LATEX = NO -GENERATE_MAN = NO -@INCLUDE = "Doxyfile.local" +HTML_HEADER = doclib/doxy-header-overview.html +GENERATE_XML = NO diff --git a/Mainpage.dox b/Mainpage.dox index 2ded007..02fc964 100644 --- a/Mainpage.dox +++ b/Mainpage.dox @@ -65,6 +65,7 @@ \li Doxygen (http://www.doxygen.org) \li The \c dia diagram editor (http://www.gnome.org/projects/dia/) + \li \The c xsltproc XSLT processor (http://xmlsoft.org/XSLT/xsltproc2.html) The library is only tested with gcc-3.4 and 4.0 on Linux. On other @@ -251,8 +252,8 @@ \section new_conf Configuring SENFSCons To set up the build environment, copy the - senfscons/SConstruct.template to Satscons in the - project root. The default setup of this file is to build all + senfscons/SConstruct.template to SConstruct in + the project root. The default setup of this file is to build all subdirectories (using the \c SConscript files of the subdirectories). You can add additonal global targets and configuration parameters here. diff --git a/Packets/Doxyfile b/Packets/Doxyfile index 95d25b4..2e7c41a 100644 --- a/Packets/Doxyfile +++ b/Packets/Doxyfile @@ -1,5 +1,5 @@ -@INCLUDE = ../doclib/Doxyfile.global +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" PROJECT_NAME = libPackets -TAGFILES = ../Utils/doc/Utils.tag +TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" GENERATE_TAGFILE = doc/Packets.tag \ No newline at end of file diff --git a/SConstruct b/SConstruct index 7946269..a2a3eba 100644 --- a/SConstruct +++ b/SConstruct @@ -1,11 +1,17 @@ # -*- python -*- -import sys, glob, os.path +import sys, glob, os.path, datetime sys.path.append('senfscons') import SENFSCons ########################################################################### +svninfo = dict( + [ tuple(map(lambda y:y.strip(),x.split(":",1))) + for x in os.popen("svn info").read().split("\n") + if ':' in x ] ) +svninfo['commited'] = not(os.popen("svn status").read()) + SENFSCons.UseBoost() SENFSCons.UseSTLPort() env = SENFSCons.MakeEnvironment() @@ -15,19 +21,9 @@ env.Append( LIBS = [ 'iberty' ], DOXY_XREF_TYPES = [ 'bug', 'fixme', 'todo', 'idea' ], DOXY_HTML_XSL = '#/doclib/html-munge.xsl', -) - -import datetime - -svninfo = dict( - [ tuple(map(lambda y:y.strip(),x.split(":",1))) - for x in os.popen("svn info").read().split("\n") - if ':' in x ] ) -svninfo['commited'] = not(os.popen("svn status").read()) - -env.Append( - ENV = { 'TODAY' : datetime.date.today(), - 'REVISION' : svninfo['Revision'] + (not(svninfo['commited']) and " + local changes" or "") } + ENV = { 'TODAY' : str(datetime.date.today()), + 'REVISION' : svninfo['Revision'] + (not(svninfo['commited']) and " + local changes" or ""), + }, ) Export('env') diff --git a/Scheduler/Doxyfile b/Scheduler/Doxyfile index 157f808..38eada5 100644 --- a/Scheduler/Doxyfile +++ b/Scheduler/Doxyfile @@ -1,5 +1,5 @@ -@INCLUDE = ../doclib/Doxyfile.global +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" PROJECT_NAME = libScheduler -TAGFILES = ../Utils/doc/Utils.tag +TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" GENERATE_TAGFILE = doc/Scheduler.tag diff --git a/Socket/Doxyfile b/Socket/Doxyfile index 1a5a548..76ad2bb 100644 --- a/Socket/Doxyfile +++ b/Socket/Doxyfile @@ -1,6 +1,6 @@ -@INCLUDE = ../doclib/Doxyfile.global +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" PROJECT_NAME = libSocket -TAGFILES = ../Utils/doc/Utils.tag +TAGFILES = "$(TOPDIR)/Utils/doc/Utils.tag" GENERATE_TAGFILE = doc/Socket.tag diff --git a/Utils/Doxyfile b/Utils/Doxyfile index 414df50..b193e90 100644 --- a/Utils/Doxyfile +++ b/Utils/Doxyfile @@ -1,4 +1,4 @@ -@INCLUDE = ../doclib/Doxyfile.global +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" PROJECT_NAME = libUtils GENERATE_TAGFILE = doc/Utils.tag diff --git a/doclib/Doxyfile.global b/doclib/Doxyfile.global index d2b544d..2e80589 100644 --- a/doclib/Doxyfile.global +++ b/doclib/Doxyfile.global @@ -1,7 +1,7 @@ OUTPUT_DIRECTORY = doc INPUT = . FILE_PATTERNS = *.c *.cc *.cci *.ct *.cti *.h *.hh *.ih *.mmc *.dox -EXCLUDE_PATTERNS = *.test.cc *.test.hh .* +EXCLUDE_PATTERNS = *.test.cc *.test.hh .* *~ "#*#" IMAGE_PATH = . ALIASES = "fixme=\xrefitem fixme \"Fix\" \"Fixmes\"" \ @@ -25,8 +25,8 @@ EXPAND_ONLY_PREDEF = YES PREDEFINED = DOXYGEN EXPAND_AS_DEFINED = prefix_ -HTML_HEADER = ../doclib/doxy-header.html -HTML_FOOTER = ../doclib/doxy-footer.html +HTML_HEADER = "$(TOPDIR)/doclib/doxy-header.html" +HTML_FOOTER = "$(TOPDIR)/doclib/doxy-footer.html" GENERATE_LATEX = NO GENERATE_MAN = NO GENERATE_XML = YES @@ -42,4 +42,4 @@ MAX_DOT_GRAPH_HEIGHT = 1200 MAX_DOT_GRAPH_DEPTH = 3 DOT_MULTI_TARGETS = YES -@INCLUDE = "../Doxyfile.local" +@INCLUDE = "$(TOPDIR)/Doxyfile.local" diff --git a/senfscons/Doxyfile b/senfscons/Doxyfile index b244b64..a3f0a5e 100644 --- a/senfscons/Doxyfile +++ b/senfscons/Doxyfile @@ -1,4 +1,3 @@ -@INCLUDE = ../doclib/Doxyfile.global +@INCLUDE = "$(TOPDIR)/doclib/Doxyfile.global" PROJECT_NAME = SENFSCons -PROJECT_NUMBER = "Version 0.0.1" diff --git a/senfscons/Doxygen.py b/senfscons/Doxygen.py index 9e8f1c6..f422aac 100644 --- a/senfscons/Doxygen.py +++ b/senfscons/Doxygen.py @@ -45,18 +45,23 @@ import os, sys, traceback import os.path -import glob +import glob, re from fnmatch import fnmatch -def DoxyfileParse(file): - data = DoxyfileParse_(file,{}) - for (k,v) in data.items(): +EnvVar = re.compile(r"\$\(([0-9A-Za-z_-]+)\)") + +def DoxyfileParse(env,file): + ENV = {} + ENV.update(env.get("ENV",{})) + ENV['TOPDIR'] = env.Dir('#').abspath + data = DoxyfileParse_(file,{},ENV) + for k,v in data.items(): if not v : del data[k] elif k in ("INPUT", "FILE_PATTERNS", "EXCLUDE_PATTERNS", "@INCLUDE", "TAGFILES") : continue elif len(v)==1 : data[k] = v[0] return data -def DoxyfileParse_(file, data): +def DoxyfileParse_(file, data, ENV): """ Parse a Doxygen source file and return a dictionary of all the values. Values will be strings and lists of strings. @@ -66,7 +71,7 @@ def DoxyfileParse_(file, data): import shlex lex = shlex.shlex(instream=open(file), posix=True) - lex.wordchars += "*+./-:@~" + lex.wordchars += "*+./-:@~$()" lex.whitespace = lex.whitespace.replace("\n", "") lex.escape = "\\" @@ -100,12 +105,13 @@ def DoxyfileParse_(file, data): elif token == "=": data[key] = [] else: + token = EnvVar.sub(lambda m,ENV=ENV: str(ENV.get(m.group(1),"")),token) append_data(data, key, new_data, token) new_data = True if key=='@INCLUDE': inc = os.path.join(dir,data['@INCLUDE'][-1]) if os.path.exists(inc) : - DoxyfileParse_(inc,data) + DoxyfileParse_(inc,data,ENV) last_token = token token = lex.get_token() @@ -140,7 +146,7 @@ def DoxySourceScan(node, env, path): sources = [] basedir = node.dir.abspath - data = DoxyfileParse(node.abspath) + data = DoxyfileParse(env, node.abspath) recursive = data.get("RECURSIVE", "NO").upper()=="YES" file_patterns = data.get("FILE_PATTERNS", default_file_patterns) exclude_patterns = data.get("EXCLUDE_PATTERNS", default_exclude_patterns) @@ -186,7 +192,7 @@ def DoxyEmitter(source, target, env): "XML" : ("NO", "xml"), } - data = DoxyfileParse(source[0].abspath) + data = DoxyfileParse(env, source[0].abspath) targets = [] if data.has_key("OUTPUT_DIRECTORY"): @@ -215,9 +221,9 @@ def DoxyEmitter(source, target, env): return (targets, source) -def doxyNodeHtmlDir(node): +def doxyNodeHtmlDir(env,node): if not node.sources : return None - data = DoxyfileParse(node.sources[0].abspath) + data = DoxyfileParse(env, node.sources[0].abspath) if data.get("GENERATE_HTML",'YES').upper() != 'YES' : return None return os.path.normpath(os.path.join( node.sources[0].dir.abspath, data.get("OUTPUT_DIRECTORY","."), @@ -237,9 +243,10 @@ def relpath(source, target): def DoxyGenerator(source, target, env, for_signature): - data = DoxyfileParse(source[0].abspath) + data = DoxyfileParse(env, source[0].abspath) - actions = [ env.Action("cd ${SOURCE.dir} && ${DOXYGEN} ${SOURCE.file}") ] + actions = [ env.Action("cd ${SOURCE.dir} && TOPDIR=%s ${DOXYGEN} ${SOURCE.file}" + % (relpath(source[0].dir.abspath, env.Dir('#').abspath),)) ] # This will add automatic 'installdox' calls. # @@ -269,6 +276,7 @@ def DoxyGenerator(source, target, env, for_signature): url = env.get(os.path.splitext(os.path.basename(tagfile))[0].upper()+"_DOXY_URL", None) if not url: url = doxyNodeHtmlDir( + env, env.File(os.path.normpath(os.path.join(str(source[0].dir), tagfile)))) if url : url = relpath(output_dir, url) if not url: