You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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_dict have _concrete set to False (although concrete is true if the original Spec was concrete)
Package.is_extension refers to Spec._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_dict should set _concrete (perhaps if it doesn't change after concretization)
Spec.to_dict should record whether the spec was concrete
If a spec is written to yaml and then read back, it's dependencies do not correctly report
.is_extension:(
Spec.to_yamlandSpec.from_yamluse 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:
Spec.from_dicthave_concreteset to False (althoughconcreteis true if the original Spec was concrete)Package.is_extensionrefers toSpec._concreteThis suggests the following possible solutions:
Spec.from_dictshould set _concrete (perhaps if it doesn't change after concretization)Spec.to_dictshould record whether the spec was concrete