diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-03-28 20:22:32 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-03-28 20:22:32 (GMT) |
commit | 335d3d25e07ddcf7c00ba3b2550858a2374dd3db (patch) | |
tree | 26a5d95818e3e12ac2811903fe815044fa7f6d73 /DocBook/SCons/XSLT.py | |
parent | 3afa4f741c26360245dc313bc368f508b26a6b96 (diff) | |
download | swift-contrib-335d3d25e07ddcf7c00ba3b2550858a2374dd3db.zip swift-contrib-335d3d25e07ddcf7c00ba3b2550858a2374dd3db.tar.bz2 |
Moved DocBook module.
Diffstat (limited to 'DocBook/SCons/XSLT.py')
-rw-r--r-- | DocBook/SCons/XSLT.py | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/DocBook/SCons/XSLT.py b/DocBook/SCons/XSLT.py deleted file mode 100644 index 83b5ec2..0000000 --- a/DocBook/SCons/XSLT.py +++ /dev/null @@ -1,63 +0,0 @@ -import SCons.Util -import xml.dom.minidom, os, os.path - -################################################################################ -# XSLT processor -################################################################################ - -def generate(env) : - def generate_actions(source, target, env, for_signature) : - if not env.has_key("XSLTSTYLESHEET") : - raise SCons.Errors.UserError, "The XSLTSTYLESHEET construction variable must be defined" - - # Process the XML catalog files - # FIXME: It's probably not clean to do an ENV assignment globally - env["ENV"]["XML_CATALOG_FILES"] = " ".join(env.get("XMLCATALOGS", "")) - - # Build the XMLLint command - xmllintcmd = ["$XMLLINT", "--nonet", "--xinclude", "--postvalid", "--noout", "$SOURCE"] - - # Build the XSLT command - xsltcmd = ["$XSLT", "--nonet", "--xinclude"] - for (param, value) in env["XSLTPARAMS"] : - xsltcmd += ["--stringparam", param, value] - xsltcmd += ["-o", "$TARGET", "$XSLTSTYLESHEET", "$SOURCE"] - - return [ - SCons.Action.Action([xmllintcmd], cmdstr = "$XMLLINTCOMSTR"), - SCons.Action.Action([xsltcmd], cmdstr = "$XSLTCOMSTR")] - - def modify_sources(target, source, env) : - if len(env["FOCFG"]) > 0 : - source.append(env["FOCFG"]) - source.append(env.get("XMLCATALOGS", [])) - return target, source - - def scan_xml(node, env, path) : - dependencies = set() - nodes = [node] - while len(nodes) > 0 : - node = nodes.pop() - try : - document = xml.dom.minidom.parseString(node.get_contents()) - except xml.parsers.expat.ExpatError: - continue - for include in document.getElementsByTagNameNS("http://www.w3.org/2001/XInclude", "include") : - include_file = include.getAttribute("href") - dependencies.add(include_file) - if include.getAttribute("parse") != "text" : - nodes.append(env.File(include_file)) - return list(dependencies) - - env["XMLLINT"] = "xmllint" - env["XSLT"] = "xsltproc" - env["XSLTPARAMS"] = [] - env["BUILDERS"]["XSLT"] = SCons.Builder.Builder( - generator = generate_actions, - emitter = modify_sources, - source_scanner = SCons.Scanner.Scanner(function = scan_xml), - src_suffix = ".xml" - ) - -def exists(env) : - return True |