diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 963fecd3751b206b5c00d0d88dcd27a14889a10a..a7c8062fad5c6dae22c36079f3e889bfe77254c3 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -436,6 +436,12 @@ def to_dict(self): ('target', self.target.to_dict_or_value())]) return syaml_dict([('arch', d)]) + def to_spec(self): + """Convert this Arch to an anonymous Spec with architecture defined.""" + spec = spack.spec.Spec() + spec.architecture = spack.spec.ArchSpec(str(self)) + return spec + @staticmethod def from_dict(d): spec = spack.spec.ArchSpec.from_dict(d) @@ -518,6 +524,14 @@ def platform(): @memoized +def default_arch(): + """Default ``Arch`` object for this machine. + + See ``sys_type()``. + """ + return Arch(platform(), 'default_os', 'default_target') + + def sys_type(): """Print out the "default" platform-os-target tuple for this machine. @@ -530,8 +544,7 @@ def sys_type(): architectures. """ - arch = Arch(platform(), 'default_os', 'default_target') - return str(arch) + return str(default_arch()) @memoized