-
-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clone() does not honor 'variables' argument #3590
Comments
Thanks for filing a complete Issue! |
Quick look - there's no code for it. |
Re-reading my initial report and Mats' quick look makes me think that this could be handled in 2 steps:
|
@pauschar - Unfortunately the first option you list is really not viable. As you can specify any variable to be added or overwritten(from the env being cloned) to the cloned env. |
Four years later... been gardening around Variables anyway, and tried a quick fix, which works fine: $ git diff SCons/Environment.py
diff --git a/SCons/Environment.py b/SCons/Environment.py
index 5bf763d91..1ff09fa9e 100644
--- a/SCons/Environment.py
+++ b/SCons/Environment.py
@@ -1568,7 +1568,7 @@ class Base(SubstitutionEnvironment):
self._dict[key] = dk + val
self.scanner_map_delete(kw)
- def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw):
+ def Clone(self, tools=[], toolpath=None, variables=None, parse_flags = None, **kw):
"""Return a copy of a construction Environment.
The copy is like a Python "deep copy"--that is, independent
@@ -1577,7 +1577,6 @@ class Base(SubstitutionEnvironment):
(like a function). There are no references to any mutable
objects in the original Environment.
"""
-
builders = self._dict.get('BUILDERS', {})
clone = copy.copy(self)
@@ -1603,6 +1602,8 @@ class Base(SubstitutionEnvironment):
for key, value in kw.items():
new[key] = SCons.Subst.scons_subst_once(value, self, key)
clone.Replace(**new)
+ if variables:
+ variables.Update(clone)
apply_tools(clone, tools, toolpath)
I added a couple of printouts to the original example - namely to print the value of @bdbaddog is this worth pushing? |
The docs fail to mention the extra args to
You can argue that the
leaving out |
Previously, "variables" would just be set as a construction var, now it has the same meaning as an Environment() call. Docs updated and test added. Fixes SCons#3590 Signed-off-by: Mats Wichmann <mats@linux.com>
Describe the bug
As per discussion with bdbaddog on Discord around 2020-03-12, the following SConstruct does not work as expected:
Required information
scons
The text was updated successfully, but these errors were encountered: