diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 2e61e88ddbb..7bc0dce12a4 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -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