summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Gross <grossag@vmware.com>2019-11-25 19:05:19 (GMT)
committerAdam Gross <grossag@vmware.com>2019-11-25 19:09:37 (GMT)
commite76e874f44824172d1118b0f028256124332a101 (patch)
tree41b47e43a895e2f517254f835ba12f3c275757a5 /src
parent49b5f9ec268d6f913088cae0b2942f5c7a139693 (diff)
downloadSCons-e76e874f44824172d1118b0f028256124332a101.zip
SCons-e76e874f44824172d1118b0f028256124332a101.tar.gz
SCons-e76e874f44824172d1118b0f028256124332a101.tar.bz2
Add support for Value objects being implicit dependencies
As part of consolidating outside dependencies, the code I work on takes on Value objects as implicit dependencies. That allows us to take on a dependecy to an entire build (e.g. our compiler) rather than 500 files from it. This has worked fine in practice for months now, but it turns out to break when using caching, because Node.get_contents() expects all dependencies to have the "name" attribute. This change adds that attribute to the Value class and a test to confirm that Node.get_contents() works now.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/CHANGES.txt5
-rw-r--r--src/engine/SCons/Node/Python.py4
-rw-r--r--src/engine/SCons/Node/PythonTests.py10
3 files changed, 19 insertions, 0 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index db0a5f2..36ab52c 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -6,6 +6,11 @@
RELEASE VERSION/DATE TO BE FILLED IN LATER
+ From Adam Gross:
+
+ - Added support for taking instances of the Value class as implicit
+ dependencies.
+
From Philipp Maierhöfer:
- Avoid crash with UnicodeDecodeError on Python 3 when a Latex log file in
non-UTF-8 encoding (e.g. containing umlauts in Latin-1 encoding when
diff --git a/src/engine/SCons/Node/Python.py b/src/engine/SCons/Node/Python.py
index 4a62f04..546769d 100644
--- a/src/engine/SCons/Node/Python.py
+++ b/src/engine/SCons/Node/Python.py
@@ -92,6 +92,10 @@ class Value(SCons.Node.Node):
if built_value is not None:
self.built_value = built_value
+ # Set a name so it can be a child of a node and not break
+ # its parent's implementation of Node.get_contents.
+ self.name = value
+
def str_for_display(self):
return repr(self.value)
diff --git a/src/engine/SCons/Node/PythonTests.py b/src/engine/SCons/Node/PythonTests.py
index 8a01503..4c15e96 100644
--- a/src/engine/SCons/Node/PythonTests.py
+++ b/src/engine/SCons/Node/PythonTests.py
@@ -110,6 +110,16 @@ class ValueBuildInfoTestCase(unittest.TestCase):
vvv = SCons.Node.Python.Value('vvv')
bi = SCons.Node.Python.ValueBuildInfo()
+
+class ValueChildTestCase(unittest.TestCase):
+ def test___init__(self):
+ """Test support for a Value() being an implicit dependency of a Node"""
+ value = SCons.Node.Python.Value('v')
+ node = SCons.Node.Node()
+ node._func_get_contents = 2 # Pretend to be a Dir.
+ node.add_to_implicit([value])
+ contents = node.get_contents()
+
if __name__ == "__main__":
unittest.main()