summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoralalazo <massimiliano.culpo@googlemail.com>2017-08-28 20:16:32 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2017-08-29 00:44:43 -0700
commitbf7b8615544059c075df814b2792e7b7fa4dcf24 (patch)
treec72a0d339393436ddab2abc75a41d9c87212c4aa /lib
parentee93993b07d774bf1b2cee09960bbafe8ccfac8e (diff)
downloadspack-bf7b8615544059c075df814b2792e7b7fa4dcf24.tar.gz
spack-bf7b8615544059c075df814b2792e7b7fa4dcf24.tar.bz2
spack-bf7b8615544059c075df814b2792e7b7fa4dcf24.tar.xz
spack-bf7b8615544059c075df814b2792e7b7fa4dcf24.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/spec.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py
index 2e61e88ddb..7bc0dce12a 100644
--- a/lib/spack/spack/spec.py
+++ b/lib/spack/spack/spec.py
@@ -2543,15 +2543,24 @@ class Spec(object):
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 @@ class Spec(object):
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