-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Serialized copies of specs do not correctly report is_extension #3887
Copy link
Copy link
Closed
Description
If a spec is written to yaml and then read back, it's dependencies do not correctly report .is_extension:
>>> from spack.spec import Spec
>>> x = Spec('git')
>>> x.concretize()
>>> y = Spec.from_dict(x.to_dict())
>>> y['libxml2'].package.is_extension
True
>>> x['libxml2'].package.is_extension
False
(Spec.to_yaml and Spec.from_yaml use the corresponding dict functions, so this affects specs that have been read from files).
Note that using Spec.copy() does not have this problem.
Two notes:
- Specs constructed with
Spec.from_dicthave_concreteset to False (althoughconcreteis true if the original Spec was concrete) Package.is_extensionrefers toSpec._concrete
This suggests the following possible solutions:
- Package.is_extension uses Spec.concrete instead of Spec._concrete. This is done in Package.is_extension now uses Spec.concrete #3853 and has some (IMO valid) criticisms that the repercussions need to be clarified
Spec.from_dictshould set _concrete (perhaps if it doesn't change after concretization)Spec.to_dictshould record whether the spec was concrete
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels