X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=doclib%2FSConscript;h=a16273141d9ca8b513a901e79939dc1d86b73b7b;hb=82ad2ed94c12c3e53097fef92978de8c28239fab;hp=ddaa95e59329e3bd7bbae29cd935d3a4349d603e;hpb=532dab5ed9c5a51af5736e893e9b4a1af698bac4;p=senf.git diff --git a/doclib/SConscript b/doclib/SConscript index ddaa95e..a162731 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -8,15 +8,56 @@ import SENFSCons import yaptu def modules(): + # Naja ... etwas rumgehackt aber was solls ... global EXTRA_MODULES - rv = [] - ix = len(env.Dir('#').abspath)+1 + mods = {} + pathbase = len(env.Dir('#').abspath)+1 for module in env.Alias('all_docs')[0].sources: if module.name != 'html.stamp' : continue - if not [ x for x in EXTRA_MODULES if env.Dir(x[1]).abspath == module.dir.abspath]: - rv.append(('lib%s' % module.dir.dir.dir.name, module.dir.abspath[ix:])) - rv.sort() - return [ (name, env.Dir(path).abspath[ix:]) for name,path in EXTRA_MODULES ] + rv + mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.name, + module.dir.abspath[pathbase:], + 0 ] + + rv = [] + keys = mods.keys() + keys.sort() + for mod in keys: + i = 0 + while i < len(rv): + if len(rv[i]) > pathbase and mod.startswith(rv[i] + '/'): + level = mods[rv[i]][2] + 1 + i += 1 + while i < len(rv) and mods[rv[i]][2] >= level: + i += 1 + rv[i:i] = [ mod ] + mods[mod][2] = level + break + i += 1 + if i == len(rv): + rv.append(mod) + + for mod in keys: + if mods[mod][2] == 0: + mods[mod][0] = 'lib' + mods[mod][0] + + n = 0 + for name,path in EXTRA_MODULES: + path = env.Dir(path).dir.dir.abspath + i = 0 + while i < len(rv): + if rv[i] == path: + mods[rv[i]][0] = name + m = 1 + while i+m < len(rv) and mods[rv[i+m]][2] > mods[rv[i]][2]: + m += 1 + rv[n:n] = rv[i:i+m] + rv[i+m:i+2*m] = [] + i += m + n += m + else: + i += 1 + + return ( tuple(mods[mod]) for mod in rv ) def indices(): ix = len(env.Dir('#').abspath)+1 @@ -25,7 +66,7 @@ def indices(): if doc.name == "search.idx" ] def writeTemplate(target = None, source = None, env = None): - file(target[0].abspath,"w").write(yaptu.process(env['TEMPLATE'], globals(), env.Dictionary())) + file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary())) writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ]) @@ -36,7 +77,7 @@ writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ]) EXTRA_MODULES = [ ('Overview', '#/doc/html'), ('Examples', '#/Examples/doc/html'), - ('SENFScons', '#/senfscons/doc/html') ] + ('SENFSCons', '#/senfscons/doc/html') ] HEADER = """ @@ -44,32 +85,48 @@ HEADER = """$title + """ -OVERVIEW_EXTRA_HEADER=""" -
- -
""" - SEARCH_PHP=""" """ @@ -98,32 +145,47 @@ SEARCH_PHP=""" SEARCH_PATHS_PHP="""""" -env.Command('doxy-header.html', None, writeTemplate, - TEMPLATE = HEADER, +env.Command('doxy-header.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(HEADER), TITLE = "Documentation and API reference") -env.Command('doxy-header-overview.html', None, writeTemplate, - TEMPLATE = HEADER+OVERVIEW_EXTRA_HEADER, +env.Command('doxy-header-overview.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(HEADER+OVERVIEW_EXTRA_HEADER), TITLE = "Introduction and Overview") -env.Command('doxy-footer.html', None, writeTemplate, - TEMPLATE = FOOTER) +env.Command('doxy-footer.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(FOOTER)) env.Alias('all_docs', - env.Command('search.php', 'html-munge.xsl', + env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ], [ writeTemplate, 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null' - + r'| sed -e "s/\[\[//g" > ${TARGET}.tmp', + + "| sed" + + r" -e 's/\[\[//g'" + + r" -e 's/\$$projectname/Overview/g'" + + r" -e 's/\$$title/Search results/g'" + + "> ${TARGETS[0]}.tmp", 'mv ${TARGET}.tmp ${TARGET}' ], - TEMPLATE = (HEADER - + OVERVIEW_EXTRA_HEADER - + SEARCH_PHP.replace('<','[[').replace('>',']]') - + FOOTER), + TEMPLATE = Literal(HEADER + + OVERVIEW_EXTRA_HEADER + + SEARCH_PHP.replace('',']]') + + FOOTER), TITLE = "Search results")) env.Alias('all_docs', - env.Command('search_paths.php', None, writeTemplate, - TEMPLATE = SEARCH_PATHS_PHP)) + env.Command('search_paths.php', 'SConscript', writeTemplate, + TEMPLATE = Literal(SEARCH_PATHS_PHP))) + +env.Alias('install_all', + env.Install( '$DOCINSTALLDIR/doclib', [ 'favicon.ico', + 'logo-head.png', + 'search.php', + 'search_functions.php', + 'search_paths.php', + 'senf.css' ] )) + +env.Clean('all', 'doxy-header.html') # I should not need this but I do ... +env.Clean('all_docs', 'doxy-header.html') # I should not need this but I do ...