__init__.py (SCons-4.3.0) | : | __init__.py (SCons-4.4.0) | ||
---|---|---|---|---|
skipping to change at line 68 | skipping to change at line 68 | |||
has_lxml = False | has_lxml = False | |||
# Set this to True, to prefer xsltproc over lxml | # Set this to True, to prefer xsltproc over lxml | |||
prefer_xsltproc = False | prefer_xsltproc = False | |||
# Regexs for parsing Docbook XML sources of MAN pages | # Regexs for parsing Docbook XML sources of MAN pages | |||
re_manvolnum = re.compile(r"<manvolnum>([^<]*)</manvolnum>") | re_manvolnum = re.compile(r"<manvolnum>([^<]*)</manvolnum>") | |||
re_refname = re.compile(r"<refname>([^<]*)</refname>") | re_refname = re.compile(r"<refname>([^<]*)</refname>") | |||
# | # | |||
# lxml etree XSLT global max traversal depth | ||||
# | ||||
lmxl_xslt_global_max_depth = 3100 | ||||
if has_lxml and lmxl_xslt_global_max_depth: | ||||
def __lxml_xslt_set_global_max_depth(max_depth): | ||||
from lxml import etree | ||||
etree.XSLT.set_global_max_depth(max_depth) | ||||
__lxml_xslt_set_global_max_depth(lmxl_xslt_global_max_depth) | ||||
# | ||||
# Helper functions | # Helper functions | |||
# | # | |||
def __extend_targets_sources(target, source): | def __extend_targets_sources(target, source): | |||
""" Prepare the lists of target and source files. """ | """ Prepare the lists of target and source files. """ | |||
if not SCons.Util.is_List(target): | if not SCons.Util.is_List(target): | |||
target = [target] | target = [target] | |||
if not source: | if not source: | |||
source = target[:] | source = target[:] | |||
elif not SCons.Util.is_List(source): | elif not SCons.Util.is_List(source): | |||
source = [source] | source = [source] | |||
skipping to change at line 224 | skipping to change at line 236 | |||
# Use simple pattern matching for system entities..., no support | # Use simple pattern matching for system entities..., no support | |||
# for recursion yet. | # for recursion yet. | |||
contents = node.get_text_contents() | contents = node.get_text_contents() | |||
return sentity_re.findall(contents) | return sentity_re.findall(contents) | |||
xsl_file = os.path.join(scriptpath,'utils','xmldepend.xsl') | xsl_file = os.path.join(scriptpath,'utils','xmldepend.xsl') | |||
if not has_lxml or prefer_xsltproc: | if not has_lxml or prefer_xsltproc: | |||
# Try to call xsltproc | # Try to call xsltproc | |||
xsltproc = env.subst("$DOCBOOK_XSLTPROC") | xsltproc = env.subst("$DOCBOOK_XSLTPROC") | |||
if xsltproc and xsltproc.endswith('xsltproc'): | if xsltproc and xsltproc.endswith('xsltproc'): | |||
# TODO: switch to _subproc or subprocess.run call | ||||
result = env.backtick(' '.join([xsltproc, xsl_file, str(node)])) | result = env.backtick(' '.join([xsltproc, xsl_file, str(node)])) | |||
depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")] | depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")] | |||
return depfiles | return depfiles | |||
else: | else: | |||
# Use simple pattern matching, there is currently no support | # Use simple pattern matching, there is currently no support | |||
# for xi:includes... | # for xi:includes... | |||
contents = node.get_text_contents() | contents = node.get_text_contents() | |||
return include_re.findall(contents) | return include_re.findall(contents) | |||
from lxml import etree | from lxml import etree | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 13 lines changed or added |