diff options
author | William Deegan <bill@baddogconsulting.com> | 2019-07-06 18:42:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-06 18:42:17 (GMT) |
commit | 46136a6865894112f74ff9550336a7de5c3c55b0 (patch) | |
tree | 5bbd8777de14e211e7e8779f363fe7e6c0384fef /src | |
parent | b66be8353c8a0d5e188bade8610068e9ad18af9d (diff) | |
parent | 9a0e8e503a49485a2d50c8a24d9f041bc50d1cd1 (diff) | |
download | SCons-46136a6865894112f74ff9550336a7de5c3c55b0.zip SCons-46136a6865894112f74ff9550336a7de5c3c55b0.tar.gz SCons-46136a6865894112f74ff9550336a7de5c3c55b0.tar.bz2 |
Merge pull request #3403 from luhk/latex_scanner_multi_include
LaTeX scanner: Find > 1 includes per line
Diffstat (limited to 'src')
-rwxr-xr-x | src/CHANGES.txt | 12 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeX.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeXTests.py | 16 |
3 files changed, 23 insertions, 13 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 6a8d626..a491ba5 100755 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -42,9 +42,15 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER which specifies what character to join all the argements output into the tempfile. The default remains a space when mslink, msvc, or mslib tools are loaded they change the TEMPFILEARGJOIN to be a line separator (\r\n on win32) - From Michael Hartmann: + From Michael Hartmann: - Fix handling of Visual Studio Compilers to properly reject any unknown HOST_PLATFORM or TARGET_PLATFORM + From Mathew Robinson: + - Update cache debug output to include cache hit rate. + - No longer unintentionally hide exceptions in Action.py + + From Lukas Schrangl: + - Enable LaTeX scanner to find more than one include per line From Mats Wichmann: - scons-time takes more care closing files and uses safer mkdtemp to avoid @@ -72,11 +78,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER ParseFlags: -iquote and -idirafter. - Fix more re patterns that contain \ but not specified as raw strings (affects scanners for D, LaTeX, swig) - - From Mathew Robinson: - - Update cache debug output to include cache hit rate. - - No longer unintentionally hide exceptions in Action.py RELEASE 3.0.5 - Mon, 26 Mar 2019 15:04:42 -0700 diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py index f48c84d..d1cf04d 100644 --- a/src/engine/SCons/Scanner/LaTeX.py +++ b/src/engine/SCons/Scanner/LaTeX.py @@ -179,15 +179,7 @@ class LaTeX(SCons.Scanner.Base): 'inputfrom', 'subinputfrom'] def __init__(self, name, suffixes, graphics_extensions, *args, **kw): - - # 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. - # add option for whitespace before the '[options]' or the '{filename}' regex = r''' - ^[^%\n]* \\( include | includegraphics(?:\s*\[[^\]]+\])? diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py index 6dd7dac..409699c 100644 --- a/src/engine/SCons/Scanner/LaTeXTests.py +++ b/src/engine/SCons/Scanner/LaTeXTests.py @@ -61,6 +61,12 @@ test.write('test3.latex',r""" \includegraphics[width=60mm]{inc5.xyz} """) +test.write('test4.latex',r""" +\include{inc1}\include{inc2} +\only<1>{\includegraphics{inc5.xyz}}% +\only<2>{\includegraphics{inc7.png}} +""") + test.subdir('subdir') test.write('inc1.tex',"\n") @@ -73,6 +79,7 @@ test.write(['subdir', 'inc3c.tex'], "\n") test.write(['subdir', 'inc4.eps'], "\n") test.write('inc5.xyz', "\n") test.write('inc6.tex', "\n") +test.write('inc7.png', "\n") test.write('incNO.tex', "\n") # define some helpers: @@ -155,6 +162,15 @@ class LaTeXScannerTestCase3(unittest.TestCase): files = ['inc5.xyz', 'subdir/inc4.eps'] deps_match(self, deps, files) +class LaTeXScannerTestCase4(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(TEXINPUTS=[test.workpath("subdir")],LATEXSUFFIXES = [".tex", ".ltx", ".latex"]) + s = SCons.Scanner.LaTeX.LaTeXScanner() + path = s.path(env) + deps = s(env.File('test4.latex'), env, path) + files = ['inc1.tex', 'inc2.tex', 'inc5.xyz', 'inc7.png'] + deps_match(self, deps, files) + if __name__ == "__main__": unittest.main() |