summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2019-07-14 18:00:33 (GMT)
committerGitHub <noreply@github.com>2019-07-14 18:00:33 (GMT)
commit08a74b7e14c29e3d954f3e7b30b34eb3b3628eb4 (patch)
tree49b778c84417ca1d7f922f91db37edccc05d838b /src/engine
parent13fe5fdf1e6b9092e7b88242f5e4410523f40d56 (diff)
parent2f38ee65e95cdcea441f028d7c3ce9d1b4746862 (diff)
downloadSCons-08a74b7e14c29e3d954f3e7b30b34eb3b3628eb4.zip
SCons-08a74b7e14c29e3d954f3e7b30b34eb3b3628eb4.tar.gz
SCons-08a74b7e14c29e3d954f3e7b30b34eb3b3628eb4.tar.bz2
Merge branch 'master' into fix_slow_md5_decider
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/Environment.py15
-rw-r--r--src/engine/SCons/EnvironmentTests.py11
-rw-r--r--src/engine/SCons/Scanner/LaTeX.py8
-rw-r--r--src/engine/SCons/Scanner/LaTeXTests.py16
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()