diff options
author | William Deegan <bill@baddogconsulting.com> | 2019-07-14 18:53:04 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2019-07-14 18:53:04 (GMT) |
commit | a2bb59f78fb41ca5b81e220032245d4c732ba566 (patch) | |
tree | f0dfd5c4b9c89e617d5949bc59890b324fadede4 /src/engine | |
parent | 9f4c9d817efe1817e3315f6299186e9e42502dfb (diff) | |
parent | 08a74b7e14c29e3d954f3e7b30b34eb3b3628eb4 (diff) | |
download | SCons-a2bb59f78fb41ca5b81e220032245d4c732ba566.zip SCons-a2bb59f78fb41ca5b81e220032245d4c732ba566.tar.gz SCons-a2bb59f78fb41ca5b81e220032245d4c732ba566.tar.bz2 |
Merge branch 'fix_slow_md5_decider' of github.com:bdbaddog/scons into fix_slow_md5_decider
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Environment.py | 15 | ||||
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 11 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeX.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeXTests.py | 16 |
4 files changed, 41 insertions, 9 deletions
diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 70b8166..8d06af7 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -2308,7 +2308,20 @@ class OverrideEnvironment(Base): # Methods that make this class act like a proxy. def __getattr__(self, name): - return getattr(self.__dict__['__subject'], name) + attr = getattr(self.__dict__['__subject'], name) + # Here we check if attr is one of the Wrapper classes. For + # example when a pseudo-builder is being called from an + # OverrideEnvironment. + # + # These wrappers when they're constructed capture the + # Environment they are being constructed with and so will not + # have access to overrided values. So we rebuild them with the + # OverrideEnvironment so they have access to overrided values. + if isinstance(attr, (MethodWrapper, BuilderWrapper)): + return attr.clone(self) + else: + return attr + def __setattr__(self, name, value): setattr(self.__dict__['__subject'], name, value) diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 1a75a90..834cfd1 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -3587,6 +3587,10 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture): def setUp(self): env = Environment() env._dict = {'XXX' : 'x', 'YYY' : 'y'} + def verify_value(env, key, value, *args, **kwargs): + """Verifies that key is value on the env this is called with.""" + assert env[key] == value + env.AddMethod(verify_value) env2 = OverrideEnvironment(env, {'XXX' : 'x2'}) env3 = OverrideEnvironment(env2, {'XXX' : 'x3', 'YYY' : 'y3', 'ZZZ' : 'z3'}) self.envs = [ env, env2, env3 ] @@ -3777,6 +3781,13 @@ class OverrideEnvironmentTestCase(unittest.TestCase,TestEnvironmentFixture): # """Test the OverrideEnvironment WhereIs() method""" # pass + def test_PseudoBuilderInherits(self): + """Test that pseudo-builders inherit the overrided values.""" + env, env2, env3 = self.envs + env.verify_value('XXX', 'x') + env2.verify_value('XXX', 'x2') + env3.verify_value('XXX', 'x3') + def test_Dir(self): """Test the OverrideEnvironment Dir() method""" env, env2, env3 = self.envs 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() |