Fixed bug in Spec._dup, updated docstring

The private method `Spec._dup` was missing a line (when setting compiler
flags the parent spec was not set to `self`). This resulted in
an inconsistent state of the duplicated Spec. This problem has been
fixed here. The docstring of `Spec._dup` has been updated.
This commit is contained in:
alalazo 2017-08-28 20:16:32 +02:00 committed by Todd Gamblin
parent ee93993b07
commit bf7b861554

View File

@ -2543,15 +2543,24 @@ def virtual_dependencies(self):
def _dup(self, other, deps=True, cleardeps=True):
"""Copy the spec other into self. This is an overwriting
copy. It does not copy any dependents (parents), but by default
copies dependencies.
copy. It does not copy any dependents (parents), but by default
copies dependencies.
To duplicate an entire DAG, call _dup() on the root of the DAG.
To duplicate an entire DAG, call _dup() on the root of the DAG.
Args:
other (Spec): spec to be copied onto ``self``
deps (bool or Sequence): if True copies all the dependencies. If
False copies None. If a sequence of dependency types copy
only those types.
cleardeps (bool): if True clears the dependencies of ``self``,
before possibly copying the dependencies of ``other`` onto
``self``
Returns:
True if ``self`` changed because of the copy operation,
False otherwise.
Options:
dependencies[=True]
Whether deps should be copied too. Set to False to copy a
spec but not its dependencies.
"""
# We don't count dependencies as changes here
changed = True
@ -2577,6 +2586,7 @@ def _dup(self, other, deps=True, cleardeps=True):
self._dependents = DependencyMap(self)
self._dependencies = DependencyMap(self)
self.compiler_flags = other.compiler_flags.copy()
self.compiler_flags.spec = self
self.variants = other.variants.copy()
self.variants.spec = self
self.external_path = other.external_path