def __init__(self, name, suffixes, graphics_extensions, *args, **kw):
- regex = '^[^%]*\\\\(include|includegraphics(?:\[[^\]]+\])?|input|bibliography|usepackage){([^}]*)}'
+ # We have to include \n with the % we exclude from the first part
+ # part of the regex because the expression is compiled with re.M.
+ # Without the \n, the ^ could match the beginning of a *previous*
+ # line followed by one or more newline characters (i.e. blank
+ # lines), interfering with a match on the next line.
+ regex = r'^[^%\n]*\\(include|includegraphics(?:\[[^\]]+\])?|input|bibliography|usepackage){([^}]*)}'
self.cre = re.compile(regex, re.M)
self.graphics_extensions = graphics_extensions
test.write('test1.latex',"""
\include{inc1}
\input{inc2}
+include{incNO}
+%\include{incNO}
+xyzzy \include{inc6}
""")
test.write('test2.latex',"""
test.write(['subdir', 'inc3.tex'], "\n")
test.write(['subdir', 'inc4.eps'], "\n")
test.write('inc5.xyz', "\n")
+test.write('inc6.tex', "\n")
+test.write('incNO.tex', "\n")
# define some helpers:
# copied from CTest.py
s = SCons.Scanner.LaTeX.LaTeXScanner()
path = s.path(env)
deps = s(env.File('test1.latex'), env, path)
- headers = ['inc1.tex', 'inc2.tex']
+ headers = ['inc1.tex', 'inc2.tex', 'inc6.tex']
deps_match(self, deps, headers)
class LaTeXScannerTestCase2(unittest.TestCase):